From f746622be455309112d858105992b2fa0b01af90 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 31 Oct 2022 10:33:37 +0100 Subject: Prevent console error with HLS fallback --- client/src/assets/player/peertube-player-manager.ts | 2 +- client/src/assets/player/shared/upnext/upnext-plugin.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'client/src/assets') diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts index 5db7a2e55..9663d90a2 100644 --- a/client/src/assets/player/peertube-player-manager.ts +++ b/client/src/assets/player/peertube-player-manager.ts @@ -167,7 +167,7 @@ export class PeertubePlayerManager { } private static async tryToRecoverHLSError (err: any, currentPlayer: videojs.Player, options: PeertubePlayerManagerOptions) { - if (err.code === 3) { // Decode error + if (err.code === MediaError.MEDIA_ERR_DECODE) { // Display a notification to user if (this.videojsDecodeErrors === 0) { diff --git a/client/src/assets/player/shared/upnext/upnext-plugin.ts b/client/src/assets/player/shared/upnext/upnext-plugin.ts index db969024d..e12e8c503 100644 --- a/client/src/assets/player/shared/upnext/upnext-plugin.ts +++ b/client/src/assets/player/shared/upnext/upnext-plugin.ts @@ -19,6 +19,9 @@ class UpNextPlugin extends Plugin { super(player) + // UpNext plugin can be called later, so ensure the player is not disposed + if (this.player.isDisposed()) return + this.player.ready(() => { player.addClass('vjs-upnext') }) -- cgit v1.2.3