From 647044a2b8129ac365f796b43ed836f9727e0131 Mon Sep 17 00:00:00 2001 From: wryk Date: Fri, 21 Feb 2020 23:32:04 +0100 Subject: [PATCH] remove muted --- src/components/Radio.svelte | 2 -- src/components/Viewer.svelte | 2 -- src/components/YoutubePlayer.svelte | 18 ++++-------------- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/components/Radio.svelte b/src/components/Radio.svelte index 04bacf3..63fe54e 100644 --- a/src/components/Radio.svelte +++ b/src/components/Radio.svelte @@ -40,7 +40,6 @@ ]) const paused = writable(true) - const muted = writableLocalStorage('muted', false) const volume = writableLocalStorage('volume', 100) const current = writable(null) @@ -116,7 +115,6 @@ } setContext('paused', paused) - setContext('muted', muted) setContext('volume', volume) setContext('domain', domain) setContext('hashtags', hashtags) diff --git a/src/components/Viewer.svelte b/src/components/Viewer.svelte index c5eaec2..a26f375 100644 --- a/src/components/Viewer.svelte +++ b/src/components/Viewer.svelte @@ -5,7 +5,6 @@ id={$current ? $current.media.credentials.id : null} class="playerBig__iframe" paused={$paused} - muted={$muted} volume={$volume} bind:ready bind:ended @@ -51,7 +50,6 @@ import Progress from '/components/player/Progress' const paused = getContext('paused') - const muted = getContext('muted') const volume = getContext('volume') const current = getContext('current') const loading = getContext('loading') diff --git a/src/components/YoutubePlayer.svelte b/src/components/YoutubePlayer.svelte index e68ebad..0a2e8be 100644 --- a/src/components/YoutubePlayer.svelte +++ b/src/components/YoutubePlayer.svelte @@ -19,12 +19,10 @@ // input props export let id export let paused - export let muted export let volume $: load(id) $: setPaused(paused) - $: setMuted(muted) $: setVolume(volume) const { enqueue, run } = queue() @@ -55,18 +53,6 @@ } }) - const setMuted = muted => enqueue(player => { - if (muted) { - if (!player.isMuted()) { - player.mute() - } - } else { - if (player.isMuted()) { - player.unMute() - } - } - }) - const setVolume = volume => enqueue(player => { player.setVolume(volume) }) @@ -80,6 +66,10 @@ element.id = Math.random().toString(16).slice(2, 8) const onReady = ({ target: player }) => { + if (player.isMuted()) { + player.unMute() + } + run(player) }