CombineEndpoint

open class CombineEndpoint(val endpointInternals: List<IEndpointInternal>) : IEndpointInternal

Combines multiple endpoints into one. This endpoint will write frames to all endpoints if they are opened.

For example, you can combine a local endpoint and a remote endpoint to record and stream at the same time.

For specific behavior like reconnecting your remote endpoint, you can create a custom endpoint that inherits from CombineEndpoint and override open, close, startStream, stopStream.

Inheritors

Constructors

Link copied to clipboard
constructor(endpointInternals: List<IEndpointInternal>)

Types

Link copied to clipboard

A MediaDescriptor that combines multiple MediaDescriptors.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Internal map of endpoint streamId to real streamIds

Link copied to clipboard
open override val info: IEndpoint.IEndpointInfo

The union of all endpoints' IEndpoint.IEndpointInfo.

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

Whether at least one endpoint is open. This is a combination of all endpoints' IEndpoint.isOpenFlow.

Link copied to clipboard
open override val metrics: Any

Throws UnsupportedOperationException because CombineEndpoint does not have metrics.

Functions

Link copied to clipboard
open override fun addStream(streamConfig: CodecConfig): Int

Registers a new stream to the IEndpointInternal.

Link copied to clipboard
open override fun addStreams(streamConfigs: List<CodecConfig>): Map<CodecConfig, Int>

Registers new streams to the IEndpointInternal.

Link copied to clipboard
open suspend override fun close()

Closes all endpoints

Link copied to clipboard

The union of all endpoints' IEndpoint.IEndpointInfo.

Gets configuration information

Link copied to clipboard
open suspend override fun open(descriptor: MediaDescriptor)

Opens the endpoints. For specific behavior like reconnecting your remote endpoint, you can override this method.

Link copied to clipboard
open override fun release()

Releases an IEndpointInternal.

Link copied to clipboard
open suspend override fun startStream()

Starts all endpoints

Link copied to clipboard
open suspend override fun stopStream()

Stops all endpoints

Link copied to clipboard
open suspend override fun write(frame: Frame, streamPid: Int)

Writes frame to all opened endpoints.