videojs / videojs-youtube

YouTube playback technology for Video.js
1.12k stars 548 forks source link

Infinite loading screen until I press play? #580

Closed Nmoleo64 closed 3 years ago

Nmoleo64 commented 3 years ago

Hi everyone,

When I embed a YouTube video using the videojs-youtube, it shows an infinite loading indicator until the big play button is pressed, at which point the video plays flawlessly. Is there any way to fix this issue so that it doesn't confuse my users? Also, the autoplay doesn't seem to work, which may be related to this issue. Any ideas? I am using Firefox.

Thanks for your help

Nmoleo64 commented 3 years ago

Never mind - I figured out the issue. It is caused by Firefox blocking autoplay by default. I will leave this up in case anyone else has the same problem.

narration-sd commented 3 years ago

So how did you work around this in Firefox, @Nmoleo64 Nicholas?

Could be useful for us to know :)

Nmoleo64 commented 3 years ago

So how did you work around this in Firefox, @Nmoleo64 Nicholas?

Could be useful for us to know :)

Unfortunately the only workaround I was able to find was to enable autoplay for my site in the Firefox settings. There doesn't seem to be a workaround I can do in the code since Firefox wants to block ads and news sites from playing video and audio.

narration-sd commented 3 years ago

Got a little intrigued, and found a page with some suggestions that might be useful, as well as quite clear description of important things to know

https://mux.com/blog/video-autoplay-considered-harmful/

Perhaps the one about using the Promise from video.play() to put up a Play button automatically if the video isn't going to start by itself is a good one...