After the iOS App finished their audio and video playback, play background music how to resume

Premise: user feedback when the songs we cut to the APP, APP will let the song is paused, the experience is not very good

Under normal circumstances we play your audio and video is an exclusive speaker:

[[AVAudioSession sharedInstance] setActive:YES error:nil];
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];

 

How to resume playing background music:

After playing their audio and video, the code sets

[[AVAudioSession sharedInstance] setActive:NO withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:nil];

Code mean to tell AVAuduio manager said: I do not have Audio service, you need to wake up other services Auduio App

 

Guess you like

Origin www.cnblogs.com/ljcgood66/p/12132973.html