fix: 🐛 allowedStreamTrackChange cause playnext failure

This commit is contained in:
gemstone 2025-02-21 20:33:47 +08:00
parent d3397fef24
commit c945b03dae

View File

@ -768,7 +768,7 @@ export class Hls extends EventEmitter {
_onTimeupdate = () => { _onTimeupdate = () => {
if (!this.media) return if (!this.media) return
const cfg = this.config 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 const liveEdge = this._playlist.liveEdge
if (!liveEdge) return if (!liveEdge) return
const latency = liveEdge - this.media.currentTime const latency = liveEdge - this.media.currentTime
@ -782,10 +782,9 @@ export class Hls extends EventEmitter {
this._seiService?.throw(this.media.currentTime) 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) this._checkStreamTrackChange(this.media.currentTime)
} }
} }
_checkStreamTrackChange (time) { _checkStreamTrackChange (time) {