Reputation: 1588
I have a recording session in my app that cancels background music that is playing currently.
I want this music to resume as soon as my recording session is finished. I saw that system Camera app does that as soon as you leave if you were playing music in system Music app.
I saw Snapchat app doing even better thing with continuing with playing the background music while recording. Is there a way to achieve the same goal as snapchat does?
Upvotes: 0
Views: 83
Reputation: 801
You can try the following code based on the framework you are using
[[AVAudioSession sharedInstance]
setActive:YES
withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation
error:nil];
MPMusicPlayerController *mp = [MPMusicPlayerController systemMusicPlayer];
[mp play];
Upvotes: 1