summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2019-01-28 20:45:08 -0600
committerOmar Roth <omarroth@hotmail.com>2019-01-28 20:45:08 -0600
commitb38a2bbd127fc787216e4722f2dc6a720abda415 (patch)
tree6e387708df34fa8da82c857fad87d4f6c437f729
parent097cbcdae391450a033d65d2262c1a698319712f (diff)
downloadinvidious-b38a2bbd127fc787216e4722f2dc6a720abda415.tar.gz
invidious-b38a2bbd127fc787216e4722f2dc6a720abda415.tar.bz2
invidious-b38a2bbd127fc787216e4722f2dc6a720abda415.zip
Reload player on error
-rw-r--r--src/invidious/views/components/player.ecr12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/invidious/views/components/player.ecr b/src/invidious/views/components/player.ecr
index f5e6f506..09d34368 100644
--- a/src/invidious/views/components/player.ecr
+++ b/src/invidious/views/components/player.ecr
@@ -114,6 +114,18 @@ var player = videojs("player", options, function() {
});
});
+player.on('error', function(event) {
+ console.log("An error occured in the player, reloading...");
+
+ var currentTime = player.currentTime();
+ player.load();
+ if (currentTime > 0.5) {
+ currentTime -= 0.5;
+ }
+ player.currentTime(currentTime);
+ player.play()
+});
+
player.share(shareOptions);
<% if params[:video_start] > 0 || params[:video_end] > 0 %>