]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Recover HLS video with duration inconsistency
authorChocobozzz <me@florianbigard.com>
Thu, 2 Dec 2021 12:45:32 +0000 (13:45 +0100)
committerChocobozzz <me@florianbigard.com>
Fri, 3 Dec 2021 09:14:17 +0000 (10:14 +0100)
With audio longer than video

client/src/assets/player/p2p-media-loader/hls-plugin.ts

index 71c31696a3e5f70b4f896dc9f3b23cc7d9583010..2aa691f05fa05361a4908d5e188908d25d921f4d 100644 (file)
@@ -146,7 +146,9 @@ class Html5Hlsjs {
   }
 
   duration () {
-    return this._duration || this.videoElement.duration || 0
+    if (!isNaN(this.videoElement.duration)) return this.videoElement.duration
+
+    return this._duration || 0
   }
 
   seekable () {
@@ -366,6 +368,7 @@ class Html5Hlsjs {
 
       this.isLive = data.details.live
       this.dvrDuration = data.details.totalduration
+
       this._duration = this.isLive ? Infinity : data.details.totalduration
     })