I am trying to embed the new iframe version of a YouTube video and get it to auto play.
As far as I can tell, there is no way of doing this by amending flags to the URL. Is there a way to do it by using javascript & the API?
I am trying to embed the new iframe version of a YouTube video and get it to auto play.
As far as I can tell, there is no way of doing this by amending flags to the URL. Is there a way to do it by using javascript & the API?
The flags, or parameters that you can use with IFRAME and OBJECT embeds are documented here; the details about which parameter works with what player are also clearly mentioned:
YouTube Embedded Players and Player Parameters
You will notice that
autoplay
is supported by all players (AS3, AS2 and HTML5).The embedded code of youtube has autoplay off by default. Simply add
autoplay=1
at the end of "src" attribute. For example:August 2018 I didn't find a working example on the iframe implementation. Other questions were related to Chrome only, which gave it away a little.
You'll have to mute sound
mute=1
in order to autoplay on Chrome. FF and IE seem to be working just fine usingautoplay=1
as parameter.To have the accepted answer by mjhm working on Chrome 66 in May 2018, I added
allow=autoplay
to the iframe andenable_js=1
to the query string:2014 iframe embed on how to embed a youtube video with autoplay and no suggested videos at end of clip
Example Below: .