react-native-sound icon indicating copy to clipboard operation
react-native-sound copied to clipboard

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

Open MartinGio opened this issue 4 years ago • 2 comments

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 ?

MartinGio avatar Oct 09 '21 13:10 MartinGio

Have the same problem

levkovich2806 avatar Aug 12 '22 13:08 levkovich2806

Is there any update on this issue? Still facing this

Tahira-SCT avatar Jan 11 '24 08:01 Tahira-SCT