Starting with iOS 10, AVCaptureSession by default has changed the way it configures audio input on iPhones and iPads that support the Live Photos feature. This change allows taking a Live Photo without interrupting background audio playback.
However, this new AVCaptureSession audio input configuration may prevent simultaneous use of other APIs that provide audio input.
Applications using AVCaptureSession in its default configuration (usesApplicationAudioSession = YES, automaticallyConfiguresApplicationAudioSession = YES) along with other APIs providing audio input (for example, using the Remote I/O audio unit with both input and output enabled) should opt-out of the new AVCaptureSession input configuration to guarantee the same behavior as previous versions of iOS.
Applications not making use of AVCaptureSession, or using AVCaptureSession in its non-default configuration can ignore this preference. In these cases there is no change in behavior from previous versions of iOS.
There is a new AVAudioSession method called setAggregatedIOPreference:error: which allows applications using AVCaptureSession along with the AVAudioSessionCategoryPlayAndRecord category to opt-out of this new default behavior if appropriate.
Opting-out is done by setting the AVAudioSessionIOTypeAggregated preference and may be appropriate if your application makes use of AVCaptureSession along with the AVAudioSessionCategoryPlayAndRecord category and has a requirement that all audio input and output be presented in the same real-time I/O callback (for example, makes use of the Remote I/O audio unit with both input and output enabled).
- (BOOL) setAggregatedIOPreference:(AVAudioSessionIOType)inIOType error:(NSError **)outError
There are two AVAudioSessionIOType enums associated with this preference method:
- AVAudioSessionIOTypeNotSpecified - default. Applications using AVCaptureSession will get non-aggregated audio I/O. Other audio applications using AVAudioSessionCategoryPlayAndRecord category are not affected and continue to get aggregated I/O, the same behavior as previous versions of iOS.
- AVAudioSessionIOTypeAggregated - opt-out. Applications using AVCaptureSession will get aggregated audio I/O. This is the same behavior as previous versions of iOS. Other Audio applications using AVAudioSessionCategoryPlayAndRecord category are not affected.
Further reference can be found in AVAudioSession.h (iPhoneOS10.0 SDK)