Clear now playing info when play back is stopped

This commit is contained in:
Jackson Harper 2022-08-16 21:58:43 +08:00
parent 4087ff35d6
commit cdd5ba7417

View file

@ -41,6 +41,7 @@ public class AudioSession: ObservableObject {
public func stop() {
player?.stop()
clearNowPlayingInfo()
timer = nil
player = nil
item = nil
@ -114,6 +115,10 @@ public class AudioSession: ObservableObject {
}
}
func clearNowPlayingInfo() {
MPNowPlayingInfoCenter.default().nowPlayingInfo = [:]
}
func setupRemoteControl() {
UIApplication.shared.beginReceivingRemoteControlEvents()