Estoy usando esta función para reproducir archivos de sonido. Quiero que el sonido se detenga cuando hago clic en el botón.
function playSound(){ Audio.Sound.createAsync( selectedAnimals.soundUrl, { shouldPlay: true } ).then((res)=>{ res.sound.setOnPlaybackStatusUpdate((status)=>{ if(!status.didJustFinish) return; res.sound.unloadAsync().catch(()=>{}); }); }).catch((error)=>{}); }