Play/Stop sound after interrupt

This commit is contained in:
J Francisco Rader committed 2021-03-02 09:31:25 -05:00
1 parent c37f6a66b4
commit e037a9b0f8
1 file changed
+2
+2
View File
@@ -68,10 +68,12 @@ const useSound = (url: string, options: ISoundOptions = DEFAULT_OPTIONS) => {
useEffect(() => { useEffect(() => {
if (interrupt) { if (interrupt) {
stop(url); stop(url);
setPlaying(false);
return; return;
} }
if (!playing(url) && previousInterrupt) { if (!playing(url) && previousInterrupt) {
play(); play();
setPlaying(true);
} }
}, [interrupt, play, playing, previousInterrupt, stop, url]); }, [interrupt, play, playing, previousInterrupt, stop, url]);