zmxv / react-native-sound

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

.Play method are being calling itself repeatedly after numerous calls #811

Open shubhammalvedev opened 1 year ago

shubhammalvedev commented 1 year ago

:beetle: Description

:beetle: What is the observed behavior? Playing some audio files 1 by 1 after playing 8-10 files .play method is calling itself repeatedly.

:beetle: What is the expected behavior? should play audios 1 after another after successfully played previous audio. i tried this scenario by using setintervals but was not reliable.

:beetle: Please post your code:

soundFile.play((success:any)=>{
        console.log('#527 after playing sound success-------->',success);

        if(success){
          this.setState({songCounter:this.state.songCounter+1, isPlaying:true})
        setTimeout(() => {
          this.loadSound('load')
          console.log('#526 loadsound called');
        }, 100);}
      })

:bulb: Does the problem have a test case?

:bulb: **Possible solution**

:bulb: Is there a workaround?

:bulb: If the bug is confirmed, would you be willing to create a pull request?

Is your issue with...

Are you using...

Which versions are you using?

Does the problem occur on...

If your problem is happening on a device, which device?

BraveEvidence commented 1 year ago

This will help https://www.youtube.com/watch?v=vVI7ZAZq5e0