0
Je suis nouveau développeur iOS. J'essaie de faire en sorte que les boutons lecture/pause de la barre en cours de lecture (barre inférieure de l'écran d'accueil) simulent les boutons lecture/pause de mon application. toute aide s'il vous plaît.iOS AVPlayer numéro
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback
error:nil];
[[AVAudioSession sharedInstance] setActive:YES
error:nil];
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self.player play];
UIBackgroundTaskIdentifier newTaskId = UIBackgroundTaskInvalid;
if([player play]){
newTaskId = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:NULL];
bgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^(void) {
[[UIApplication sharedApplication] endBackgroundTask: bgTask];
bgTask = UIBackgroundTaskInvalid;
}];
//Your bg code here
[[UIApplication sharedApplication] endBackgroundTask: bgTask];
bgTask = UIBackgroundTaskInvalid;