5

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!

FormigaNinja
  • 1,571
  • 1
  • 24
  • 36
pulp
  • 1,768
  • 2
  • 16
  • 24

4 Answers4

2

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

kiid
  • 86
  • 5
  • 1
    MPNowPlayingInfoCenter.default().nowPlayingInfo = [MPNowPlayingInfoPropertyIsLiveStream: true] – Matea Apr 29 '20 at 10:56
0

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.

Community
  • 1
  • 1
Matt Harrington
  • 638
  • 3
  • 13
0

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.

Mr Stanev
  • 1,662
  • 1
  • 19
  • 26
0
[songInfo setObject:@0 forKey:MPMediaItemPropertyPlaybackDuration];
[playingInfoCenter setNowPlayingInfo:songInfo];

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

John Franke
  • 1,444
  • 19
  • 23