Reputation: 914
I am using the following code:
<iframe src="https://www.youtube.com/embed/AAAAAAAAA?controls=0&showinfo=0&rel=0&autoplay=1&loop=1&mute=1"
frameborder="0" allowfullscreen></iframe>
Autoplay works, when mute=1
But it only plays once - it seems that the loop=1
is being ignored, and it just stops after once cycle, and displays suggested videos from this channel (related videos are being prevented bu the rel=0
parameter, but its still showing suggested in-channel video, after a single loop).
Any ideas how to get the loop to work? I have tried via the sample here too: https://www.w3schools.com/html/tryit.asp?filename=tryhtml_youtubeiframe_loop Thanks
Upvotes: 9
Views: 8577
Reputation: 208
Add the playlist parameter and set its value as the current video Id. This should work just fine.
<iframe src="https://www.youtube.com/embed/AAAAAAAAA?controls=0&showinfo=0&rel=0&autoplay=1&loop=1&mute=1&playlist=AAAAAAAAA"
frameborder="0" allowfullscreen></iframe>
Upvotes: 14
Reputation: 1070
According to this article of Google, you can not loop any YouTube embed without a playlist.
Therefore to loop your video you must create a custom playlist on YouTube at first, then add all the videos in the playlist.
And try again with the code:
<iframe src="https://www.youtube.com/embed/VIDEOID?playlist=PLAYLISTID&controls=0&showinfo=0&rel=0&autoplay=1&loop=1&mute=1"
frameborder="0" allowfullscreen></iframe>
Upvotes: 4
Reputation: 803
Seems like a bug.
This worked for me:
<iframe width="420" height="345" src="https://www.youtube.com/embed/tgbNymZ7vqY?playlist=bPZSDBvDmVw&mute=1&loop=1">
I think the playlist part is whats affecting it.
Upvotes: 0