From c945b03daed30f8d4c32e3ede94fb4e09d23fb32 Mon Sep 17 00:00:00 2001 From: gemstone Date: Fri, 21 Feb 2025 20:33:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20allowedStreamTrackChange?= =?UTF-8?q?=20cause=20playnext=20failure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/xgplayer-hls/src/hls/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/xgplayer-hls/src/hls/index.js b/packages/xgplayer-hls/src/hls/index.js index b147f1a1..b5483a7c 100644 --- a/packages/xgplayer-hls/src/hls/index.js +++ b/packages/xgplayer-hls/src/hls/index.js @@ -768,7 +768,7 @@ export class Hls extends EventEmitter { _onTimeupdate = () => { if (!this.media) return const cfg = this.config - if (cfg.isLive && cfg.maxLatency && cfg.targetLatency && this.media) { + if (cfg.isLive && cfg.maxLatency && cfg.targetLatency) { const liveEdge = this._playlist.liveEdge if (!liveEdge) return const latency = liveEdge - this.media.currentTime @@ -782,10 +782,9 @@ export class Hls extends EventEmitter { this._seiService?.throw(this.media.currentTime) } - if (this.config.allowedStreamTrackChange && !this.config.softDecode) { + if (cfg.allowedStreamTrackChange && !cfg.softDecode && this.media.readyState) { this._checkStreamTrackChange(this.media.currentTime) } - } _checkStreamTrackChange (time) {