var myMiddleware = function(player) {
console.log(player.currentTime())
return {
setCurrentTime: function(time) {
if (time > _that.watchMaxTime) { //快进,_that.watchMaxTime:用户看到的最大值
return player.currentTime()
} else { //后退
console.log('返回time====')
return time;
}
}
};
};
_that.$video.use('*', myMiddleware)
这是使用的video.js里面的中间件来实现的。不了解的可以了解一下。地址:https://docs.videojs.com/tutorial-middleware.html