Reputation: 103
By default, I notice that in Spritekit, if audio from another app is playing, it is automatically turned off and the audio in the app plays. How do I make it so that the opposite occurs? How do I make it so that the audio and music and sound effects in the app remain mute and external music plays?
Upvotes: 0
Views: 167
Reputation: 13127
You can use AVAudioSession
to adjust the mixing settings. There are few possible audio categories you can choose, but I think AVAudioSessionCategoryAmbient
is probably closest to what you want:
NSError *err;
AVAudioSession *session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryAmbient error:&err];
if (err) {
NSLog(@"There was a problem setting the session category: %@", error);
}
Upvotes: 3