iOS Development

ios – MPRemoteCommandCenter present all controls/instructions

I need to present skip ahead, skip backward, earlier monitor, subsequent monitor on the locked display screen. However appears skip ahead/backward will simply override earlier/subsequent monitor. That’s solely skip ahead and skip backward controls will seem on the locked display screen. I attempted reordering and it’s the identical impact.

- (void)setupRemoteTransportControls {
    // Get the shared MPRemoteCommandCenter
    [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
    MPRemoteCommandCenter* commandCenter = [MPRemoteCommandCenter sharedCommandCenter];
    
    // Add handler for Play Command
    [commandCenter.playCommand setEnabled:YES];
    [commandCenter.playCommand addTarget:self action:@selector(playVideo)];
    //
    [commandCenter.pauseCommand setEnabled:YES];
    [commandCenter.pauseCommand addTarget:self action:@selector(pauseVideo)];
    
    //strive put skip first
    //[commandCenter.skipBackwardCommand setEnabled:YES];
    //[commandCenter.skipBackwardCommand addTarget:self action:@selector(skipBackward)];
    
    //[commandCenter.skipForwardCommand setEnabled:YES];
    //[commandCenter.skipForwardCommand addTarget:self action:@selector(skipForward)];

    [commandCenter.previousTrackCommand setEnabled:YES];
    [commandCenter.previousTrackCommand addTarget:self action:@selector(prevTrack)];
    
    [commandCenter.nextTrackCommand setEnabled:YES];
    [commandCenter.nextTrackCommand addTarget:self action:@selector(nextTrack)];
    
    [commandCenter.skipBackwardCommand setEnabled:YES];
    [commandCenter.skipBackwardCommand addTarget:self action:@selector(skipBackward)];
    
    [commandCenter.skipForwardCommand setEnabled:YES];
    [commandCenter.skipForwardCommand addTarget:self action:@selector(skipForward)];
    
    [commandCenter.changePlaybackPositionCommand setEnabled:true];
    [commandCenter.changePlaybackPositionCommand addTarget:self action:@selector(changedThumbSliderOnLockScreen:)];
    
    [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
}

Credit: www.ismmailgsm.com

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button