I've looked everywhere for a similar problem with no luck.
I have an html5 mp4 video that won't play when the play button is clicked. I know the click is sensed because the play button highlights when clicked. The other default controls are responsive, the video just won't play.
I don't think it's communicating with the DOM correctly. The video controls are default html5
The <video>
sits in a div
with the class .divWrapper
this div does have a prevent default to prevent a function called HandleMouseDown
from firing, but this should not interfere with the play button. Especially since it has had no effect on the other video controls.
here is the html
<div class="vidWrapper">
<video width="430" height="261" preload="metadata" controls>
<source src="vids/JB_COMMERCIAL_WEB.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
<source src="vids/JB_COMMERCIAL_WEB.ogv" type='video/ogg; codecs="theora, vorbis"'>
<object width="640" height="384" type="application/x-shockwave-flash"
data="vids/JB_COMMERCIAL_WEB.swf?image=JB_COMMERCIAL_WEBplaceholder.jpg&file=vids/JB_COMMERCIAL_WEB.mp4">
<param name="movie" value="JB_COMMERCIAL_WEB.swf?image=JB_COMMERCIAL_WEBplaceholder.jpg&file=vids/JB_COMMERCIAL_WEB.mp4" />
</object>
</video>
</div>
Here is the prevent default snippet.
$("#" + section + "Copy").slideDown("normal", function()
{ dropdownSection = section; document.onclick = HandleMouseDown;
$(".vidWrapper").click(function(HandleMouseDown) {return false;});});
EDIT: I was able to get the video to play by inserting jquery to force the video to play. Now I have a different problem. The video plays but won't pause.
My question is, how do I modify the code so the video pauses when it's clicked?
Here is the newest code:
$("#" + section + "Copy").slideDown("normal", function() { dropdownSection = section; document.onclick = HandleMouseDown; $(".vidWrapper").click(function(HandleMouseDown) {return false;});
$(".vidWrapper").click(function() {$('video', this).get(0).play();});
});