diff --git a/src/components/Viewer.svelte b/src/components/Viewer.svelte index a0bd142..079c92c 100644 --- a/src/components/Viewer.svelte +++ b/src/components/Viewer.svelte @@ -7,6 +7,7 @@ volume={$volume} bind:ready bind:ended + bind:error bind:currentTime bind:duration bind:seek={seek} @@ -40,6 +41,7 @@ let ready = null let ended = null + let error = null let currentTime = null let duration = null let seek = null @@ -47,7 +49,7 @@ $: currentTimeText = currentTime !== null ? secondsToElapsedTime(currentTime) : null $: durationText = duration !== null ? secondsToElapsedTime(duration) : null - $: if (ended) { + $: if (ended || error) { selectNext() } diff --git a/src/components/YoutubePlayer.svelte b/src/components/YoutubePlayer.svelte index cb194a9..994e267 100644 --- a/src/components/YoutubePlayer.svelte +++ b/src/components/YoutubePlayer.svelte @@ -11,6 +11,7 @@ // output props export let ready = false export let ended = false + export let error = false export let duration = null export let currentTime = null @@ -30,6 +31,7 @@ export const load = (id) => enqueue((player) => { ready = false ended = false + error = false currentTime = null duration = null @@ -106,7 +108,7 @@ } const onError = () => { - console.log('error', event) + error = true } player = new api.Player(element.id, {