Reputation: 59
// Access the shared, singleton audio session instance
let session = AVAudioSession.sharedInstance()
do {
// Configure the audio session for movie playback
try session.setCategory(AVAudioSessionCategoryPlayback,
mode: AVAudioSessionModeMoviePlayback,
options: [])
} catch let error as NSError {
print("Failed to set the audio session category and mode: \(error.localizedDescription)")
}
Unable to understand the use of modes in audio sessions.
Upvotes: 0
Views: 2133
Reputation: 299545
The other modes are optimized for specific usages. "Compatible" is not the same as "best." For example, when using the video chat mode:
the device’s tonal equalization is optimized for voice and the set of allowable audio routes is reduced to only those appropriate for video chat.
Upvotes: 2