AudioPreview

The AudioPreview model allows the local participant to test different capture modes and voice fonts before a conference. The model lets you set a preview recorder that records the participant's audio and plays it back. The model is supported only in SDK 3.10 and later.

Accessors

captureMode

captureMode: AudioCaptureMode

Sets and gets an audio capture mode for the audio preview.

Returns: AudioCaptureMode


status

status: AudioPreviewStatus

Sets and gets the recording status.

Returns: AudioPreviewStatus


onStatusChanged

onStatusChanged((status: AudioPreviewStatus) -> Void)?

A callback called by the SDK when the recording status changes.

Parameters:

NameTypeDescription
statusAudioPreviewStatusThe recording status.

Methods

cancel

cancel()

🚧

Deprecated

This method is deprecated in SDK 3.10.1 and replaced with the stop method.

Stops recording or playing an audio sample.

Returns: Bool


play

play(loop: boolean, completion: ((_ error: Error?) -> Void))

Plays back the recorded audio sample. To test how your audio sounds while using different capture modes and voice fonts, set the captureMode to a preferred setting before using the method.

Parameters:

NameTypeDescription
loopbooleanA boolean that indicates wether the SDK should play the recorded audio in a loop.
completion((_ error: NSError) -> Void)?The block to execute when the query completes

play

play(completion: ((_ error: Error?) -> Void))

Plays back the recorded audio sample. To test how your audio sounds while using different capture modes and voice fonts, set the captureMode to a preferred setting before using the method.

Parameters:

NameTypeDescription
completion((_ error: NSError) -> Void)?The block to execute when the query completes

record

record(duration: Int, completion: ((_ error: Error?) -> Void))

Starts recording an audio sample if no recording is in progress.

Parameters:

NameTypeDescription
durationIntThe preferred recording duration, in seconds.
completion((_ error: NSError) -> Void)?The block to execute when the query completes

record

record(completion: ((_ error: Error?) -> Void))

Starts recording an audio sample for 5 seconds if no recording is in progress.

Parameters:

NameTypeDescription
completion((_ error: NSError) -> Void)?The block to execute when the query completes

release

release()

Releases the internal memory and restarts the audio session configuration.


stop

stop()

Stops recording or playing an audio sample. This method is available in SDK 3.10.1 and later.

Returns: Bool