I follow this issue https://github.com/zmxv/react-native-sound/issues/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
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
use .release() method before starting new audio track!
like
if (this.lastTrack) {
this.lastTrack.release();
this.lastTrack = null;
}
Most helpful comment
use
.release()method before starting new audio track!like