I really try to turn it on, but with no success;) Is there any way to do this at all?
This is how I setup remote control:
private func setupRemoteControl() {
commandCenter.previousTrackCommand.isEnabled = false
commandCenter.nextTrackCommand.isEnabled = false
commandCenter.skipBackwardCommand.isEnabled = false
commandCenter.skipForwardCommand.isEnabled = false
commandCenter.seekForwardCommand.isEnabled = true
commandCenter.seekBackwardCommand.isEnabled = true
commandCenter.changePlaybackPositionCommand.isEnabled = true
commandCenter.playCommand.isEnabled = true
commandCenter.pauseCommand.isEnabled = true
commandCenter.playCommand.addTarget(self, action: #selector(play))
commandCenter.pauseCommand.addTarget(self, action: #selector(pause))
}
What do I miss?
Pause and play works perfectly.
You need to add a handler for all the event's you want to receive:
commandCenter.changePlaybackPositionCommand.addTarget(handler: { (event) in
// Handle position change
return MPRemoteCommandHandlerStatus.success
})
... To respond to a particular event, register a handler with the appropriate MPRemoteCommand object.
https://developer.apple.com/documentation/mediaplayer/mpremotecommand