Reputation: 8889
I have a html video where i have image which loads initially. and that image dissapear and play that video.
I want the image should always appear,unill i click on the image. Once i click on the image, video should play.
Please find the jsfiddle:
http://jsfiddle.net/pwxcvxe8/173/
We have tried autoplay = ""
and also removing autoplay from the video tag but no joy.
What change i need to make, if i want to play the video on click of image?
Upvotes: 0
Views: 13205
Reputation: 2965
Try adding autoplay="false"
or delete the autoplay
. This worked for me.
Hope this will help.
Upvotes: 1
Reputation: 369
Taken from the MDN Web Docs https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video "The autoplay attribute has precedence over preload. If autoplay is specified, the browser would obviously need to start downloading the video for playback."
autoplay
.preload
make sure it is set to none preload="none"
, since the default for this attribute is auto
.This worked for me.
Upvotes: 0
Reputation: 46
Here is Updated Code, You Can Remove autoplay attribute from video element, so it will never play autoplay, apart from that if you need to stop autoplay through script you can register event on it and use Dom Method "element.pause()" to stop the video here
Upvotes: 0
Reputation: 663
Removing the autoplay
from the <video>
tag worked fine to stop it autoplaying.
To make it so the image plays when you click, use the following jQuery:
$('#vid').click(function() {
$('#vid').get(0).play()
});
Feel free to ask any questions.
Upvotes: 2