Skip to content

Commit

Permalink
Fix rate updates in notification
Browse files Browse the repository at this point in the history
  • Loading branch information
dcvz committed Sep 18, 2023
1 parent 645b7bc commit 05322d9
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions SwiftAudioEx/Classes/AudioPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ public class AudioPlayer: AVPlayerWrapperDelegate {
public var playWhenReady: Bool {
get { wrapper.playWhenReady }
set {
wrapper.rate = newValue ? 1 : 0
wrapper.playWhenReady = newValue
}
}
Expand Down Expand Up @@ -205,15 +204,13 @@ public class AudioPlayer: AVPlayerWrapperDelegate {
Start playback
*/
public func play() {
wrapper.rate = 1
wrapper.play()
}

/**
Pause playback
*/
public func pause() {
wrapper.rate = 0
wrapper.pause()
}

Expand Down Expand Up @@ -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)
])
}
Expand Down

0 comments on commit 05322d9

Please sign in to comment.