diff --git a/js/player.js b/js/player.js index 1f31739..f787274 100644 --- a/js/player.js +++ b/js/player.js @@ -109,19 +109,23 @@ export class Player { this._setupVideoSync(); } -_resetDashPlayer() { - if (this.dashInitialized && this.dashPlayer) { - try { this.dashPlayer.attachView(null); } catch (e) {} - try { this.dashPlayer.destroy(); } catch (e) {} - this.dashPlayer = MediaPlayer().create(); - this.dashPlayer.updateSettings({ - streaming: { - buffer: { fastSwitchEnabled: true }, - }, - }); - this.dashInitialized = false; + _resetDashPlayer() { + if (this.dashInitialized && this.dashPlayer) { + try { + this.dashPlayer.attachView(null); + } catch (e) {} + try { + this.dashPlayer.destroy(); + } catch (e) {} + this.dashPlayer = MediaPlayer().create(); + this.dashPlayer.updateSettings({ + streaming: { + buffer: { fastSwitchEnabled: true }, + }, + }); + this.dashInitialized = false; + } } -} _setupVideoSync() { if (!this.video || !this.audio) return; @@ -898,7 +902,10 @@ _resetDashPlayer() { 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'))) { + } else if ( + streamUrl && + (streamUrl.includes('.m3u8') || streamUrl.includes('application/vnd.apple.mpegurl')) + ) { this.setupHlsVideo(activeElement, streamUrl, null); this.applyAudioEffects(); @@ -1063,9 +1070,8 @@ _resetDashPlayer() { } const shuffledSeeds = [...this.radioSeeds].sort(() => 0.5 - Math.random()); - const seeds = shuffledSeeds.length > 0 - ? shuffledSeeds.slice(0, 5) - : this.currentTrack ? [this.currentTrack] : []; + const seeds = + shuffledSeeds.length > 0 ? shuffledSeeds.slice(0, 5) : this.currentTrack ? [this.currentTrack] : []; if (seeds.length === 0) { return; @@ -1084,7 +1090,7 @@ _resetDashPlayer() { ]); const recommendations = await this.api.getRecommendedTracksForPlaylist(seeds, 20, { - knownTrackIds: knownTrackIds + knownTrackIds: knownTrackIds, }); if (recommendations && recommendations.length > 0) {