我使用以下内容在x秒后暂停视频
var pausetime = 2; // stop at 2 seconds
var myPlayer = videojs('example_video_1');
myPlayer.on('timeupdate', function(e) {
if (myPlayer.currentTime() >= pausetime) {
myPlayer.pause();
}
});
暂停视频后,我必须显示弹出消息。它需要在5秒后关闭,并在暂停时间再次播放视频(即从停止的位置再次播放)。
如何实现这一目标。请帮我。感谢
答案 0 :(得分:0)
试
myPlayer.on('timeupdate', function(e) {
if (myPlayer.currentTime() >= pausetime) {
myPlayer.pause();
setTimeout(function(){
myPlayer.play()
},5000)
}
});
<强>更新强>
isPause = 0;
var pausetime = 2; // stop at 2 seconds
var myPlayer = videojs('example_video_1');
myPlayer.on('timeupdate', function(e) {
if( isPause == 0 && ( myPlayer.currentTime() >= pausetime ) ){
myPlayer.pause();
wait();
}
});
function wait(){
setTimeout(function(){
isPause = 1;
myPlayer.play();
},5000)
}