Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting an Embedded YouTube Video to Auto Play and Loop

I am trying to get a basic Youtube video to auto play and auto loop embedded on a page, but I'm having no luck.

<div style="text-align: center; margin: auto"><object type="application/x-shockwave-flash" style="width:1120px; height:630px;" data="http://www.youtube.com/v/GRonxog5mbw?rel=0&amp;loop=1&amp;autoplay=1&amp;showsearch=0&amp;version=3&amp;showinfo=0&amp;modestbranding=1&amp;fs=1"> <param name="movie" value="http://www.youtube.com/v/GRonxog5mbw?rel=0&amp;loop=1&amp;autoplay=1&amp;showsearch=0&amp;version=3&amp;showinfo=0&amp;modestbranding=1&amp;fs=1" /> <param name="allowFullScreen" value="true" /> <param name="allowscriptaccess" value="always" /> </object></div> 
like image 222
Justin Newbury Avatar asked Oct 23 '12 23:10

Justin Newbury


People also ask

Can you Autoplay an embedded YouTube video?

To make an embedded video autoplay, add "&autoplay=1" to the video's embed code right after the video ID (the series of letters that follows "embed/"). Embedded videos that are autoplayed don't increment video views.

How do I loop an embedded video?

If you'd like your embedded video to autoplay or loop, go to the video's page on vimeo.com and click the "Share" button in the upper right corner of the video player. In the window that opens, click the "Show options" link, and check the corresponding boxes next to "Loop this video," "Autoplay this video," or both.

How do I turn on auto loop on YouTube?

YouTube now allows you to loop any video by right-clicking the video or play button, and then selecting the Loop option from the drop-down menu that appears.


2 Answers

YouTubes HTML5 embed code:

<iframe width="560" height="315" src="http://www.youtube.com/embed/GRonxog5mbw?autoplay=1&loop=1&playlist=GRonxog5mbw" frameborder="0" allowfullscreen></iframe>​ 

You can read about it here: Link View original content on the Internet Archive project.

like image 197
Jamie Hayman Avatar answered Sep 19 '22 13:09

Jamie Hayman


Here is the full list of YouTube embedded player parameters.

Relevant info:

autoplay (supported players: AS3, AS2, HTML5) Values: 0 or 1. Default is 0. Sets whether or not the initial video will autoplay when the player loads.

loop (supported players: AS3, HTML5) Values: 0 or 1. Default is 0. In the case of a single video player, a setting of 1 will cause the player to play the initial video again and again. In the case of a playlist player (or custom player), the player will play the entire playlist and then start again at the first video.

Note: This parameter has limited support in the AS3 player and in IFrame embeds, which could load either the AS3 or HTML5 player. Currently, the loop parameter only works in the AS3 player when used in conjunction with the playlist parameter. To loop a single video, set the loop parameter value to 1 and set the playlist parameter value to the same video ID already specified in the Player API URL:

http://www.youtube.com/v/VIDEO_ID?version=3&loop=1&playlist=VIDEO_ID

Use the URL above in your embed code (append other parameters too).

like image 21
Salman A Avatar answered Sep 20 '22 13:09

Salman A