0

我在我的页面上设置了一个视频播放器,我已经做到了,当你点击一个按钮时,它会跳到某个部分。这很好用,但是当它到达某个部分时,我希望视频停止或暂停。

我不知道从哪里开始,但我会将现有代码放入:

var myvideo = document.getElementById('myvideo'),
                    playbutton = document.getElementById('playme'),
                    jumplink1 = document.getElementById('jump');
                    jumplink2 = document.getElementById('jump1');
                    jumplink3 = document.getElementById('jump2');
                    jumplink4 = document.getElementById('jump3');

                jumplink1.addEventListener("click", function (event) {
                    event.preventDefault();
                    myvideo.play();
                    myvideo.pause();
                    myvideo.currentTime = 40.1;
                    myvideo.play();
                }, false);

                 jumplink2.addEventListener("click", function (event) {
                    event.preventDefault();
                    myvideo.play();
                    myvideo.pause();
                    myvideo.currentTime = 85;
                    myvideo.play();
                }, false);

<video id="myvideo" width="620">
                  <source src="video/1.William Morrison_short-comp.mp4" type="video/mp4"></source>
                    Your browser does not support HTML5 video.
                </video>

                  <p id="play-me-hover">
                      <button id="playme" id="playme">play full interview</button>
                  </p>
                  <p id="jump-hover">
                      <button class="video-button" id="jump">courses</button>
                  </p>

                  <p>
                      <button class="video-button" id="jump1">surgeons</button>
4

0 回答 0