oTree Forum >

Youtube iframe doesn't autoplay

#1 by AndyFM

Hi,

I'm embedding a youtube video using an iframe in a survey.
The parameters are set to allow="autoplay" and src="https://...?autoplay=1&..."

The video thumbnail is displayed but the video doesn't autoplay.

It's crucial because I need the participant to watch the video so I timed the next button to appear after the video
(suggestions for alternative solutions like triggering the button upon would be very welcome!).

Screenshot attached.

Thanks for your time!
Andy

#2 by AndyFM

Also figured this one out. Writing the hack here in case someone as lost as me is interested. 
Modern browsers don't allow autoplay without active human intervention, unless the video is muted by default.
To do so one can add mute=1 inside the iframe parameters (i.e., given my poor terminology, you could write youtube_video_url?autoplay=1&mute=1;).

Note however: doing so caused the listener function I use to condition the appearance of the Next button on the video being "ended" to stop working, for some imperscrutable reason...

Write a reply

Set forum username