martignoni / hugo-video

A Hugo theme component to embed videos using HTML video element
GNU General Public License v3.0
107 stars 27 forks source link

Video doesn't autoplay on iOS devices #23

Closed big5am closed 3 years ago

big5am commented 3 years ago

I fixed this by adding the playsinline attribute to the video.html file:

{{ if eq (.Get "playsinline") "true" }}playsinline {{ end }}

martignoni commented 3 years ago

I'd like to reproduce the wrong behaviour. Please post your repo and a link.

big5am commented 3 years ago

Hey @martignoni

Sorry, It's a private repo, unfortunately.

Forked change here: https://github.com/big5am/hugo-video

Here's the shortcode I'm using {{< video autoplay="true" loop="true" src="videoname" muted="true" controls="false" playsinline="true" width="300px"}}

martignoni commented 3 years ago

Sorry, It's a private repo, unfortunately.

I'm afraid it's not possible to fix something I (or others) cannot reproduce as a bug: video play correctly on iOS (see e.g. https://moodlebox.net/en/help/root-certificate-install-macos/, source code: https://github.com/moodlebox/moodlebox.net/tree/master/content/en/help/install-certificate-macos).

Please try to publish a minimal working (buggy) example, so that we can confirm there's indeed something to fix.

big5am commented 3 years ago

Video plays on iOS yes, but autoplay doesn't work. i.e. where video loads and plays automatically when the website loads.

I'll do my best to whip up an example asap.

It's a known requirement for autoplaying vids on iOS (sucks i know)

https://developer.apple.com/documentation/webkit/delivering_video_content_for_safari

martignoni commented 3 years ago

Thanks for the ref. I'll fix this soon.

martignoni commented 3 years ago

I'll go for adding playsinline by default, as it has no real drawbacks.