You can try with following and set MPNowPlayingInfoPropertyPlaybackRate to 1.
commandCenter.pauseCommand.addTarget { [weak self] (event) -> MPRemoteCommandHandlerStatus in
if self?.state == .playing {
self?.pause()
/// This is to keep the player slider position at the same of audio time paused.
MPNowPlayingInfoCenter.default().nowPlayingInfo?[MPNowPlayingInfoPropertyElapsedPlaybackTime] = CMTimeGetSeconds(self?.currentTime ?? CMTime(seconds: 0, preferredTimescale: 0))
}
return .success
}
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: