javascript - 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?
解决方案
推荐阅读
- c++ - 如何修改这个 C++ 类使其与 C 代码一样高效?
- sql - 计算 Postgresql 中每个年龄组的频率
- python - 我如何使用 Python 进行新加坡车牌识别的校验和
- vb.net - 如何读取特定时间的响应数据并检查数据?
- android - 如何在android嵌套回收器视图中更新内部适配器项
- javascript - Ruby on Rails 和 MathJax - 如何强制页面重新加载,以便我的 mathjax 将呈现?
- python - 在 Python 中将 NDJSON 转换为 CSV
- python - 如何使用用户输入从文件中打印整行
- gnu-make - --always-make 可以不影响子制作吗?
- powershell - 正确编写powershell脚本