EDIT:
, "stop" , MPNowPlayingInfoPropertyIsLiveStream = true ( iOS 10)/:
, "" "togglePlayPause". iOS 10 "stop" , MPNowPlayingInfoPropertyIsLiveStream = true.
, "" "togglePlayPause" ( ). !
, , , , MPRemoteCommandCenter MPNowPlayingInfoCenter.
, . , MPNowPlayingInfoPropertyIsLiveStream, , - ( ):
Swift 3
MPNowPlayingInfoCenter ( ):
var songInfo = [:] as [String : Any]
if NSClassFromString("MPNowPlayingInfoCenter") != nil {
songInfo[MPMediaItemPropertyArtwork] = MPMediaItemArtwork(image: UIImage(named: "your_image_name")!)
songInfo[MPMediaItemPropertyTitle] = "Title"
songInfo[MPMediaItemPropertyArtist] = "Artist name"
if #available(iOS 10.0, *) {
songInfo[MPNowPlayingInfoPropertyIsLiveStream] = true
} else {
}
MPNowPlayingInfoCenter.default().nowPlayingInfo = songInfo
}
MPRemoteCommandCenter:
if #available(iOS 9.1, *) {
let center = MPRemoteCommandCenter.shared()
[center.pauseCommand, center.togglePlayPauseCommand, center.nextTrackCommand, center.previousTrackCommand, center.changeRepeatModeCommand, center.changeShuffleModeCommand, center.changePlaybackRateCommand, center.seekBackwardCommand, center.seekForwardCommand, center.skipBackwardCommand, center.skipForwardCommand, center.changePlaybackPositionCommand, center.ratingCommand, center.likeCommand, center.dislikeCommand, center.bookmarkCommand].forEach {
$0.isEnabled = false
}
center.playCommand.addTarget { (commandEvent) -> MPRemoteCommandHandlerStatus in
return MPRemoteCommandHandlerStatus.success
}
center.stopCommand.addTarget { (commandEvent) -> MPRemoteCommandHandlerStatus in
return MPRemoteCommandHandlerStatus.success
}
} else {
}
. , (: