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){
$(this).play();
} else {
$(this).pause();
}
});
But it didn't like the $(this).pause() call. Any help is appreciated. Thanks.
DS
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){
$(this).play();
} else {
$(this).pause();
}
});
But it didn't like the $(this).pause() call. Any help is appreciated. Thanks.
DS
Share Improve this question edited Mar 4, 2015 at 21:26 L84 46.3k59 gold badges181 silver badges259 bronze badges asked Apr 14, 2011 at 18:45 DamnSemicolonDamnSemicolon 2611 gold badge3 silver badges10 bronze badges2 Answers
Reset to default 4 $(".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 mands.
Or you can use a solution like http://videojs./
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744838382a4596402.html
评论列表(0条)