StatefulStreamMediaRecorder

A wrapper class that wraps around StreamMediaRecorder manages and tracks the internal state of the MediaRecorder used by StreamMediaRecorder.

For instance, this class helps automatically recover from MediaRecorder.MEDIA_ERROR_SERVER_DIED by releasing the current instance of streamMediaRecorder.

Parameters

streamMediaRecorder

The media recorder whose state this class is tracking.

Constructors

Link copied to clipboard
constructor(streamMediaRecorder: StreamMediaRecorder)

Properties

Link copied to clipboard

Represents the duration of the currently active recording.

Link copied to clipboard

Emits the latest MediaRecorder max amplitude reading.

Link copied to clipboard

Represents the current state of the MediaRecorder.

Link copied to clipboard

Represents the latest error state of the MediaRecorder used by StreamMediaRecorder.

Link copied to clipboard

Represents the latest info state of the MediaRecorder used by StreamMediaRecorder.

Functions

Link copied to clipboard
fun deleteRecording(recordingFile: File): Result<Unit>

Deleted the recording to the file provided by recordingFile.

Link copied to clipboard
fun release()

Releases the MediaRecorder used by StreamMediaRecorder.

Link copied to clipboard
fun startAudioRecording(context: Context, recordingFile: File): Result<Unit>

Prepares the given recordingFile and starts recording. Calling the function again after a recording has already been started will reset the recording process.

fun startAudioRecording(context: Context, recordingName: String, override: Boolean = true): Result<File>

Creates a File internally and starts recording. Calling the function again after a recording has already been started will reset the recording process.

Link copied to clipboard

Stops recording and saves the recording to the file provided by startAudioRecording.