fix: audio playback pause if errored before played
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2346>
This commit is contained in:
parent
05416be7d1
commit
ed8b71257d
|
@ -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 () {
|
||||
|
|
|
@ -147,7 +147,7 @@ export const useTracks = createGlobalState(() => {
|
|||
return
|
||||
}
|
||||
|
||||
console.log('CONNECTING NODE')
|
||||
console.log('CONNECTING NODE', sound)
|
||||
|
||||
sound.audioNode.disconnect()
|
||||
connectAudioSource(sound.audioNode)
|
||||
|
|
Loading…
Reference in New Issue