From f8f3dee0c85266e233b45d92d54cc09ec8b291b8 Mon Sep 17 00:00:00 2001 From: dlaxcess Date: Tue, 25 Apr 2023 19:34:39 +0200 Subject: [PATCH 1/3] audio --- gulp/scss/front.scss | 4 ++ svelte/components/Main/Dapp.svelte | 3 + svelte/components/Main/OpenSky.svelte | 3 + svelte/components/Media/Media.svelte | 2 +- svelte/components/Media/MediaAudio.svelte | 74 ++++++++++----------- svelte/components/Media/MediaPreview.svelte | 26 +++++++- svelte/components/Media/MediaVideo.svelte | 44 ++++++------ svelte/components/Nft/NftMintPopup.svelte | 2 +- svelte/components/Nfts/NftsGrid.svelte | 2 +- 9 files changed, 93 insertions(+), 67 deletions(-) diff --git a/gulp/scss/front.scss b/gulp/scss/front.scss index 60e5d7444..309818408 100644 --- a/gulp/scss/front.scss +++ b/gulp/scss/front.scss @@ -248,6 +248,10 @@ position: relative; } + .kre-media-line { + display: inline-block; + } + .detail { position: absolute; left: 0; diff --git a/svelte/components/Main/Dapp.svelte b/svelte/components/Main/Dapp.svelte index 53ac29765..722d192ad 100644 --- a/svelte/components/Main/Dapp.svelte +++ b/svelte/components/Main/Dapp.svelte @@ -41,6 +41,9 @@ let refreshAll: Writable = writable(1); setContext("refreshAll", refreshAll); + let toPlayTokenID: Writable = writable(""); + setContext("toPlayTokenID", toPlayTokenID); + $: refresh = refreshingCollections || refreshingNfts; // SET chainId on memataskChainId change diff --git a/svelte/components/Main/OpenSky.svelte b/svelte/components/Main/OpenSky.svelte index 6ab5ebba0..813425a59 100644 --- a/svelte/components/Main/OpenSky.svelte +++ b/svelte/components/Main/OpenSky.svelte @@ -26,6 +26,9 @@ let refreshAll: Writable = writable(1); setContext("refreshAll", refreshAll); + let toPlayTokenID: Writable = writable(""); + setContext("toPlayTokenID", toPlayTokenID); + const setNetwork = async () => { if (chainId != $metamaskChainId) { await metamaskSwitchChain(chainId); diff --git a/svelte/components/Media/Media.svelte b/svelte/components/Media/Media.svelte index c73918690..ade214ca2 100644 --- a/svelte/components/Media/Media.svelte +++ b/svelte/components/Media/Media.svelte @@ -21,7 +21,7 @@ let gridScale = mode.startsWith("grid") ? " a-simul-cursor" : ""; -
+
{#if nftMediaAnimationUrl($nft)} + // // Display a player audio with its cover image according to its entering parameters ///////////////////////////////////////////////// export let src: string; @@ -12,48 +12,47 @@ export let animation_url: string; export let mode: string = "line"; export let alt: string = "Cover image"; - export let small: boolean = true; export let paused: boolean = true; let toPlayTokenID: Writable = getContext("toPlayTokenID"); - $: paused = $toPlayTokenID !== tokenID; - const playAudio = () => { - if (mode === "zoom") { + + const togglePlayAudio = () => { + paused = !paused; + if (toPlayTokenID) { $toPlayTokenID = $toPlayTokenID !== tokenID ? tokenID : ""; } }; + + $: if (toPlayTokenID && $toPlayTokenID !== tokenID) paused = true; + $: mode && resetToPlayTokenID(); + const resetToPlayTokenID = () => { + if (toPlayTokenID) $toPlayTokenID = ""; + }; -
+
-{#if small} - {#if mode === "line"} - - - {:else} - - - - {/if} + +{#if mode == "zoom"} + {:else} -