SwiftAudioEx icon indicating copy to clipboard operation
SwiftAudioEx copied to clipboard

Track looping creates audio gap in iOS playback

Open valeriiamykhalova opened this issue 1 year ago • 3 comments

Our team is switching to react-native-track-player, which seems to be the best option for native playback, but we encountered a bug that is not fixable with JS. We would greatly appreciate any tips on whether this is a known issue and if there's a way to fix it. If it's not on the schedule, are there any suggestions on where to look to fix it ourselves?

Describe the bug A noticeable audio gap during track looping when using RepeatMode.Track. The gap occurs when the track restarts.

To Reproduce

  1. Setup TrackPlayer with a single audio track
  2. Set RepeatMode.Track
  3. Play audio and let it loop
  4. You'll hear a gap when the loop resets

Code example in RN:

await TrackPlayer.add(track);
await TrackPlayer.setRepeatMode(RepeatMode.Track);
await TrackPlayer.play();

Expected behavior Seamless gapless playback when the audio track loops.

Smartphone:

  • Device: iPhone 14, Simulator iPhone SE 3rd generation
  • OS: iOS 17.5, iOS 18.0
  • Version: SwiftAudioEx 1.1.0

Additional context Using:

  • react-native-track-player: 4.1.1
  • SwiftAudioEx: 1.1.0

valeriiamykhalova avatar Oct 30 '24 14:10 valeriiamykhalova

I have a similar issue with react-native-trackplayer/swiftaudioex. I am developing a music app that plays live shows in which users expect a seamless (or near seamless) transition between songs but there is a very noticeable 1-2 second period of silence while loading the next track. I have attempted to mitigate this gap period by pre-downloading the next track and update the metadata to use the local copy but this did not solve the issue. I have seen that this feature has also been requested in the rn-trackplayer repo https://github.com/doublesymmetry/react-native-track-player/issues/1850. I would love to see a gapless feature added SwiftAudioEx and exposed to reactnavtive-trackplayer.

TerryMooreII avatar Jan 03 '25 14:01 TerryMooreII

We are also very much interested in having a gapless playback between tracks. Did someones start looking into this? Any suggestions where to start?

RiccardoRomagnoli avatar Jan 06 '25 17:01 RiccardoRomagnoli

We are also having the same problem. This comment from the react-native-track-player issue gives more detail about where the problem comes from: https://github.com/doublesymmetry/react-native-track-player/issues/1850#issuecomment-3517962043

j-q-in-berlin avatar Nov 12 '25 07:11 j-q-in-berlin