var obj={
tag:false,ctime:0}
;
window.obj=obj;
var myPlayer=videojs.getPlayers()['my_video_1'];
myPlayer.on("timeupdate", function(){
if(window.obj.tag){
videojs("my_video_1").currentTime(window.obj.ctime) videojs("my_video_1").play();
window.obj.tag=false;
}
//视频打点 var ctime_=videojs("my_video_1").currentTime().currentTime();
if(ctime_==60){
videojs("my_video_1").currentTime(ctime_+1);
//do something }
}
);
}
function changeVideo(type){
var ctime=videojs("my_video_1").currentTime();
if(type==1){
videojs("my_video_1").src([{
type: "application/x-mpegURL", src: "http://localhost/video/LD/1928.m3u8" }
]);
videojs("my_video_1").play();
}
if(type==2){
videojs("my_video_1").src([{
type: "application/x-mpegURL", src: "http://localhost/video/C/1928.m3u8" }
]);
videojs("my_video_1").play();
}
if(type==3){
videojs("my_video_1").src([{
type: "application/x-mpegURL", src: "http://localhost/video/HD/1928.m3u8" }
]);
videojs("my_video_1").play();
}
window.obj.ctime=ctime;
window.obj.tag=true;
}
</script> </html> |