admin管理员组文章数量:1404626
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./
本文标签: javascriptmediaelementjspauseplay onclick for videoStack Overflow
版权声明:本文标题:javascript - mediaelement.js - pauseplay onclick for video? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744838381a2627770.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论