react-native-mp3-player 1.0.9 → 1.0.10

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.
@@ -882,6 +882,9 @@ public class RNTrackPlayer: NSObject, AudioSessionControllerDelegate {
882
882
  switch state {
883
883
  case .ready, .playing, .paused:
884
884
  if player.currentItem != nil && player.automaticallyUpdateNowPlayingInfo {
885
+ // Force push so the widget appears immediately (avoids "Not Playing" / blank artwork).
886
+ player.loadNowPlayingMetaValues()
887
+ player.nowPlayingInfoController.pushToCenterSync()
885
888
  let useProgressTickForNowPlaying = shouldEmitProgressEvent && progressUpdateEventIntervalSeconds > 0 && progressUpdateEventIntervalSeconds <= 1.0
886
889
  if !useProgressTickForNowPlaying {
887
890
  scheduleNextNowPlayingUpdate()
@@ -911,9 +914,12 @@ public class RNTrackPlayer: NSObject, AudioSessionControllerDelegate {
911
914
  }
912
915
 
913
916
  /// Updates MPNowPlayingInfoCenter (rate, elapsed, duration) synchronously so the widget reflects play/pause before we return to JS. Call after play()/pause() from JS or remote.
917
+ /// Also refreshes title/artist/artwork so the widget never shows "Not Playing" or blank when a track is loaded.
914
918
  private func updateNowPlayingPlaybackValuesOnMainIfNeeded() {
915
919
  guard player.currentItem != nil, player.automaticallyUpdateNowPlayingInfo else { return }
920
+ player.loadNowPlayingMetaValues()
916
921
  player.updateNowPlayingPlaybackValuesSync()
922
+ player.nowPlayingInfoController.pushToCenterSync()
917
923
  }
918
924
 
919
925
  func handleAudioPlayerCommonMetadataReceived(metadata: [AVMetadataItem]) {
@@ -953,10 +959,12 @@ public class RNTrackPlayer: NSObject, AudioSessionControllerDelegate {
953
959
  DispatchQueue.main.async {
954
960
  UIApplication.shared.beginReceivingRemoteControlEvents();
955
961
  }
956
- // Update now playing controller with isLiveStream option from track
962
+ // Update now playing controller with isLiveStream option from track and push so widget shows new track (e.g. after close and play again).
957
963
  if self.player.automaticallyUpdateNowPlayingInfo {
958
964
  let isTrackLiveStream = (item as? Track)?.isLiveStream ?? false
959
965
  self.player.nowPlayingInfoController.set(keyValue: NowPlayingInfoProperty.isLiveStream(isTrackLiveStream))
966
+ self.player.loadNowPlayingMetaValues()
967
+ self.player.nowPlayingInfoController.pushToCenterSync()
960
968
  }
961
969
  } else {
962
970
  DispatchQueue.main.async {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-mp3-player",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "React Native audio player with reliable iOS background playback. Media controls, queue, hooks. Built for stability and long-running playback.",
5
5
  "main": "lib/src/index.js",
6
6
  "types": "lib/src/index.d.ts",