Skip to content

Instantly share code, notes, and snippets.

@SunXiaoShan
Created February 8, 2018 04:58
Show Gist options
  • Save SunXiaoShan/b9308380e9d854add6584fb30551ea31 to your computer and use it in GitHub Desktop.
Save SunXiaoShan/b9308380e9d854add6584fb30551ea31 to your computer and use it in GitHub Desktop.
VoiceRecognition
// Setup input source
let audioSession = AVAudioSession.sharedInstance()
do {
//try audioSession.setCategory(AVAudioSessionCategoryRecord, with: .allowBluetooth)
try audioSession.setCategory(AVAudioSessionCategoryRecord)
try audioSession.setMode(AVAudioSessionModeMeasurement)
try audioSession.setActive(true, with: .notifyOthersOnDeactivation)
} catch {
print("audioSession properties weren't set because of an error.")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment