In recent iOS versions apps have some kind of access to the media control buttons on the lock screen, like the Play/Pause button:
It looks like the buttons are supposed to work with the MPMusicPlayerController
class, is that right? Is there a way to get the “raw” events from the buttons? Because the music player only seems to offer an API to supply a bunch of MPMediaItem
s. What if my app is for example a radio that needs to handle the buttons differently?
Tap the lock icon once, to change it to an unlock icon, then tap the unlock icon to access the normal Netflix controls. Tap the lock icon to change it to an unlock icon, then tap it again to unlock Netflix's controls. The process for enabling and disabling screen lock is identical on both iOS and Android.
From the Home screen, tap the Menu Key > Lock screen settings. Tap Shortcuts. You can access the Shortcuts setting only when the lock screen is set to Swipe. Tap one of the icons at the bottom of the screen, then tap the app you want to replace it with.
After a bit more searching I have found this related question that makes things clear. The music player controller class is not really the right track, the trick is to subscribe for remote events in your controller:
- (void) viewDidAppear: (BOOL) animated
{
[super viewDidAppear:animated];
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];
}
- (BOOL) canBecomeFirstResponder
{
return YES;
}
- (void) remoteControlReceivedWithEvent: (UIEvent*) event
{
// see [event subtype] for details
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With