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
26f5f9b204
commit
d30d107ef3
|
@ -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', () => {
|
useEventListener(this.#audio, 'loadeddata', () => {
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/readyState
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/readyState
|
||||||
this.isLoaded.value = this.#audio.readyState >= 2
|
this.isLoaded.value = this.#audio.readyState >= 2
|
||||||
|
@ -90,7 +102,7 @@ export class HTMLSound implements Sound {
|
||||||
}
|
}
|
||||||
|
|
||||||
preload () {
|
preload () {
|
||||||
console.log('CALLING PRELOAD ON', this)
|
console.log('CALLING PRELOAD ON', this.__track?.title)
|
||||||
this.#audio.load()
|
this.#audio.load()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +131,7 @@ export class HTMLSound implements Sound {
|
||||||
}
|
}
|
||||||
|
|
||||||
get playable () {
|
get playable () {
|
||||||
return this.#audio.src !== ''
|
return this.#audio.src !== '' || this.isErrored.value
|
||||||
}
|
}
|
||||||
|
|
||||||
get duration () {
|
get duration () {
|
||||||
|
|
|
@ -147,7 +147,7 @@ export const useTracks = createGlobalState(() => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('CONNECTING NODE')
|
console.log('CONNECTING NODE', sound)
|
||||||
|
|
||||||
sound.audioNode.disconnect()
|
sound.audioNode.disconnect()
|
||||||
connectAudioSource(sound.audioNode)
|
connectAudioSource(sound.audioNode)
|
||||||
|
|
Loading…
Reference in New Issue