I made a simple app to play audio using custom audio engine.
The audio engine supports audio format that encrypted like audio DRM and used a framework of Audio Unit.
If the remote control in iPhone presses a playback button then must playing audio and changing playback icon to pause icon. So, my custom audio app had played, but the icon in remote controller was not changed.
I think that may my custom app don't send an event notification to remote control. I want to send an event that my audio app is playing.
I would like to get your good idea.
rcc = [MPRemoteCommandCenter sharedCommandCenter];
pauseCommand = [rcc pauseCommand];
[pauseCommand setEnabled:YES];
[pauseCommand addTarget:self action:@selector(playOrPauseEvent:)];
playCommand = [rcc playCommand];
[playCommand setEnabled:YES];
[playCommand addTarget:self action:@selector(playOrPauseEvent:)];
...
- (MPRemoteCommandHandlerStatus) playOrPauseEvent: (MPRemoteCommandEvent *)playOrPauseEvent {
if ([engine isPlaying]) {
[engine pause];
} else {
[engine start];
}
return MPRemoteCommandHandlerStatusSuccess;
}