]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Prevent console error with HLS fallback
authorChocobozzz <me@florianbigard.com>
Mon, 31 Oct 2022 09:33:37 +0000 (10:33 +0100)
committerChocobozzz <me@florianbigard.com>
Mon, 31 Oct 2022 09:33:37 +0000 (10:33 +0100)
client/src/assets/player/peertube-player-manager.ts
client/src/assets/player/shared/upnext/upnext-plugin.ts

index 5db7a2e5562d3a8d4327063d6858b56893bc7999..9663d90a2be807db24b35a48320f6a7c86ec3481 100644 (file)
@@ -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) {
index db969024deb7bbdb324c87d9cf2b0305d37f2fc9..e12e8c5033ebe7370da1110cca733298550f99ca 100644 (file)
@@ -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')
     })