Loop YouTube video

Hi there,
I have a YouTube video which I would like to loop. Is there a setting in YouTube that I can do this? At the moment, it stops at the end and displays other random videos.

Thanks

Hi there toolman

[quote][color=navy]"To loop a video on the YouTube desktop site,
right-click on the video and select Loop.

If you’re using a mobile device, you can do the
same thing if you load the desktop website in your
mobile browser, or you can download apps that will
allow you to quickly loop videos.
"[/color][/quote]

Source:-

http://www.wikihow.com/Loop-YouTube-Videos

coothead

Hi coothead,

Thanks for the reply.

Sorry, I should have been more clear. I meant to loop it when its embedded on a website. Is there an attribute to add to the code that will loop it rather than the user having to do it?

Thanks

 
 
…and here is an example of how a link might look…

https://www.youtube.com/embed/[color=red]x12QsUmgbRQ[/color][color=navy]?version=3&loop=1&playlist=[/color][color=red]x12QsUmgbRQ[/color]

coothead

Thanks, that’s what I needed.

I am now trying to add that to the URL in my iFrame. I’ve tried manipulating the URL, but I get a console error:

“Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘https://www.youtube.com’) does not match the recipient window’s origin (‘null’).”

This is the code I’m trying:

<script>jQuery(window).bind("load", function() {  jQuery('iframe').attr("src","https://www.youtube.com/watch?v=Aj9cvXsOY2s&loop=1");});</script>

I know this probably belongs in the JS forum, sorry.

Read the note about iframe embeds in the link I provided.
If that is too much trouble, try copying the URL provided by @coothead

Hi there toolman,

why on earth do you want to use the sledgehammer that is “jQuery” ? :rolleyes:

What is your actual objection to this…

<iframe 
  width="640" height="360" 
  src="https://www.youtube.com/embed/Aj9cvXsOY2s?version=3&loop=1&playlist=Aj9cvXsOY2s" 
  frameborder="0" 
  allowfullscreen>
</iframe>

coothead

I’m trying to change the parameters as the video is being generated by a WordPress plugin which is buggy :rage:

 
 
why do you need a “Wordpress” plugin? :rolleyes:

This is a just a simple snippet of HTML code. :winky:

coothead

1 Like

Did you try including the “playlist” parameter?

Thanks, I used the playlist and set it to the same ID as the video and also added rel=0 to the URL

1 Like