react-native-audio-toolkit icon indicating copy to clipboard operation
react-native-audio-toolkit copied to clipboard

[Android] Gaps between loops

Open kyrylenko opened this issue 7 years ago • 5 comments

Hey! I've tried using .mp3 and .ogg file types but the player is still looping with gaps. Is there any workaround?

kyrylenko avatar Jun 17 '18 15:06 kyrylenko

@kyrylenko the same thing happens to me, did you solve it somehow?

gponsu avatar Feb 07 '20 13:02 gponsu

Any update on this issue ?

hazeeb avatar Jul 19 '20 09:07 hazeeb

Can't believe this issue still exists 🙄 I'm experiencing the same for iOS.

brandtnewlabs avatar Aug 02 '20 12:08 brandtnewlabs

Facing the same issue. It ruins the user experience.

murtuzamacdev avatar Aug 23 '20 14:08 murtuzamacdev

I overcame the issue with below custom loop:

  1. Note the exact duration of each of your sounds in milliseconds.
  2. Create a setInterval method and pass the millisecond of your sounds.
  3. Inside setInterval, call the method player.seek(0) to play from the beginning.
  4. Whenever you want to stop the player, simply clearInterval(selectedSound.interval).

Code:

selectedSound.interval = BackgroundTimer.setInterval(() => {
                selectedSound.player && selectedSound.player.seek(0)
            }, selectedSound.duration);

This is not an ideal solution and it does have a tiny gap from time to time but it is much better than the gap in the looping provided in the library.

murtuzamacdev avatar Sep 22 '20 15:09 murtuzamacdev