小编dev*_*dev的帖子

如何在时间间隔后显示视频js中的弹出窗口

如何在videojs中显示30,60,90,120 .... etc秒后弹出.我需要使用像设置时间间隔一样的事件监听器来检查使用实际上是否正在看视频.

$(document).ready(function() {

  //Create the instance of the video
  var myPlayer = videojs('my-video');
  // get the current time of the video
  // get

  myPlayer.on('play', function() {

    alert("You click on play event");
  });


  myPlayer.on('pause', function() {
    alert("You click on pause event");
  });

  myPlayer.on('timeupdate', function() {
    var getcurrentTime = this.currentTime();
    console.log(this.currentTime());
  });


});
Run Code Online (Sandbox Code Playgroud)
<head>
  <script src="https://code.jquery.com/jquery-3.1.1.js"></script>

  <!-- If you'd like to support IE8 -->
  <script src="http://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script>
</head>

<body>
  <video id="my-video" class="video-js" controls preload="auto" width="640" height="264" data-setup="{}">
    <source src="https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.mp4" type='video/mp4'>
    <p …
Run Code Online (Sandbox Code Playgroud)

javascript jquery video.js

0
推荐指数
1
解决办法
1639
查看次数

标签 统计

javascript ×1

jquery ×1

video.js ×1