DefaultStreamMediaRecorder

class DefaultStreamMediaRecorder(context: Context, audioSource: Int = MediaRecorder.AudioSource.MIC, outputFormat: Int = MediaRecorder.OutputFormat.MPEG_4, audioEncoder: Int = MediaRecorder.AudioEncoder.AAC, audioSamplingRate: Int = SAMPLING_RATE_16KHZ, audioEncodingBitRate: Int = ENCODING_BIT_RATE_32KBPS, audioChannels: Int = CHANNELS) : StreamMediaRecorder

The default implementation of StreamMediaRecorder, used as a wrapper around MediaRecorder simplifying working with it.

Parameters

context

The Context necessary to prepare for recording.

Constructors

Link copied to clipboard
constructor(context: Context, audioSource: Int = MediaRecorder.AudioSource.MIC, outputFormat: Int = MediaRecorder.OutputFormat.MPEG_4, audioEncoder: Int = MediaRecorder.AudioEncoder.AAC, audioSamplingRate: Int = SAMPLING_RATE_16KHZ, audioEncodingBitRate: Int = ENCODING_BIT_RATE_32KBPS, audioChannels: Int = CHANNELS)

Functions

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

Deleted the recording to the file provided by recordingFile.

Link copied to clipboard
open override fun release()

Releases the MediaRecorder used by StreamMediaRecorder.

Link copied to clipboard
open override fun setOnErrorListener(onErrorListener: StreamMediaRecorder.OnErrorListener)

Sets an error listener.

Link copied to clipboard
open override fun setOnInfoListener(onInfoListener: StreamMediaRecorder.OnInfoListener)

Sets an info listener.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun startAudioRecording(recordingFile: File, amplitudePollingInterval: Long): 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.

open override fun startAudioRecording(recordingName: String, amplitudePollingInterval: Long, override: Boolean): 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
open override fun stopRecording(): Result<RecordedMedia>

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