Я получил решение, просто использовал MPRemoteCommandCenter и добавил подробности о видео, см. Код в Objetive C
// для настройки информации об игре
- (void) setupNowPlayingInfoCenter{
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];
MPRemoteCommandCenter *commandCenter = [MPRemoteCommandCenter sharedCommandCenter];
[commandCenter.togglePlayPauseCommand setEnabled:YES];
[commandCenter.playCommand setEnabled:YES];
[commandCenter.pauseCommand setEnabled:YES];
[commandCenter.nextTrackCommand setEnabled:NO];
[commandCenter.previousTrackCommand setEnabled:NO];
[commandCenter.playCommand addTargetWithHandler: ^MPRemoteCommandHandlerStatus(MPRemoteCommandEvent * _Nonnull event) {
[self->_player play];
return MPRemoteCommandHandlerStatusSuccess;
}];
[commandCenter.pauseCommand addTargetWithHandler: ^MPRemoteCommandHandlerStatus(MPRemoteCommandEvent * _Nonnull event) {
[self->_player pause];
return MPRemoteCommandHandlerStatusSuccess;
}];
}
// для обновления игры информация при вводе в фоновом режиме
- (void) updateNowPlayingInfoCenter {
NSDictionary *metadata = [self.media metaData];
MPNowPlayingInfoCenter *playingInfoCenter = [MPNowPlayingInfoCenter defaultCenter];
NSMutableDictionary *songInfo = [[NSMutableDictionary alloc] init];
[songInfo setObject:metadata[MIBMediaMetaDataTrackNameKey] forKey:MPMediaItemPropertyTitle];
[songInfo setObject:metadata[MIBMediaMetaDataTrackNameKey] forKey:MPMediaItemPropertyArtist];
[songInfo setObject:metadata[MIBMediaMetaDataTrackDurationKey] forKey:MPMediaItemPropertyPlaybackDuration];
[songInfo setObject:[NSNumber numberWithDouble:(!self.playing ? 0.0f : 1.0f)] forKey:MPNowPlayingInfoPropertyPlaybackRate];
[playingInfoCenter setNowPlayingInfo:songInfo];
}
// добавление этой строки кода в init или viewdidload
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(applicationDidEnterBackgroundNotification:)
name:UIApplicationDidEnterBackgroundNotification
object:nil];
Вызывается эти 2 метода при вводе в фоновом режиме
- (void)applicationDidEnterBackgroundNotification:(NSNotification *)notification {
[self setupNowPlayingInfoCenter];
[self updateNowPlayingInfoCenter];
}