From 22f25c740bf3eb24d9988ab6add8e1a6aec1b0bd Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 2 Dec 2021 13:45:32 +0100 Subject: [PATCH] Recover HLS video with duration inconsistency With audio longer than video --- client/src/assets/player/p2p-media-loader/hls-plugin.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/assets/player/p2p-media-loader/hls-plugin.ts b/client/src/assets/player/p2p-media-loader/hls-plugin.ts index 71c31696a..2aa691f05 100644 --- a/client/src/assets/player/p2p-media-loader/hls-plugin.ts +++ b/client/src/assets/player/p2p-media-loader/hls-plugin.ts @@ -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 })