Log in

View Full Version : Youtube autoplay and loop



mlegg
07-05-2013, 04:11 PM
On this page http://www.pscompetitiveedge.com/references.html I have an embedded Youtube video (Greetings Intro) in the middle of the page. I have &autoplay=1&loop=1?rel=0 in the embed code. I got this from the Youtube help page, but it doens't seem to be working. :confused:

The video does start. It does not loop and thus causing related videos to show at the end.
&loop=1? should cause the loop
rel=0 should show no related videos

Why didn't this work? :confused:

janu
07-05-2013, 04:17 PM
the video is completely working fine for me on the link given by you

mlegg
07-05-2013, 04:38 PM
The video does load and play. The video does not loop, thus causing rel videos to show at the end.

http://i42.tinypic.com/vez0v9.jpg

Beverleyh
07-05-2013, 04:48 PM
Maybe this can shed some light - from Google developer documentation;

Note: This parameter (loop) 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:so it seems you also need to set the playlist parameter too. Ref: https://developers.google.com/youtube/player_parameters#loop

mlegg
07-05-2013, 05:42 PM
I am using this code

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

would it help if I changed it to the "old" style code and add the &autoplay=1&loop=1?rel=0?

<object width="420" height="315"><param name="movie" value="//www.youtube.com/v/JkQS1MIplKI?version=3&amp;hl=en_US&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="//www.youtube.com/v/JkQS1MIplKI?version=3&amp;hl=en_US&amp;rel=0" type="application/x-shockwave-flash" width="420" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>

molendijk
07-05-2013, 06:14 PM
<script type="text/javascript" src="http://www.youtube.com/player_api"></script>

<script type="text/javascript">
// Works in Firefox, Chrome, IE 8 and up, Opera. Page must be live in order for the script to work with IE. Thanks to jscheuer1 for the assistance
var controllable_player,start,
statechange = function(e){
if(e.data === 0){controllable_player.seekTo(0); controllable_player.playVideo()}

};
function onYouTubeIframeAPIReady() {
controllable_player = new YT.Player('controllable_player', {events: {'onStateChange': statechange}});
}

if(window.opera){
addEventListener('load', onYouTubeIframeAPIReady, false);
}
setTimeout(function(){
if (typeof(controllable_player) == 'undefined'){
onYouTubeIframeAPIReady();
}
}, 3000)
</script>

<iframe id="controllable_player" src="http://www.youtube.com/embed/JkQS1MIplKI?autoplay=1"></iframe>
rel=0 doesn't make sense in a loop.

mlegg
07-05-2013, 09:07 PM
Thank you very much.

RF37
11-18-2014, 01:28 PM
Hi, I want the correct autoplay and loop for this embed, Please.

<iframe width="560" height="315" src="//www.youtube.com/embed/NUsoVlDFqZg" frameborder="0" allowfullscreen></iframe>

molendijk
11-18-2014, 01:56 PM
The “loop” parameter needs to work together with the “playlist” parameter if you want the loop to work.
As you don't have a playlist, just make your single video look like one:


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