Skip to content

Commit

Permalink
これで解決?
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba committed Oct 5, 2023
1 parent f3025fe commit e1941e4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/playButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export default ({

useEffect(() => {
if (!audio) return
audio.load()

const onPlayCallback = () => {
setIsPlaying(true)
Expand All @@ -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)
Expand Down

0 comments on commit e1941e4

Please sign in to comment.