clean loadTrack
This commit is contained in:
parent
65341717cd
commit
063f14a7b4
@ -207,7 +207,16 @@ class SimpleAudioPlayer {
|
|||||||
const requestId = reqId || (crypto.randomUUID ? crypto.randomUUID() : (Date.now().toString(36) + Math.random().toString(36).slice(2)));
|
const requestId = reqId || (crypto.randomUUID ? crypto.randomUUID() : (Date.now().toString(36) + Math.random().toString(36).slice(2)));
|
||||||
const urlWithReq = `/media/${relUrl}${relUrl.includes('?') ? '&' : '?'}req=${encodeURIComponent(requestId)}`;
|
const urlWithReq = `/media/${relUrl}${relUrl.includes('?') ? '&' : '?'}req=${encodeURIComponent(requestId)}`;
|
||||||
|
|
||||||
|
// Reset any residual state from the previous track before we fetch the new one
|
||||||
this.audio.pause();
|
this.audio.pause();
|
||||||
|
this.audio.currentTime = 0;
|
||||||
|
this.timeline.value = 0;
|
||||||
|
this.timeline.style.backgroundSize = '0% 100%';
|
||||||
|
this.timeInfo.textContent = '00:00 / --:--';
|
||||||
|
if ('mediaSession' in navigator) {
|
||||||
|
navigator.mediaSession.playbackState = 'paused';
|
||||||
|
}
|
||||||
|
|
||||||
this.container.style.display = 'block';
|
this.container.style.display = 'block';
|
||||||
this.nowInfo.textContent = 'Loading…';
|
this.nowInfo.textContent = 'Loading…';
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user