I am using youtube video in "iframe" with height width src etc. but it is playing auto. I want to play it with onclick. Please help me.
7 Answers
14
votes
To disable autoplay, just put &autoplay=0 after the video ID so it looks like this:
<object width="425" height="350">
<param name="movie" value="http://www.youtube.com/v/OdT9z-JjtJk&autoplay=0"></param>
<embed src="http://www.youtube.com/v/OdT9z-JjtJk&autoplay=0" type="application/x-shockwave-flash" width="425" height="350"></embed>
</object>
http://support.google.com/youtube/bin/answer.py?hl=en&answer=1181821
Updated code.
3
votes
It used to work. YouTube only verifies how to autoplay but they dont talk aboth NOT autoplay.
&autoplay=0 does not work.
http://support.google.com/youtube/bin/answer.py?hl=en&answer=171780&rd=1
1
votes
0
votes
Remove autoplay=1 allow='autoplay'
and play video by click on link.
<a id="play-video" href="#">Play Video</a><br />
<iframe id="video" src="//www.youtube.com/embed/9B7te184ZpQ?rel=0" frameborder="0"></iframe>
$(document).ready(function() {
$('#play-video').on('click', function(ev) {
$("#video")[0].src += "&autoplay=1";
ev.preventDefault();
});
});
-1
votes
iframe
way to do it. You just useobject
andembed
tags. – Alex W