我的页面上有一个视频播放器,可以根据按下的链接播放视频。
我正在尝试创建它,以便它也能够基于另一个按钮跳到视频的某个部分。
到目前为止,我让他们都在不同的页面上工作。这是我到目前为止所拥有的:
<div id="video-player">
<img src="images/videoplayer/screen680.png" id="video-screen"/>
<video id="videoarea" poster="" src=""></video>
<ul id="playlist">
<li movieurl="video/1.Adele Gillies_short_compressed.mp4" id="myvideo">
<button class="video-button left-menu" id="education-jump">vid1 education</button>
<button class="video-button left-menu" id="education-jump2">vid2 eductaion</button>
</li>
<li movieurl="video/1.William Morrison_short-comp.mp4" id="myvideo2">
<button class="video-button left-menu" id="relationship-jump">vid1 relationships</button>
<button class="video-button left-menu" id="relationship-jump2">vid2 relationships</button>
</li>
</ul>
</div>
<script>
var myvideo = document.getElementById("myvideo"),
playbutton = document.getElementById('playme'),
jumplink1 = document.getElementById('education-jump');
jumplink2 = document.getElementById('education-jump2');
jumplink1.addEventListener("click", function (event) {
event.preventDefault();
myvideo.play();
myvideo.pause();
myvideo.currentTime = 200;
myvideo.play();
}, false);
jumplink2.addEventListener("click", function (event) {
event.preventDefault();
myvideo.play();
myvideo.pause();
myvideo.currentTime = 170.1;
myvideo.play();
}, false);
</script>
<script type="text/javascript">
$(function() {
$("#playlist li").on("click", function() {
$("#videoarea").attr({
"src": $(this).attr("movieurl"),
"poster": "",
"autoplay": "autoplay"
})
})
$("#videoarea").attr({
"src": $("#playlist li").eq(0).attr("movieurl"),
"poster": $("#playlist li").eq(0).attr("moviesposter")
})
})
</script>