AVAudioSession AVAudioSessionCategorySoloAmbient
The default category; used unless you set a category with the setCategory:error: method.
When you use this category, audio from other apps is silenced. Your audio is silenced by screen locking and by the Silent switch (called the Ring/Silent switch on iPhone).
AVAudioSession AVAudioSessionCategorySoloAmbient example.
if (backgroundSwitch.on) {
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:NULL];
}else {
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategorySoloAmbient error:NULL];
}
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:NULL];
}else {
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategorySoloAmbient error:NULL];
}
Example of [AVAudioSession AVAudioSessionCategorySoloAmbient].
In the initWithCoder method:
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategorySoloAmbient error:NULL];
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategorySoloAmbient error:NULL];