zmxv / react-native-sound

React Native module for playing sound clips
MIT License
2.78k stars 747 forks source link

Audio after playing not stopped #822

Open iasreact1 opened 1 year ago

iasreact1 commented 1 year ago

Hello, I have added audio in my cache directory and then played it creating a sound object with in a function like that const playAudio = () => { if (selectAudio) { const sound = new Sound(selectAudio, Sound.CACHES, (error) => { if (error) { console.log('Error loading audio file', error); return; } setSound(sound); sound.play(); }); } }; But now i have to stop the audio after certain time using sound.stop() from another function and it will not worked and even not call i think sound object not properly passed please help if i want to stop the sound from another function..please help