pulp
pulp

Reputation: 1828

How to hide MPMediaItemPropertyPlaybackDuration slider from locked screen and Control Center?

I'm working on online radio player and need some help. When I set MPNowPlayingInfoCenter.defaultCenter().nowPlayingInfo I have title, controls and playback duration slider. I don't need this slider because I have no info about playback duration and moreover it is not a very good looking control. Can somebody prompt me how to hide playback duration slider? And one more question: since the app is online radio player, the user have no ability to forward or rewind the playback, so I want to hide this controls from locked screen and Control Center either. By the way I'm using Swift. Thanks in advance!

Upvotes: 5

Views: 2756

Answers (4)

kiid
kiid

Reputation: 96

In case its a live stream you can set the MPNowPlayingInfoPropertyIsLiveStream property true. Instead of the slider a 'LIVE' label will be displayed.

Upvotes: 2

John Franke
John Franke

Reputation: 1535

[songInfo setObject:@0 forKey:MPMediaItemPropertyPlaybackDuration];
[playingInfoCenter setNowPlayingInfo:songInfo];

When you set MPMediaItemPropertyPlaybackDuration to 0, the slider is gone.

Upvotes: 0

Mr Stanev
Mr Stanev

Reputation: 1698

I was searching for a way to hide the playback duration slier too and couldn't find any. Then I played a radio from Apple Music app and when I locked the screen I could see the duration slider. So either there is no way to remove it or Apple "forgot" to remove it on their own Music app.

Upvotes: 0

Matt Harrington
Matt Harrington

Reputation: 638

To hide the forward and rewind buttons, you disable the relevant commands in MPRemoteCommandCenter. Here's how: https://stackoverflow.com/a/28925369.

I wish I knew how to hide the playback slider. I posted a similar question before finding yours.

Upvotes: 0

Related Questions