@javascriptcommon/react-native-track-player 4.1.19 → 4.1.22

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.
@@ -37,6 +37,7 @@ class MusicEvents(private val reactContext: ReactContext) : BroadcastReceiver()
37
37
  const val BUTTON_DUCK = "remote-duck"
38
38
  const val BUTTON_BROWSE = "remote-browse"
39
39
  const val BUTTON_CUSTOM_ACTION = "remote-custom-action"
40
+ const val BUTTON_SHUFFLE = "remote-shuffle"
40
41
 
41
42
  // Playback Events
42
43
  const val PLAYBACK_PLAY_WHEN_READY_CHANGED = "playback-play-when-ready-changed"
@@ -406,7 +406,8 @@ class MusicService : HeadlessJsMediaService() {
406
406
 
407
407
  player.alwaysPauseOnInterruption = androidOptions?.getBoolean(PAUSE_ON_INTERRUPTION_KEY) ?: false
408
408
  val newShuffleState = androidOptions?.getBoolean(SHUFFLE_KEY) ?: false
409
- player.shuffleMode = newShuffleState
409
+ // Don't set player.shuffleMode - shuffle is managed by JS layer through queue reordering
410
+ // Only track shuffleState for notification icon display
410
411
  shuffleState = newShuffleState
411
412
 
412
413
  // Update heart state if provided
@@ -15,5 +15,6 @@ enum class Capability {
15
15
  SET_RATING,
16
16
  LIKE,
17
17
  DISLIKE,
18
- BOOKMARK
18
+ BOOKMARK,
19
+ SHUFFLE
19
20
  }
@@ -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
  )
@@ -0,0 +1,6 @@
1
+ <vector android:autoMirrored="true" android:height="24dp"
2
+ android:viewportHeight="960" android:viewportWidth="960"
3
+ android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
4
+ <path android:fillColor="@android:color/white" android:pathData="M560,800L560,720L664,720L537,593L594,536L720,662L720,560L800,560L800,800L560,800ZM216,800L160,744L664,240L560,240L560,160L800,160L800,400L720,400L720,296L216,800ZM367,423L160,216L216,160L423,367L367,423Z"/>
5
+ <path android:fillColor="@android:color/white" android:pathData="M480,890m-60,0a60,60 0,1 1,120 0a60,60 0,1 1,-120 0"/>
6
+ </vector>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@javascriptcommon/react-native-track-player",
3
- "version": "4.1.19",
3
+ "version": "4.1.22",
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",