Bump videojs to 7.12.1 (#3011)

This commit is contained in:
Émilien Devos 2022-04-22 22:37:45 +02:00 committed by GitHub
parent cf755dec22
commit 2ea986326d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 63 additions and 34 deletions

View file

@ -49,6 +49,42 @@ videojs.Vhs.xhr.beforeRequest = function(options) {
var player = videojs('player', options);
player.on('error', () => {
if (video_data.params.quality !== 'dash') {
if (!player.currentSrc().includes("local=true") && !video_data.local_disabled) {
var currentSources = player.currentSources();
for (var i = 0; i < currentSources.length; i++) {
currentSources[i]["src"] += "&local=true"
}
player.src(currentSources)
}
else if (player.error().code === 2 || player.error().code === 4) {
setTimeout(function (event) {
console.log('An error occurred in the player, reloading...');
var currentTime = player.currentTime();
var playbackRate = player.playbackRate();
var paused = player.paused();
player.load();
if (currentTime > 0.5) currentTime -= 0.5;
player.currentTime(currentTime);
player.playbackRate(playbackRate);
if (!paused) player.play();
}, 10000);
}
}
});
if (video_data.params.quality == 'dash') {
player.reloadSourceOnError({
errorInterval: 10
});
}
/**
* Function for add time argument to url
* @param {String} url
@ -144,27 +180,6 @@ if (isMobile()) {
})
}
player.on('error', function (event) {
if (player.error().code === 2 || player.error().code === 4) {
setTimeout(function (event) {
console.log('An error occurred in the player, reloading...');
var currentTime = player.currentTime();
var playbackRate = player.playbackRate();
var paused = player.paused();
player.load();
if (currentTime > 0.5) currentTime -= 0.5;
player.currentTime(currentTime);
player.playbackRate(playbackRate);
if (!paused) player.play();
}, 5000);
}
});
// Enable VR video support
if (!video_data.params.listen && video_data.vr && video_data.params.vr_mode) {
player.crossOrigin("anonymous")