auto swi qua

master
iotcat 4 years ago
parent 2c8595da25
commit 03ec17f3d2
  1. 6
      index.html

@ -140,14 +140,14 @@
} }
var autoSwitchQuality = function(){ var autoSwitchQuality = function(){
if(isWaiting && options.video.quality.length > 1){ if(isWaiting && options.video.quality.length > 1){
waitEvent(); waitEvent(15000);
dp.notice("监测到卡顿,切换片源"); dp.notice("监测到卡顿,切换片源");
options.video.defaultQuality = (options.video.defaultQuality >= options.video.quality.length - 1) ? 0 : options.video.defaultQuality+1; options.video.defaultQuality = (options.video.defaultQuality >= options.video.quality.length - 1) ? 0 : options.video.defaultQuality+1;
console.log('Switch quality to ' + options.video.defaultQuality); console.log('Switch quality to ' + options.video.defaultQuality);
dp.switchQuality(options.video.defaultQuality); dp.switchQuality(options.video.defaultQuality);
} }
} }
var waitEvent = function(){ var waitEvent = function(t = 6000){
isWaiting = true; isWaiting = true;
setTimeout(function(){ setTimeout(function(){
if(dp.video.currentTime > options.video.playFrom + 10){ if(dp.video.currentTime > options.video.playFrom + 10){
@ -155,7 +155,7 @@
}else{ }else{
setTimeout(autoSwitchQuality, 9000); setTimeout(autoSwitchQuality, 9000);
} }
}, 6000); }, t);
}; };
</script> </script>
</body> </body>

Loading…
Cancel
Save