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

David Rearte
  • 764
  • 8
  • 19

2 Answers2

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]?
choofie
  • 2,575
  • 1
  • 25
  • 30
0

You have to call:

UIApplication.shared.endReceivingRemoteControlEvents()

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

algrid
  • 5,600
  • 3
  • 34
  • 37