From 05322d9887a164e9fad69f9a5b6071e8cc5471c4 Mon Sep 17 00:00:00 2001 From: dcvz Date: Mon, 18 Sep 2023 17:22:08 +0200 Subject: [PATCH] Fix rate updates in notification --- SwiftAudioEx/Classes/AudioPlayer.swift | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/SwiftAudioEx/Classes/AudioPlayer.swift b/SwiftAudioEx/Classes/AudioPlayer.swift index 446d637..a8ca2b2 100755 --- a/SwiftAudioEx/Classes/AudioPlayer.swift +++ b/SwiftAudioEx/Classes/AudioPlayer.swift @@ -85,7 +85,6 @@ public class AudioPlayer: AVPlayerWrapperDelegate { public var playWhenReady: Bool { get { wrapper.playWhenReady } set { - wrapper.rate = newValue ? 1 : 0 wrapper.playWhenReady = newValue } } @@ -205,7 +204,6 @@ public class AudioPlayer: AVPlayerWrapperDelegate { Start playback */ public func play() { - wrapper.rate = 1 wrapper.play() } @@ -213,7 +211,6 @@ public class AudioPlayer: AVPlayerWrapperDelegate { Pause playback */ public func pause() { - wrapper.rate = 0 wrapper.pause() } @@ -306,7 +303,7 @@ public class AudioPlayer: AVPlayerWrapperDelegate { func updateNowPlayingPlaybackValues() { nowPlayingInfoController.set(keyValues: [ MediaItemProperty.duration(wrapper.duration), - NowPlayingInfoProperty.playbackRate(Double(wrapper.rate)), + NowPlayingInfoProperty.playbackRate(wrapper.playWhenReady ? Double(wrapper.rate) : 0), NowPlayingInfoProperty.elapsedPlaybackTime(wrapper.currentTime) ]) }