1

I have a recording app, and from the lockscreen, the user can pause the recording. This also makes the MPNowPlayingInfoCenter go away so that the user must go back to the app to start recording again.

However, right when the user presses the pause button, it flashes up "Music" for the property title. I've seen another app work well without "Music" popping up.

Any idea what I need to do?

Here is where the info center gets called "infoCenter is declared in the header and synthesized.

infoCenter = [MPNowPlayingInfoCenter defaultCenter];

        if (infoCenter) {
        [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];

        infoCenter.nowPlayingInfo =
        [NSDictionary dictionaryWithObjectsAndKeys:@"Recording", MPMediaItemPropertyTitle,
         nil];

            [self becomeFirstResponder];
        }
    }

And here are the controls:

- (void) remoteControlReceivedWithEvent: (UIEvent *) receivedEvent {
if (receivedEvent.type == UIEventTypeRemoteControl) {
    switch (receivedEvent.subtype) {
        case UIEventSubtypeRemoteControlPause: {
            [[UIApplication sharedApplication] endReceivingRemoteControlEvents];
            [self resignFirstResponder];
            [self playTapped:nil]; //this is the action that pauses the recording
            break;
        }

        default:
            break;
    }
}
}
Steve Sahayadarlin
  • 1,164
  • 3
  • 15
  • 32
MScottWaller
  • 3,321
  • 2
  • 24
  • 47
  • Those controls are used to indicate the state of a music *player*, not a recorder. – duci9y Jul 26 '14 at 20:47
  • I know, but there is no other way to let a user know a recorder is recording in the background while the user is looking at the lockscreen, and other apps seem to take advantage of the same functionality – MScottWaller Jul 26 '14 at 20:49
  • You have your app misconfigured. When other apps are recording, the status bar is red with the name of the app doing the recording. – duci9y Jul 26 '14 at 20:51
  • Not when you're looking at the lock screen. The red bar appears if you've unlocked your phone and you can see other apps. At least that's what I've been able to see from other audio recording apps. – MScottWaller Jul 26 '14 at 20:54
  • Then there's simply no way to do what you're trying to do. I repeat, **do not use `MPNowPlayingInfoCenter` for this.** iOS users expect certain functionality from certain system controls. Your app will most likely get rejected if you use system controls for anything other than what their actual use case is. – duci9y Jul 26 '14 at 20:59
  • I don't know. I've found three apps in the app store that do this. Seems like a precedent has been established. Still wondering about my original question. If my app was simply playing music and I wanted the infoCenter to go away after tapping pause, what should I do? – MScottWaller Jul 26 '14 at 21:10
  • From the [docs](https://developer.apple.com/library/ios/documentation/mediaplayer/reference/MPNowPlayingInfoCenter_Class/Reference/Reference.html#//apple_ref/occ/instp/MPNowPlayingInfoCenter/nowPlayingInfo): *To clear the now playing info center dictionary, set it to `nil`.* Also, can you please link to any app that uses this? – duci9y Jul 26 '14 at 21:12
  • I tried putting in infoCenter.nowPlayingInfo = nil; before endReceivingRemoteControlEvents and it still flashes up "Music" although now sometimes it also flashes up the name of the app. – MScottWaller Jul 26 '14 at 21:27
  • Also have Recordium in the app store, AudioMemos Free uses MPNowPlayingInfoCenter but the controls don't actually do anything. – MScottWaller Jul 26 '14 at 21:28
  • Rev Recorder also uses this. They just say the recorder is paused rather than dismiss the infoCenter – MScottWaller Jul 26 '14 at 21:34
  • I'm sorry, but I'm at a dead end about your issue. Hope you find a solution. – duci9y Jul 26 '14 at 21:39
  • Thanks for the suggestions nonetheless. Will post here if I ever find a solution. – MScottWaller Jul 26 '14 at 21:48

0 Answers0