Reputation: 113
Youtube iframe auto play not working for chrome and video resolution set not working for all browsers
<section class="wow fadeIn example no-padding no-transition homeBanner">
<div id="video" class="hidden-xs loaded">
<iframe class="ytplayer-player" style="width: 1519px; height: 855px; left: 0px; top: -281px;" allowfullscreen="1" allow="autoplay" title="YouTube video player"
src="https://www.youtube.com/embed/jHg0b7Nai6c?iv_load_policy=3&modestbranding=0&autoplay=1&controls=0&rel=0&showinfo=0&wmode=opaque&branding=0&autohide=0&loop=1&rel=0&enablejsapi=1&origin=https%3A%2F%2Fhub.youth.gov.ae&widgetid=1"
width="1519" height="855" frameborder="0"></iframe>
</div>
Upvotes: 0
Views: 4975
Reputation: 117
You have to add the parameter "mute" to the src of the iframe. Obviously, the video will start muted, but the autoplay will work. Browsers (at least Firefox and Chrome) always allow autoplay, but videos have to start silent.
&mute=1
https://codepen.io/romualdinho/pen/zXQWEO
Upvotes: 2
Reputation: 111
You have to use allow="autoplay" as seen on the policy changes page.
The Embed Paramaters documentation page at https://developers.google.com/youtube/player_parameters DOES NOT contain this information. In fact, this page provides an embed code example that claims to enable autoplay and it is just plain non-compliant.
Upvotes: 1