Get current playing song from Spotify iOS app

Here is a solution in Swift 3: let player = MPMusicPlayerController.systemMusicPlayer() if let mediaItem = player.nowPlayingItem { let title: String = mediaItem.value(forProperty: MPMediaItemPropertyTitle) as! String let albumTitle: String = mediaItem.value(forProperty: MPMediaItemPropertyAlbumTitle) as! String let artist: String = mediaItem.value(forProperty: MPMediaItemPropertyArtist) as! String print(“\(title) on \(albumTitle) by \(artist)”) } Note that starting from iOS 10, you must … Read more

MPNowPlayingInfoCenter not reacting properly when pausing playback

I’ve the solution! Set only the MPMediaItemPropertyPlaybackDuration 1 – When you start the track, set the property with the total duration of the track: MPNowPlayingInfoCenter *center = [MPNowPlayingInfoCenter defaultCenter]; NSDictionary *songInfo = @{ MPMediaItemPropertyTitle: title, MPMediaItemPropertyArtist: artist MPMediaItemPropertyPlaybackDuration : [NSNumber numberWithFloat:length] }; center.nowPlayingInfo = songInfo; 2 – when you pause the track… do nothing. 3 … Read more

Is there a public way to force MPNowPlayingInfoCenter to show podcast controls?

OK so I had a bit of time on my hands and so I followed the breadcrumb.… This is what I found. Include the MediaPlayer framework and get hold of the RemoteCommandCenter: MPRemoteCommandCenter *rcc = [MPRemoteCommandCenter sharedCommandCenter]; then if you wanted to set the skip controls as per Overcast you can do the following: MPSkipIntervalCommand … Read more

tech