Add interval and timeout for errors in player
This commit is contained in:
parent
9e73e3b153
commit
def58ff11f
|
@ -116,6 +116,7 @@ var player = videojs("player", options, function() {
|
||||||
|
|
||||||
player.on('error', function(event) {
|
player.on('error', function(event) {
|
||||||
if (player.error().code === 2 || player.error().code === 4) {
|
if (player.error().code === 2 || player.error().code === 4) {
|
||||||
|
setInterval(setTimeout(function (event) {
|
||||||
console.log("An error occured in the player, reloading...");
|
console.log("An error occured in the player, reloading...");
|
||||||
|
|
||||||
var currentTime = player.currentTime();
|
var currentTime = player.currentTime();
|
||||||
|
@ -127,6 +128,7 @@ player.on('error', function(event) {
|
||||||
player.currentTime(currentTime);
|
player.currentTime(currentTime);
|
||||||
player.playbackRate(playbackRate);
|
player.playbackRate(playbackRate);
|
||||||
player.play();
|
player.play();
|
||||||
|
}, 5000), 5000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue