VideoOnlyDualStreamer

class VideoOnlyDualStreamer(context: Context, firstEndpointFactory: IEndpointInternal.Factory = DynamicEndpointFactory(), secondEndpointFactory: IEndpointInternal.Factory = DynamicEndpointFactory(), defaultRotation: Int = context.displayRotation) : IDualStreamer, IVideoDualStreamer

A ISingleStreamer implementation for video only (without audio).

Parameters

context

the application context

firstEndpointFactory

the IEndpointInternal.Factory implementation of the first output. By default, it is a DynamicEndpointFactory.

secondEndpointFactory

the IEndpointInternal.Factory implementation of the second output. By default, it is a DynamicEndpointFactory.

defaultRotation

the default rotation in Surface rotation (Surface.ROTATION_0, ...). By default, it is the current device orientation.

Constructors

Link copied to clipboard
constructor(context: Context, firstEndpointFactory: IEndpointInternal.Factory = DynamicEndpointFactory(), secondEndpointFactory: IEndpointInternal.Factory = DynamicEndpointFactory(), defaultRotation: Int = context.displayRotation)

Properties

Link copied to clipboard

First output of the streamer.

Link copied to clipboard
open override val isOpenFlow: StateFlow<Boolean>

Returns true if output is opened. For example, if the streamer is connected to a server if the endpoint is SRT or RTMP.

Link copied to clipboard

Whether the video source has a preview.

Link copied to clipboard
open override val isStreamingFlow: StateFlow<Boolean>

Returns true if stream is running.

Link copied to clipboard

Second output of the streamer.

Link copied to clipboard
open override val throwableFlow: StateFlow<Throwable?>

Returns the last throwable that occurred.

Link copied to clipboard
open override val videoSourceFlow: StateFlow<IVideoSource?>

A video source flow to access to advanced settings.

Functions

Link copied to clipboard
open suspend override fun close()

Closes the streamer endpoint.

Link copied to clipboard
open suspend override fun release()

Clean and reset the streamer.

Link copied to clipboard

Clean and reset the streamer synchronously.

Link copied to clipboard

Sets activity result from ComponentActivity.registerForActivityResult callback.

Link copied to clipboard
@RequiresPermission(value = "android.permission.CAMERA")
suspend fun IWithVideoSource.setCameraId(cameraId: String)

Sets the camera id.

Link copied to clipboard
suspend fun IWithVideoSource.setPreview(surface: Surface)

Sets the preview surface.

suspend fun IWithVideoSource.setPreview(surfaceHolder: SurfaceHolder)

Sets a preview surface holder.

suspend fun IWithVideoSource.setPreview(surfaceView: SurfaceView)
suspend fun IWithVideoSource.setPreview(textureView: TextureView)

Sets a preview surface.

Link copied to clipboard
open suspend override fun setTargetRotation(rotation: Int)

Sets the target rotation.

Link copied to clipboard
open suspend override fun setVideoConfig(videoConfig: DualStreamerVideoConfig)

Configures only video settings.

Link copied to clipboard
open suspend override fun setVideoSource(videoSourceFactory: IVideoSourceInternal.Factory)

Sets the video source.

Link copied to clipboard

Starts video preview.

suspend fun IWithVideoSource.startPreview(surface: Surface)
@RequiresPermission(value = "android.permission.CAMERA")
suspend fun IWithVideoSource.startPreview(surfaceHolder: SurfaceHolder)
@RequiresPermission(value = "android.permission.CAMERA")
suspend fun IWithVideoSource.startPreview(surfaceView: SurfaceView)
@RequiresPermission(value = "android.permission.CAMERA")
suspend fun IWithVideoSource.startPreview(textureView: TextureView)

Sets preview surface and start video preview.

Link copied to clipboard
open suspend override fun startStream()

Starts audio/video stream.

Link copied to clipboard

Stops video preview.

Link copied to clipboard
open suspend override fun stopStream()

Stops audio/video stream.