Is anyone else seeing this warning in the browser console when loading a YouTube iFrame embed player using the data 3 API?
Unrecognized feature: 'autoplay'.
The error occurs in a Google file: www-widgetapi.js:110 it appears to be a JavaScript error (this is from line 110):
c.setAttribute("allowfullscreen",1);c.setAttribute("allow","autoplay; encrypted-media");
I assume the autoplay part should simply be:
c.setAttribute("autoplay",0);
The file is here: https://s.ytimg.com/yts/jsbin/www-widgetapi-vflkvQ6Kw/www-widgetapi.js
The error is even occurring on their developer demo page: https://developers.google.com/youtube/youtube_player_demo
How do people report these things to Google?
If (as with this example) you utilize already embedded players then make sure you append '? enablejsapi=1' to the end of the embed URL. Essentially this manager keeps track of the registered videos. If it detects that a registered video begins to play it will pause any other registered video that is currently playing.
Developers can use the iFrame API to programmatically create and interact with an Embed or with multiple Embeds in the same web app. The iFrame API includes methods that you can use to start playback, change the content rendering in an Embed, or stop playback.
I wonder if this:
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.
Has anything to do with it. I came up with the same problem and the article mentions that the way autoplay will be working from January 2018 (now! 🎉) will be changing.
I have removed an autoplay in my code, and instead used a technique described in this answer
like so:
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();
}
I'm not sure if this constitutes an 'answer' so let me know if you not and I'll remove it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With