How do I stop background audio from another app?
I have tried
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
[[AVAudioSession sharedInstance] setActive:YES error:&error];
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)options
- (void)applicationWillEnterForeground:(UIApplication *) application
Got the answer from Michael Tyson of The Amazing Audio Engine over on his forum.
UInt32 allowMixing = NO; AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryMixWithOthers, sizeof (allowMixing), &allowMixing);
or if you're using The Amazing Audio Engine:
audioController.allowMixingWithOtherApps = NO;
(Seems like this should be set to NO by default depending on which audio session you use, however that was not the case with The Amazing Audio Engine)