首页 > 解决方案 > How come YouTube can autoplay videos without user interaction but no other site can?

问题描述

Apologies if this question has been asked before.

On every webpage I know of, browsers block video/audio autoplay on page load and throw the following error:

Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. https://developer.chrome.com/blog/autoplay/

The provided link explains why the rule is in place, and it makes sense. But how come YouTube is the exception, and has no issue playing even without interacting with the page? Even Vimeo can't autoplay if you open a video in a brand new tab. Does Chromium have a hardcoded filter to allow youtube.com to autoplay video+audio?

标签: javascriptvideoyoutubechromium

解决方案


推荐阅读