I'm using this function for the play sound files. I want the sound to stop when I click the button
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)=>{});
}