What's the easiest way to add pause/play functionality by clicking anywhere in the video element similar to most video players?
I tried:
$('video').click(function() {
if($(this).paused){
开发者_JAVA技巧 $(this).play();
} else {
$(this).pause();
}
});
But it didn't like the $(this).pause() call. Any help is appreciated. Thanks.
DS
$(".mejs-mediaelement").click(function(){
if($(".mejs-overlay-play").css('display') == 'none'){
$('video').each(function(){this.player.pause()});
}
});
just try it :)
$('video').click(function() {
if(this.paused){
this.play();
} else {
this.pause();
}
});
But, this won't work. You will want to float an invisible div (with an invisible PNG in it) over the video to receive the click commands.
Or you can use a solution like http://videojs.com/
精彩评论