@javascriptcommon/react-native-track-player 4.1.21 → 4.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -696,9 +696,12 @@ abstract class AudioPlayer internal constructor(
696
696
  Player.MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED -> playerEventHolder.updateAudioItemTransition(
697
697
  AudioItemTransitionReason.QUEUE_CHANGED(oldPosition)
698
698
  )
699
- Player.MEDIA_ITEM_TRANSITION_REASON_REPEAT -> playerEventHolder.updateAudioItemTransition(
700
- AudioItemTransitionReason.REPEAT(oldPosition)
701
- )
699
+ Player.MEDIA_ITEM_TRANSITION_REASON_REPEAT -> {
700
+ // Seek to 0 to update MediaSession position when track loops
701
+ // This fixes the notification progress bar not resetting on loop
702
+ exoPlayer.seekTo(0)
703
+ playerEventHolder.updateAudioItemTransition(AudioItemTransitionReason.REPEAT(oldPosition))
704
+ }
702
705
  Player.MEDIA_ITEM_TRANSITION_REASON_SEEK -> playerEventHolder.updateAudioItemTransition(
703
706
  AudioItemTransitionReason.SEEK_TO_ANOTHER_AUDIO_ITEM(oldPosition)
704
707
  )
@@ -215,8 +215,8 @@ public class AudioPlayer: AVPlayerWrapperDelegate {
215
215
  // the loadNowPlayingMetaValues call straight after:
216
216
  nowPlayingInfoController.setWithoutUpdate(keyValues: [
217
217
  MediaItemProperty.duration(item.getDuration()),
218
- NowPlayingInfoProperty.playbackRate(nil),
219
- NowPlayingInfoProperty.elapsedPlaybackTime(nil)
218
+ NowPlayingInfoProperty.playbackRate(0.0),
219
+ NowPlayingInfoProperty.elapsedPlaybackTime(0.0)
220
220
  ])
221
221
  loadNowPlayingMetaValues()
222
222
  }
@@ -398,7 +398,9 @@ public class AudioPlayer: AVPlayerWrapperDelegate {
398
398
  }
399
399
 
400
400
  switch state {
401
- case .ready, .loading, .playing, .paused:
401
+ case .ready, .playing, .paused:
402
+ // Only update on ready/playing/paused, not on loading (removed .loading)
403
+ // This prevents showing incorrect progress during item transitions
402
404
  if (automaticallyUpdateNowPlayingInfo) {
403
405
  updateNowPlayingPlaybackValues()
404
406
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@javascriptcommon/react-native-track-player",
3
- "version": "4.1.21",
3
+ "version": "4.1.23",
4
4
  "description": "A fully fledged audio module created for music apps",
5
5
  "main": "lib/src/index.js",
6
6
  "types": "lib/src/index.d.ts",