StreamRecorder

class StreamRecorder(applicationContext: Context)

An object that writes media data to a file.

Usages.

AndroidManifest.xml

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Code

var recorder = StreamRecorder(context)
if (recorder.isRecording) {
recorder.stopRecording()
} else {
recorder.attachStream(stream)
recorder.startRecording(
File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "output.mp4").toString(),
MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4
)
}

Constructors

Link copied to clipboard
constructor(applicationContext: Context)

Properties

Link copied to clipboard

Specifies the audio codec settings.

Link copied to clipboard

The isRecording value indicates whether the audio recorder is recording.

Link copied to clipboard

Specifies the video codec settings.

Functions

Link copied to clipboard
fun attachStream(stream: Stream?)

Attaches the stream.

Link copied to clipboard
@RequiresApi(value = 26)
fun startRecording(fd: FileDescriptor, format: Int)
fun startRecording(path: String, format: Int)

Starts recording.

Link copied to clipboard

Stops recording.