Closed OlafHaag closed 4 years ago
Changing line https://github.com/martignoni/hugo-video/blob/0774536f94263792c032ae00c3277aaf97e4c8e8/layouts/shortcodes/video.html#L28 to
{{ if or (in .MediaType.Suffixes "mp4") (in .MediaType.Suffixes "m4v") }}
solved it for me.
This not a bug, but a feature :-) As stated in the README:
When no video file of the given name is found in the supported format (see above), the shortcode intentionally fails with a No valid video file with filename
found. error.
I'd be glad to add this new format. Please send me a PR.
Thanks for your reply. I'll do a PR later.
The issue is, that instead of the No valid video file found
error, I get an unhandled index out of range
error at <i18n "videoUnsupported" $video_dl>
.
The former I get when giving a wrong filename, for example. The latter I get when giving the correct filename, but the video is unsupported.
It has to do with the translation, but not sure what's exactly causing it.
OK. Please describe step by step how to reproduce, so I can provide a fix.
Can you please send me your PR? You've made it in your own repo.
Tested. Works as expected.
Hi! I tried using this shortcode, but I get following runtime error when linking to an unsupported video, I guess (m4v).
failed to render shortcode "video": failed to process shortcode: "D:\website\themes\hugo-video\layouts\shortcodes\video.html:55:8": execute of template failed: template: shortcodes/video.html:55:8: executing "shortcodes/video.html" at <i18n "videoUnsupported" $video_dl>: error calling i18n: runtime error: index out of range [0] with length 0