zmxv / react-native-sound

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

Calling .stop( ( ) => { .play( ) } ) doesn't work when sound is playing #758

Open MartinGio opened 2 years ago

MartinGio commented 2 years ago

Hi !

I want to play a sound with a button. If the sound is already playing I also want the button to work, stopping, rewinding and playing again the sound, but it doesn't seem to work. Here is my function.

export function PlaySound(audioRef){
        audioRef.stop(()=>{
            audioRef.play((success)=>{if(success)console.log('sound played !')})
        })
    }
}

It plays the sound, and plays it again when I press again after the sound has finished. But If I press while the sound is playing, no sound is played, and the console stille shows 'sound played !' Why is that ? Any solution ?

levkovich2806 commented 1 year ago

Have the same problem

Tahira-SCT commented 5 months ago

Is there any update on this issue? Still facing this