From ebaec1ad662c2050726d0d43ba60db63a3f10d26 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 18 Oct 2021 15:16:23 +0200 Subject: tieing shoelaces --- src/views/Intro.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/views/Intro.js') diff --git a/src/views/Intro.js b/src/views/Intro.js index 3a20cde..72a53a4 100644 --- a/src/views/Intro.js +++ b/src/views/Intro.js @@ -25,11 +25,24 @@ export default function Intro({ onComplete }) { } catch (error) { console.error(error); } - footprint("egress"); setDone(true); setTimeout(() => { onComplete(); }, 200); + footprint("escape"); + }, []); + + const handleEnd = useCallback(() => { + try { + audio.play(); + } catch (error) { + console.error(error); + } + setDone(true); + setTimeout(() => { + onComplete(); + }, 200); + footprint("egress"); }, []); const handleStart = useCallback(() => { @@ -40,10 +53,10 @@ export default function Intro({ onComplete }) { console.error(error); } setStarted(true); - footprint("ingress"); if (player) { player.play(); } + footprint("ingress"); }, [player]); const handleReady = useCallback((player) => { @@ -66,7 +79,7 @@ export default function Intro({ onComplete }) { muted={false} volume={1} onReady={handleReady} - onEnd={handleClose} + onEnd={handleEnd} />