How to disable auto-play for video when src is from my local pc?
<iframe width="465" height="315" src="videos/example.mp4"></iframe>
I have tried the following, but it doesn't work:
src="videos/example.mp4?autoplay=0"
src="videos/example.mp4?autoplay=false"
src="videos/example.mp4?autostart=0"
src="videos/example.mp4?autostart=false"
If you are using HTML5, using the Video tag is suitable for this purpose.
You can use the Video Tag this way for no autoplay:
To enable auto-play,
Replace the iframe for this:
What do you think about
video
tag ? If you don't have to useiframe
tag you can usevideo
tag instead.You should not use
autoplay
attribute in yourvideo
tag to disable autoplay.You can set the source of the player as blank string on loading the page, in this way you don't have to switch to
video
tag.When you want to play a video, just change its
src
attribute, for example:I've tried all the possible solutions but nothing worked for local video bindings. I believe best solution would be to fix using jQuery if you still wants to use iframes.
Note: It'll find all the iframes on document ready and loop through each iframe contents and replace/remove
autoplay
attribute. This solution can be use anywhere in your project. If you would like to do for specific element then use the code under$.each
function and replace$(video)
with your iframe element id like$("#myIFrameId")
.You're supposed to put the characters
?rel=0
after the YouTube video unique link and before the quotations. it worked for me