recordDeviceAudio
Starts asynchronous recording from the device audio input.
Declaration
public func recordDeviceAudio(
_ mediaJobID: String,
audioRecordParams: STAudioRecordParams
) -> STResultOverview
Captures microphone input asynchronously and reports recording progress and completion through media events. Initialize the recorder and obtain microphone permission before starting. On iOS, a new microphone recording cannot be initiated after the app has entered the background even when background audio is enabled; a foreground-started recording may continue with appropriate configuration.
iOS Background Recording
On iOS, enabling background audio does not permit starting a new microphone recording while the application is already in the background. Begin microphone recording while the application is in the foreground. An existing recording may continue after the application enters the background when the audio session and background mode are configured appropriately.
Prerequisites
The audio recorder must be initialized and the required recording permission must be available.
Parameters
mediaJobID
Application-assigned identifier for the recording job. Related media events carry this identifier.
audioRecordParams
Recording configuration, including output-file settings, playback interaction, bookmarks, automatic stop conditions, and optional voice activity detection.
Return value
Returns .success when the request is accepted and recording starts asynchronously. It can return .audioRecorderNotInitialized or .permissionDenied before the request reaches the recorder, as well as other recording-related STResult values from the recorder.
Events
Recording progress and completion are reported through typed media events. STRecordingEventData can include position, audio duration, recorded duration, stop reason, and stop detail.