How to remove my app from Now Playing Info?
Asked Answered
C

2

6

My app start playing music and it appears in Now Playing Info, but i can't find how to clean it all: destroy the player and remove my app from Now Playing Info.

The lib that i'm using have not implemented this and i know almost nothing about ios/swift. Here is the code.

This is the issue in the repo, if some mantainer see this.

And this is an ilustrative image of Now Playing Info

enter image description here

Carrara answered 24/6, 2019 at 14:50 Comment(0)
R
2

Swift

MPNowPlayingInfoCenter.default().nowPlayingInfo = nil

Source from the official Apple documentation:

/// The current now playing info for the center.
/// Setting the info to nil will clear it.
open var nowPlayingInfo: [String : Any]?
Rasmussen answered 10/1, 2022 at 13:19 Comment(0)
I
0

You have to call:

UIApplication.shared.endReceivingRemoteControlEvents()

This will remove the now playing info from your lock screen.

Ignacia answered 18/9, 2020 at 13:53 Comment(2)
thanks man, I'm not able to confirm this anymore, if someone else can test this I can set this answer as correctCarrara
Sorry it's not working for me. I'm using iOS 14.Felid

© 2022 - 2024 — McMap. All rights reserved.