diff --git a/front/src/api/player.ts b/front/src/api/player.ts index 8b957fba9..89e311e28 100644 --- a/front/src/api/player.ts +++ b/front/src/api/player.ts @@ -16,14 +16,15 @@ export interface Sound { dispose(): void readonly audioNode: IAudioNode + readonly isErrored: Ref readonly isLoaded: Ref readonly currentTime: number readonly duration: number readonly buffered: number looping: boolean - play(): void | Promise pause(): void | Promise + play(): void | Promise seekTo(seconds: number): void | Promise seekBy(seconds: number): void | Promise @@ -46,6 +47,7 @@ export class HTMLSound implements Sound { #soundLoopEventHook = createEventHook() #soundEndEventHook = createEventHook() + readonly isErrored = ref(false) readonly isLoaded = ref(false) audioNode = createAudioSource(this.#audio) @@ -69,6 +71,11 @@ export class HTMLSound implements Sound { this.isLoaded.value = this.#audio.readyState >= 2 }) + useEventListener(this.#audio, 'error', () => { + this.isErrored.value = true + this.isLoaded.value = true + }) + this.onSoundLoop = this.#soundLoopEventHook.on this.onSoundEnd = this.#soundEndEventHook.on } diff --git a/front/src/components/Queue.vue b/front/src/components/Queue.vue index 204ffd918..680034e8a 100644 --- a/front/src/components/Queue.vue +++ b/front/src/components/Queue.vue @@ -1,21 +1,43 @@