gpt4 book ai didi

javascript - 无法识别的功能 : 'autoplay' error with YouTube embedded player

转载 作者:可可西里 更新时间:2023-11-01 01:32:32 25 4
gpt4 key购买 nike

使用数据 3 API 加载 YouTube iFrame 嵌入播放器时,是否还有其他人在浏览器控制台中看到此警告?

Unrecognized feature: 'autoplay'.

Google 文件中出现错误:www-widgetapi.js:110 它似乎是 JavaScript 错误(来自第 110 行):

c.setAttribute("allowfullscreen",1);c.setAttribute("allow","autoplay; encrypted-media");

我假设自动播放部分应该是:

c.setAttribute("autoplay",0);

文件在这里:https://s.ytimg.com/yts/jsbin/www-widgetapi-vflkvQ6Kw/www-widgetapi.js

错误甚至出现在他们的开发者演示页面上:https://developers.google.com/youtube/youtube_player_demo

人们如何向 Google 报告这些事情?

最佳答案

我想知道这是不是:

https://developers.google.com/web/updates/2017/09/autoplay-policy-changes

As you may have noticed, web browsers are moving towards stricter autoplay policies in order to improve the user experience, minimize incentives to install ad blockers, and reduce data consumption on expensive and/or constrained networks. These changes are intended to give greater control of playback to users and to benefit publishers with legitimate use cases.

Chrome's autoplay policies are simple:

  • Muted autoplay is always allowed.
  • Autoplay with sound is allowed if:
    • User has interacted with the domain (click, tap, etc.).
    • On desktop, the user's Media Engagement Index threshold has been crossed, meaning the user has previously play video with sound.
    • On mobile, the user has added the site to his or her home screen.
    • Top frames can delegate autoplay permission to their iframes to allow autoplay with sound.

与它有什么关系。我遇到了同样的问题,文章提到自动播放的方式将从 2018 年 1 月(现在!🎉)开始改变

我在我的代码中删除了自动播放,而是使用了 this answer 中描述的技术。

像这样:

player = new YT.Player( videoID , {
videoId: youtubeID, // the ID of the video (mentioned above)
playerVars: {
// autoplay: 1, // start automatically
controls: 0, // don't show the controls (we can't click them anyways)
modestbranding: 1, // show smaller logo
loop: 1, // loop when complete
playlist: youtubeID // required for looping, matches the video ID
},
events : {
'onReady' : onPlayerReady
}
});

function onPlayerReady(event) {
player.mute();
player.playVideo();
}

我不确定这是否构成“答案”,如果不是,请告诉我,我会删除它。

关于javascript - 无法识别的功能 : 'autoplay' error with YouTube embedded player,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48247002/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com