From fcf6964d7dc3d911c51ae3d492f8752b3d3726c7 Mon Sep 17 00:00:00 2001 From: fidoriel <49869342+fidoriel@users.noreply.github.com> Date: Sun, 19 Mar 2023 21:41:49 +0000 Subject: [PATCH] hlsurl --- client/players/LocalAudioPlayer.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client/players/LocalAudioPlayer.js b/client/players/LocalAudioPlayer.js index 87b3c1d7..77dbb474 100644 --- a/client/players/LocalAudioPlayer.js +++ b/client/players/LocalAudioPlayer.js @@ -28,6 +28,11 @@ export default class LocalAudioPlayer extends EventEmitter { return this.audioTracks[this.currentTrackIndex] || {} } + get hslContentUrl() { + // the hls stream playlist is the same for all tracks + return this.audioTracks[0].relativeContentUrl + } + initialize() { if (document.getElementById('audio-player')) { document.getElementById('audio-player').remove() @@ -132,7 +137,7 @@ export default class LocalAudioPlayer extends EventEmitter { if (!Hls.isSupported()) { console.warn('HLS is not supported - fallback to using audio element') this.usingNativeplayer = true - this.player.src = this.currentTrack.relativeContentUrl + this.player.src = this.hslContentUrl this.player.currentTime = this.startTime return } @@ -148,7 +153,7 @@ export default class LocalAudioPlayer extends EventEmitter { this.hlsInstance.attachMedia(this.player) this.hlsInstance.on(Hls.Events.MEDIA_ATTACHED, () => { - this.hlsInstance.loadSource(this.currentTrack.relativeContentUrl) + this.hlsInstance.loadSource(this.hslContentUrl) this.hlsInstance.on(Hls.Events.MANIFEST_PARSED, () => { console.log('[HLS] Manifest Parsed')