Loop not working for the first play
I have a weird issue, the same as described here.
The loop parameter is not taken in consideration until the first play, even though the numberOfLoops property is correct (I logged it just before the play).
The temporary workaround I found JS side (without touching the library) is:
const sound = new Sound('alert.m4a', Sound.MAIN_BUNDLE, () => {
sound.setNumberOfLoops(-1);
sound.play(() => {
sound.play();
});
});
The second play take into account the numberOfLoops property. On the SO post, the OP found a native workaround by replacing the player. Maybe it's worth looking into this.
Replacing the player sounds more hacky than your JS workaround.
Hi there,
I have got the same issue. Did you find a way to fix this issue ?
The workaround I found for now is to play the sound with no volume inside the constructor callback and set the volume back to normal when play ends.
Cheers
I added a test to react-native-sound demo, and it worked as intended on iOS and Android https://github.com/zmxv/react-native-sound-demo/pull/5.