只有在你努力取得进展的情况下,这一解决办法才会奏效。 如果你想去找回,你必须核实录像是否真的。 时间序列为负数:
var lastUnixTimeStamp;
var lastCurrentVideoTime;
videoplayer.addEvent( timeupdate ,function(){
if( !lastUnixTimeStamp && !lastCurrentVideoTime ){ //not defined at first timeupdate event
lastUnixTimeStamp = new Date().getTime();
lastCurrentVideoTime = videoplayer.currentTime;
return;
}
var videoTimeOffset = videoplayer.currentTime - lastCurrentVideoTime; //how many milliseconds was video running
var realTimeOffset = new Date().getTime() - lastUnixTimeStamp; //how many milliseconds were real time running
//guess the numbers are not accurate, so if the difference between both is f.e. < 100ms, video runs normally
if( (videoTimeOffset - realTimeOffset) > 100 || (videoTimeOffset < 0 )){
//do your seeking magic
}
lastUnixTimeStamp = new Date().getTime();
lastCurrentVideoTime = videoplayer.currentTime;
})