mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2023-06-08.git
synced 2024-08-15 00:53:38 +00:00
Add interval and timeout for errors in player
This commit is contained in:
parent
9e73e3b153
commit
def58ff11f
1 changed files with 12 additions and 10 deletions
|
@ -116,17 +116,19 @@ var player = videojs("player", options, function() {
|
|||
|
||||
player.on('error', function(event) {
|
||||
if (player.error().code === 2 || player.error().code === 4) {
|
||||
console.log("An error occured in the player, reloading...");
|
||||
setInterval(setTimeout(function (event) {
|
||||
console.log("An error occured in the player, reloading...");
|
||||
|
||||
var currentTime = player.currentTime();
|
||||
var playbackRate = player.playbackRate();
|
||||
player.load();
|
||||
if (currentTime > 0.5) {
|
||||
currentTime -= 0.5;
|
||||
}
|
||||
player.currentTime(currentTime);
|
||||
player.playbackRate(playbackRate);
|
||||
player.play();
|
||||
var currentTime = player.currentTime();
|
||||
var playbackRate = player.playbackRate();
|
||||
player.load();
|
||||
if (currentTime > 0.5) {
|
||||
currentTime -= 0.5;
|
||||
}
|
||||
player.currentTime(currentTime);
|
||||
player.playbackRate(playbackRate);
|
||||
player.play();
|
||||
}, 5000), 5000);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue