Fry
Fry

Reputation: 6275

MPMoviePlayerController don't show play icon in the status bar while playing audio

my problem is this: I've an MPMoviePlayerController that I use to reproduce a streaming radio, but while playing the streaming, in the status bar the play icon doesn't appear.

Does anyone know the cause ?

Upvotes: 1

Views: 936

Answers (1)

Till
Till

Reputation: 27597

For allowing your App to control the play-icon within the status bar, you need to first setup the AudioSession-Category to kAudioSessionCategory_MediaPlayback

UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
AudioSessionSetProperty (kAudioSessionProperty_AudioCategory,
                         sizeof (sessionCategory),
                         &sessionCategory);
AudioSessionSetActive (true);

Then register for remote control events

[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];

- (BOOL)canBecomeFirstResponder 
{
    return YES;
}

When done, do not forget to unregister yourself

[[UIApplication sharedApplication] endReceivingRemoteControlEvents];

Upvotes: 4

Related Questions