MembraneRTC

MembraneRTC client.

The client is responsible for relaying MembraneRTC Engine specific messages through given reliable transport layer. Once initialized, the client is responsible for exchanging necessary messages via provided EventTransport passed via `ConnectOptions` and managing underlying `EndpointConnection`. The goal of the client is to be as lean as possible, meaning that all activities regarding the session such as moderating should be implemented by the user himself on top of the MembraneRTC.

The user's ability of interacting with the client is greatly limited to the essential actions such as connecting to/leaving the session, adding/removing local tracks and receiving information about remote endpoints and their tracks that can be played by the user.

User can request 3 different types of local tracks that will get forwarded to the server by the client:

  • `LocalAudioTrack` - an audio track utilizing device's microphone
  • `LocalVideoTrack` - a video track that can utilize device's camera or if necessary use video playback from a file (useful for testing with a simulator)
  • `LocalScreencast` - a screencast track capturing a device's screen using MediaProjection mechanism

It is recommended to request necessary audio and video tracks before connecting to the room but it does not mean it can't be done afterwards (in case of screencast)

Once the user created MembraneRTC client, they can call the connect method to initialize connecting to the session. After receiving `onConnected` a user will receive notification about various endpoints connecting to/leaving the session, new tracks being published and ready for playback or going inactive.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun changeWebRTCLoggingSeverity(severity: Logging.Severity)

Changes severity level of debug logs

Link copied to clipboard
fun connect(endpointMetadata: Metadata)

Tries to connect the RTC Engine. If user is accepted then onConnected will be called. In other case {@link Callbacks.onConnectError} is invoked.

Link copied to clipboard

Creates an audio track utilizing device's microphone.

Link copied to clipboard
fun createScreencastTrack(mediaProjectionPermission: Intent, videoParameters: VideoParameters, metadata: Metadata, onEnd: () -> Unit? = null): LocalScreencastTrack

Creates a screen track recording the entire device's screen.

Link copied to clipboard
fun createVideoTrack(videoParameters: VideoParameters, metadata: Metadata, captureDeviceName: String? = null): LocalVideoTrack

Creates a video track utilizing device's camera.

Link copied to clipboard
fun disableTrackEncoding(trackId: String, encoding: TrackEncoding)

Disables track encoding so that it will be no longer sent to the server.

Link copied to clipboard

Disconnects the client.

Link copied to clipboard
fun enableTrackEncoding(trackId: String, encoding: TrackEncoding)

Enables track encoding so that it will be sent to the server.

Link copied to clipboard

Returns current connection stats

Link copied to clipboard

Feeds media event received from RTC Engine to MembraneWebRTC. This function should be called whenever some media event from RTC Engine was received and can result in MembraneWebRTC generating some other media events.

Link copied to clipboard
fun removeTrack(trackId: String): Boolean

Removes an instance of local track from the client.

Link copied to clipboard
fun setEncodingBandwidth(trackId: String, encoding: String, bandwidthLimit: TrackBandwidthLimit.BandwidthLimit)

Updates maximum bandwidth for the given simulcast encoding of the given track.

Link copied to clipboard

Sets track encoding that server should send to the client library.

Link copied to clipboard

Updates maximum bandwidth for the track identified by trackId. This value directly translates to quality of the stream and, in case of video, to the amount of RTP packets being sent. In case trackId points at the simulcast track bandwidth is split between all of the variant streams proportionally to their resolution.

Link copied to clipboard
fun updateEndpointMetadata(endpointMetadata: Metadata)

Updates the metadata for the current endpoint.

Link copied to clipboard
fun updateTrackMetadata(trackId: String, trackMetadata: Metadata)

Updates the metadata for a specific track.