Reputation: 1954
I have a radio App, and i playing it with AVPlayer.
I display the Name radio in MPNowPLaying.
I want hide button next/previous track and slide bar with PLayback Duration. How can i do it? I want display like in pictures below:
Upvotes: 1
Views: 1105
Reputation: 7876
You can't hide them. But starting in iOS 7.1
you can disable them:
// Disable previous track button
[MPRemoteCommandCenter sharedCommandCenter].previousTrackCommand.enabled = NO;
// Disable next track button
[MPRemoteCommandCenter sharedCommandCenter].nextTrackCommand.enabled = NO;
For the playback duration, just don't set anything for MPMediaItemPropertyPlaybackDuration
in your [[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:]
On top of that, you can show custom info (and even an artwork) on the now playing screen:
NSMutableDictionary *songInfo = [[NSMutableDictionary alloc] init];
[songInfo setObject:someTitle forKey:MPMediaItemPropertyTitle];
[songInfo setObject:someArtist forKey:MPMediaItemPropertyArtist];
[songInfo setObject:someAlbum forKey:MPMediaItemPropertyAlbumTitle];
MPMediaItemArtwork *albumArt;
if (song.artwork){
albumArt = [[MPMediaItemArtwork alloc] initWithImage: someArtwork];
}
else {
albumArt = [[MPMediaItemArtwork alloc] init]; // make sure to remove the artwork if none is found for the current track
}
[songInfo setObject:albumArt forKey:MPMediaItemPropertyArtwork];
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:songInfo];
Upvotes: 3