fix: audio playback pause if errored before played

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2346>
environments/review-docs-fix-d-jlladr/deployments/17321
Kasper Seweryn 2023-01-30 14:57:46 +01:00 zatwierdzone przez Georg krause
rodzic 26f5f9b204
commit d30d107ef3
2 zmienionych plików z 15 dodań i 3 usunięć

Wyświetl plik

@ -78,6 +78,18 @@ export class HTMLSound implements Sound {
}
})
useEventListener(this.#audio, 'waiting', () => {
console.log('>> AUDIO WAITING', this.__track?.title)
})
useEventListener(this.#audio, 'playing', () => {
console.log('>> AUDIO PLAYING', this.__track?.title)
})
useEventListener(this.#audio, 'stalled', () => {
console.log('>> AUDIO STALLED', this.__track?.title)
})
useEventListener(this.#audio, 'loadeddata', () => {
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/readyState
this.isLoaded.value = this.#audio.readyState >= 2
@ -90,7 +102,7 @@ export class HTMLSound implements Sound {
}
preload () {
console.log('CALLING PRELOAD ON', this)
console.log('CALLING PRELOAD ON', this.__track?.title)
this.#audio.load()
}
@ -119,7 +131,7 @@ export class HTMLSound implements Sound {
}
get playable () {
return this.#audio.src !== ''
return this.#audio.src !== '' || this.isErrored.value
}
get duration () {

Wyświetl plik

@ -147,7 +147,7 @@ export const useTracks = createGlobalState(() => {
return
}
console.log('CONNECTING NODE')
console.log('CONNECTING NODE', sound)
sound.audioNode.disconnect()
connectAudioSource(sound.audioNode)