react-native-mp3-player 1.0.7 → 1.0.8
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.
|
@@ -186,11 +186,11 @@ public class RNTrackPlayer: NSObject, AudioSessionControllerDelegate {
|
|
|
186
186
|
configureAudioSessionForBackgroundPlayback()
|
|
187
187
|
configureAudioSession()
|
|
188
188
|
|
|
189
|
-
//
|
|
189
|
+
// So the lock screen / Control Center widget can show as soon as nowPlayingInfo is set (first track add).
|
|
190
190
|
if Thread.isMainThread {
|
|
191
191
|
UIApplication.shared.beginReceivingRemoteControlEvents()
|
|
192
192
|
} else {
|
|
193
|
-
DispatchQueue.main.
|
|
193
|
+
DispatchQueue.main.async {
|
|
194
194
|
UIApplication.shared.beginReceivingRemoteControlEvents()
|
|
195
195
|
}
|
|
196
196
|
}
|
|
@@ -576,8 +576,8 @@ public class RNTrackPlayer: NSObject, AudioSessionControllerDelegate {
|
|
|
576
576
|
effectivePlaybackState = .playing
|
|
577
577
|
player.play()
|
|
578
578
|
updateNowPlayingPlaybackValuesOnMainIfNeeded()
|
|
579
|
-
emit(event: EventType.PlaybackState, body: getPlaybackStateBodyKeyValues(state: .playing))
|
|
580
579
|
resolve(NSNull())
|
|
580
|
+
emit(event: EventType.PlaybackState, body: getPlaybackStateBodyKeyValues(state: .playing))
|
|
581
581
|
}
|
|
582
582
|
|
|
583
583
|
@objc(pause:rejecter:)
|
|
@@ -586,8 +586,8 @@ public class RNTrackPlayer: NSObject, AudioSessionControllerDelegate {
|
|
|
586
586
|
effectivePlaybackState = .paused
|
|
587
587
|
player.pause()
|
|
588
588
|
updateNowPlayingPlaybackValuesOnMainIfNeeded()
|
|
589
|
-
emit(event: EventType.PlaybackState, body: getPlaybackStateBodyKeyValues(state: .paused))
|
|
590
589
|
resolve(NSNull())
|
|
590
|
+
emit(event: EventType.PlaybackState, body: getPlaybackStateBodyKeyValues(state: .paused))
|
|
591
591
|
}
|
|
592
592
|
|
|
593
593
|
@objc(setPlayWhenReady:resolver:rejecter:)
|
|
@@ -215,14 +215,14 @@ public class AudioPlayer: AVPlayerWrapperDelegate {
|
|
|
215
215
|
// (duration/elapsed/rate must be set; use 0 until the player reports real values).
|
|
216
216
|
nowPlayingInfoController.set(keyValues: [
|
|
217
217
|
MediaItemProperty.duration(0),
|
|
218
|
-
NowPlayingInfoProperty.playbackRate((playWhenReady ??
|
|
218
|
+
NowPlayingInfoProperty.playbackRate((playWhenReady ?? false) ? 1.0 : 0.0),
|
|
219
219
|
NowPlayingInfoProperty.elapsedPlaybackTime(0)
|
|
220
220
|
])
|
|
221
221
|
loadNowPlayingMetaValues()
|
|
222
|
-
//
|
|
222
|
+
// Flush to MPNowPlayingInfoCenter immediately on main so lock screen widget appears on first play
|
|
223
223
|
nowPlayingInfoController.pushToCenterSync()
|
|
224
224
|
}
|
|
225
|
-
|
|
225
|
+
|
|
226
226
|
enableRemoteCommands(forItem: item)
|
|
227
227
|
|
|
228
228
|
wrapper.load(
|
|
@@ -431,9 +431,6 @@ public class AudioPlayer: AVPlayerWrapperDelegate {
|
|
|
431
431
|
}
|
|
432
432
|
|
|
433
433
|
func AVWrapper(didUpdateDuration duration: Double) {
|
|
434
|
-
if automaticallyUpdateNowPlayingInfo {
|
|
435
|
-
nowPlayingInfoController.set(keyValue: MediaItemProperty.duration(duration))
|
|
436
|
-
}
|
|
437
434
|
event.updateDuration.emit(data: duration)
|
|
438
435
|
}
|
|
439
436
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-mp3-player",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
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",
|