I am trying to set MPNowPlayingInfoCenter, most of the key-value pairs work fine, but there is some kind of issue with playback time
let mpic = MPNowPlayingInfoCenter.defaultCenter()
mpic.nowPlayingInfo = [
MPMediaItemPropertyArtwork:albumArtWork,
MPMediaItemPropertyTitle:titleString,
MPMediaItemPropertyArtist:artistName,
MPMediaItemPropertyPlaybackDuration:99,
MPNowPlayingInfoPropertyElapsedPlaybackTime:String(stringInterpolationSegment:self.myPlayer.currentItem?.currentTime()),
MPNowPlayingInfoPropertyPlaybackRate:1.0
]
this works and InfoCenter will correctly start counting.
As soon as I try something like
MPMediaItemPropertyPlaybackDuration:String(stringInterpolationSegment:self.myPlayer.currentItem?.duration())
it will fail. Should I be converting CMTime to double? Is there any other property I should access?
try this
duration should be as String / like : 02:24