CameraFlvFileStreamer

class CameraFlvFileStreamer(context: Context, enableAudio: Boolean = true, initialOnErrorListener: OnErrorListener? = null) : BaseCameraFileStreamer

A BaseCameraFileStreamer that sends microphone and video frames to a FLV File.

Parameters

context

application context

enableAudio

Boolean.true to capture audio. False to disable audio capture.

initialOnErrorListener

initialize OnErrorListener

Constructors

Link copied to clipboard
constructor(context: Context, enableAudio: Boolean = true, initialOnErrorListener: OnErrorListener? = null)

Properties

Link copied to clipboard
@set:RequiresPermission(value = "android.permission.CAMERA")
open override var camera: String

Get/Set current camera id.

Link copied to clipboard
open override var file: File?

Get/Set file. To set an OutputStream instead, see outputStream.

Link copied to clipboard

Access configuration helper.

Link copied to clipboard
open override var onErrorListener: OnErrorListener?

Listener that reports streamer error. Supports only one listener.

Link copied to clipboard
open override var outputStream: OutputStream?

Get/Set outputStream. outputStream will be closed on stopStream. To set an File instead, see file.

Link copied to clipboard

Access extended streamer settings.

Functions

Link copied to clipboard
@RequiresPermission(value = "android.permission.RECORD_AUDIO")
open override fun configure(audioConfig: AudioConfig)

Configures audio settings. It is the first method to call after a BaseStreamer instantiation. It must be call when both stream and audio capture are not running.

open override fun configure(videoConfig: VideoConfig)

Configures video settings. It is the first method to call after a BaseStreamer instantiation. It must be call when both stream and video capture are not running.

@RequiresPermission(value = "android.permission.RECORD_AUDIO")
open override fun configure(audioConfig: AudioConfig, videoConfig: VideoConfig)

Configures both video and audio settings. It is the first method to call after a BaseStreamer instantiation. It must be call when both stream and audio and video capture are not running.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <T> IStreamer.getStreamer(): T?

Get a streamer if it from generic class or interface

Link copied to clipboard
open override fun release()

Same as BaseStreamer.release but it also calls stopPreview.

Link copied to clipboard
Link copied to clipboard
@RequiresPermission(allOf = ["android.permission.CAMERA"])
open override fun startPreview(previewSurface: Surface, cameraId: String)
@RequiresPermission(allOf = ["android.permission.CAMERA"])
open fun startPreview(surfaceHolder: SurfaceHolder, cameraId: String = camera)
@RequiresPermission(allOf = ["android.permission.CAMERA"])
open fun startPreview(surfaceView: SurfaceView, cameraId: String = camera)
@RequiresPermission(allOf = ["android.permission.CAMERA"])
open fun startPreview(textureView: TextureView, cameraId: String = camera)

Starts audio and video capture. BaseStreamer.configure must have been called at least once.

Link copied to clipboard
@RequiresPermission(allOf = ["android.permission.WRITE_EXTERNAL_STORAGE"])
open suspend override fun startStream()

Same as BaseCameraStreamer.startStream with RequiresPermission annotation for Manifest.permission.WRITE_EXTERNAL_STORAGE.

Link copied to clipboard
open override fun stopPreview()

Stops capture. It also stops stream if the stream is running.

Link copied to clipboard
open suspend override fun stopStream()

Stops audio/video stream.