我有一个带视频播放器HTML5的网络视频播放器,它不可寻找,有没有办法启用此功能,我的javascript:
<script type="text/javascript" src="jquery-2.1.3.min.js"></script>
<script type="text/javascript">
var video;
var playlist;
var tracks;
var current;
$(document).ready(function() {
init();
});
function init(){
current = 0;
video = $("video");
playlist = $("#playlist");
tracks = playlist.find("li a");
len = tracks.length - 1;
video[0].volume = .50;
video[0].play();
playlist.find("a").click(function(e){
e.preventDefault();
link = $(this);
current = link.parent().index();
run(link, video[0]);
});
video[0].addEventListener("ended",function(e){
current++;
if(current == len){
current = 0;
link = playlist.find("a")[0];
}else{
link = playlist.find("a")[current];
}
run($(link),video[0]);
});
}
function run(link, player){
player.src = link.attr("href");
par = link.parent();
par.addClass("active").siblings().removeClass("active");
video[0].load();
video[0].play();
}
</script>
我尝试过添加:
var video = document.getElementById('video');
video.currentTime = 18;
在视频标记之后但它不起作用,我是否实现了错误?