Created
February 8, 2018 04:58
-
-
Save SunXiaoShan/b9308380e9d854add6584fb30551ea31 to your computer and use it in GitHub Desktop.
VoiceRecognition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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