How can I get a youtube video to autoplay and loop.

7.5k views Asked by At

I realize that this question has been asked before here: Getting an Embedded YouTube Video to Auto Play and Loop However none of the suggested methods have worked for me. My code is supposed to hide the control bar and cause the video to autoplay and loop.

    <iframe width="100%" height="425" src="https://www.youtube.com/embed/c_70mlRY-    4c?rel=0&amp;controls=0&amp;showinfo=0";loop=1;autoplay=1 frameborder="0" allowfullscreen></iframe>

Works perfectly when embedded into a drag and drop site (blog, wix) but when I try to use it on my own website, a play button comes up that asks the user to play the video. After that, it loops.

If anyone knows how to solve this problem, constructive advice would be greatly appreciated :) I am aware that the same functionality exists in html5 but I haven't been able to get a video background to work either.

1

There are 1 answers

1
Kate at Gavin Academy On

I figured it out but I hope this helps others. It was a syntax error. I was putting my autoplay and loop outside of the end quotation mark. My code should have looked like this and it's working now:

    <iframe width="100%" height="425" src="https://www.youtube.com/embed/c_70mlRY-4c?rel=0&amp;controls=0&amp;showinfo=0;loop=1&amp;autoplay=1&amp" frameborder="0" allowfullscreen></iframe>