Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sound does not work after playing more than 10 times #574

Open
IWTBCAdeveloper opened this issue May 23, 2019 · 2 comments
Open

Sound does not work after playing more than 10 times #574

IWTBCAdeveloper opened this issue May 23, 2019 · 2 comments
Labels

Comments

@IWTBCAdeveloper
Copy link

@IWTBCAdeveloper IWTBCAdeveloper commented May 23, 2019

I follow this issue #565
but it still doesn't work. What should I do now. Please help

environment:
react-native: 0.51.0
android 7
react-native-sound: 0.10.12

function* handleLoadSound() {
  Sound.setCategory('Playback');
}

function* handlePlaySound(action) {
  const { name } = action.payload;
  const filename = `${name}.mp3`;
  Sound.setCategory('Playback');

  let sound = new Sound(filename, Sound.MAIN_BUNDLE, (error) => {
    if (error) {
      console.log('failed to load the sound', error);
      return;
    }

    sound.play((success) => {
      if (success) {
        console.log('successfully finished playing');
        sound.release()
      }
    });
  });
}

Thanks a lot

@maitrungduc1410

This comment has been minimized.

Copy link

@maitrungduc1410 maitrungduc1410 commented Jun 21, 2019

I'm testing it with remote URL and it works fine, I test with about 30 times.

Here is my code (quite short, you should read)

Hope this help

@samad324

This comment has been minimized.

Copy link

@samad324 samad324 commented Jul 2, 2019

use .release() method before starting new audio track!
like

 if (this.lastTrack) {
      this.lastTrack.release();
      this.lastTrack = null;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.