一,Web視頻播放器插件
var player = videojs('videoID',{
controls: true, //控制條
preload: 'none', //是否自動加載
width: '640',
height: '264',
poster: 'media/poster.jpg',
sources: [
{src: 'media/001.mp4',type: 'video/mp4'}
]
},function(){
var that = this;
that.on('pause',function(){
old_time = this.currentTime();
console.log('pause:' + old_time);
})
that.on('play',function(){
new_time = this.currentTime();
console.log('playing:' + this.currentTime());
})
that.on('seeked',function(){
new_time = this.currentTime();
console.log('seeked:' + this.currentTime());
if (old_time) {
console.log(new_time > old_time ? '拖動快進' : '拖動后退');
}
})
that.on('ended',function(){
console.log('ended:'+ this.currentTime());
console.log('duration:' + this.duration());
})
})