Class YSKAutoAudioSource

An audio source that automatically starts and stops audio recording by using the standard device input.

The YSKAutoAudioSource class is thread-safe, i.e., it can be accessed from different threads. Reading audio from the device input begins automatically as soon as the first listener is subscribed, and stops when all listeners unsubscribe. The YSKAutoAudioSource object is reusable, it can start and finish the process of audio recording unlimited number of times. A listener just needs to subscribe to it again. Before starting, it requests access to read data from the device input. If the user allows access, the audio source will start and begin giving data to listeners; if the user denies access, the audio source will send the YSKErrorRecordingPermissions error in the audioSource:didFailWithError: method to the listeners. Possible error codes are listed in YSKErrorCode.
This audio source uses the standard device input, so you should configure the app's audio session correctly. The YSKAudioSessionHandler class makes it easier to configure the audio session:
  • If your app uses an audio session only when working with the SpeechKit library, we recommend using this class to configure the audio session.

  • If your app uses the audio session outside the library (for audio and video playback, audio recording, and so on), you can also use this class or configure the audio session independently. If you decide to configure the audio session yourself, pay attention to the settings which may affect the operation of the audio source. They are described in the YSKAudioSessionHandler class. Unless set up properly, YSKAutoAudioSource will return the YSKErrorAudioRecording error in the audioSource:didFailWithError: method.