From 17964a8bc95f7a2e28b354c34b26891f8d5a9013 Mon Sep 17 00:00:00 2001 From: Samidy Date: Wed, 11 Mar 2026 09:13:28 +0300 Subject: [PATCH] fix media playback errors in firefox --- index.html | 2 +- js/player.js | 65 +++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 53 insertions(+), 14 deletions(-) diff --git a/index.html b/index.html index 5a253c3..2b72aec 100644 --- a/index.html +++ b/index.html @@ -2222,7 +2222,7 @@ 0) { - this.dashPlayer.seek(startTime); + if (startTime > 0) { + this.dashPlayer.seek(startTime); + } + + const canPlay = await this.waitForCanPlayOrTimeout(activeElement); + if (!canPlay || this.playbackSequence !== currentSequence) return; + await this.safePlay(activeElement); + } catch (e) { + console.error('DashPlayer initialize failed for audio:', e); + throw new Error('DASH initialization failed'); } + } else if (streamUrl && (streamUrl.includes('.m3u8') || streamUrl.includes('application/vnd.apple.mpegurl'))) { + this.setupHlsVideo(activeElement, streamUrl, null); + this.applyAudioEffects(); const canPlay = await this.waitForCanPlayOrTimeout(activeElement); if (!canPlay || this.playbackSequence !== currentSequence) return; + + if (startTime > 0) { + activeElement.currentTime = startTime; + } await this.safePlay(activeElement); - } else { + } else if (streamUrl) { activeElement.src = streamUrl; this.applyAudioEffects(); @@ -885,6 +922,8 @@ export class Player { } const played = await this.safePlay(activeElement); if (!played) return; + } else { + throw new Error('Could not resolve stream URL'); } }