单击按钮时仅播放视频的某个部分

时间:2013-03-19 21:46:36

标签: jquery html video

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

我不知道从哪里开始,但我会把我现有的代码放在:

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>

0 个答案:

没有答案