diff options
| author | Omar Roth <omarroth@hotmail.com> | 2019-01-29 19:55:27 -0600 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2019-01-29 19:55:27 -0600 |
| commit | 1e214aae7cedbb0770312e3eb2901216d27e6da7 (patch) | |
| tree | ef3d337e694b342bd88984ebd8828b2a4df4febd /src | |
| parent | ff09a7255ac03dfd7d828aaaf872b263c4c9cee4 (diff) | |
| download | invidious-1e214aae7cedbb0770312e3eb2901216d27e6da7.tar.gz invidious-1e214aae7cedbb0770312e3eb2901216d27e6da7.tar.bz2 invidious-1e214aae7cedbb0770312e3eb2901216d27e6da7.zip | |
Reload player instead of removing invalid source
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious/views/components/player.ecr | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/src/invidious/views/components/player.ecr b/src/invidious/views/components/player.ecr index 80879b67..b165985f 100644 --- a/src/invidious/views/components/player.ecr +++ b/src/invidious/views/components/player.ecr @@ -115,7 +115,7 @@ var player = videojs("player", options, function() { }); player.on('error', function(event) { - if (player.error().code === 2) { + if (player.error().code === 2 || player.error().code === 4) { console.log("An error occured in the player, reloading..."); var currentTime = player.currentTime(); @@ -126,25 +126,6 @@ player.on('error', function(event) { } player.currentTime(currentTime); player.playbackRate(playbackRate); - player.play() - } else if (player.error().code === 4) { - console.log("Detected invalid source, removing..."); - var currentTime = player.currentTime(); - var sources = player.options().sources; - - for (var i = 0; i < sources.length; i++) { - if (sources[i].src === player.currentSource().src) { - sources.splice(i, 1); - break - } - }; - - player.load(); - if (currentTime > 0.5) { - currentTime -= 0.5; - } - player.currentTime(currentTime); - player.src(sources); player.play(); } }); |
