Autoplay YouTube Embed 2020

With the recent updates in Firefox and Chrome, autoplaying YouTube/Vimeo videos have been disabled. If you check your console (I use Firefox), you will see a warning: Feature Policy: Skipping unsupported feature name autoplay.

Even following Googles guidelines with adding a ?autoplay=1 to your video URL does not work.

Which completely throws out YouTube videos as background videos for your website

Unless you use the YouTube API system with a bit of javascript thrown in.

Thanks to YouTube, they provided a working solution to autoplaying a youtube video.

We will tweak it slightly to autoplay!

Remember to change the videoId to your video ID.

With some added CSS and a non-interactive layer, we have a full with/height background player:

The only other suggest I would add is to load the video after the page has loaded to help give the appearance of a faster loading website. Depends on your use case.

Video liên quan

0 nhận xét: