Last active
May 28, 2020 19:54
-
-
Save emanueleDiVizio/72aedddbd94712a689cd10792b16144f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const useAudioPlayer = (fileName) => { | |
const playerRef = useRef(null); | |
useEffect(() => { | |
playerRef.current = loadPlayer(fileName); | |
return () => { | |
playerRef.current.destroy(); | |
}; | |
}, []); | |
return playerRef; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment