An audio source that automatically starts and stops audio recording by using the standard device input.
YSKAutoAudioSourceclass 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
YSKAutoAudioSourceobject 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
YSKErrorRecordingPermissionserror in the audioSource:didFailWithError: method to the listeners. Possible error codes are listed in YSKErrorCode.
YSKAudioSessionHandlerclass makes it easier to configure the audio session:
If your app uses an audio session only when working with the
SpeechKitlibrary, 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
YSKAudioSessionHandlerclass. Unless set up properly,
YSKAutoAudioSourcewill return the
YSKErrorAudioRecordingerror in the audioSource:didFailWithError: method.