From e1941e4ee0e4688d1700a1fdfb53c46fc92cfbe2 Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Fri, 6 Oct 2023 08:47:57 +0900 Subject: [PATCH] =?UTF-8?q?=E3=81=93=E3=82=8C=E3=81=A7=E8=A7=A3=E6=B1=BA?= =?UTF-8?q?=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/playButton.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/playButton.tsx b/src/components/playButton.tsx index 55e94381a..6d67aa296 100644 --- a/src/components/playButton.tsx +++ b/src/components/playButton.tsx @@ -36,7 +36,6 @@ export default ({ useEffect(() => { if (!audio) return - audio.load() const onPlayCallback = () => { setIsPlaying(true) @@ -50,6 +49,9 @@ export default ({ audio.addEventListener("play", onPlayCallback) audio.addEventListener("pause", onPauseCallback) audio.addEventListener("canplaythrough", onReady) + + audio.load() + return () => { audio.removeEventListener("play", onPlayCallback) audio.removeEventListener("pause", onPauseCallback)