rtcpool.media

class ManagedStream(stream, pool)

A class that automatically manages a MediaStream, adding its tracks to all existing peers and all peers that connect later on. This behavior will continue until this ManagedStream is closed or all tracks have ended.

ManagedStream.closed

type: Boolean

Whether this stream is closed.

ManagedStream.tracks

type: array

List of tracks in this stream.

ManagedStream.close()

Close the media stream and prevent tracks from being sent to any other peers.

ManagedStream.getConnection(stream_id)

Gets a connection by the ID of the MediaStream associated with it.

Arguments
  • stream_id (string()) – The stream to get the connection for.

Returns

ManagedConnection – The associated connection.

ManagedStream.getStream(conn_id)

Get the MediaStream associated with the given connection ID.

Arguments
  • conn_id (string()) – The ID of the connection to get the MediaStream for.

Returns

MediaStream – The MediaStream associated with the specified connection.

ManagedStream.hasStream(id)

Check if this ManagedStream has a MediaStream with the specified ID.

Arguments
  • id (string()) – The ID to check for.

Returns

Boolean – true if the stream is found, false otherwise

ManagedStream.mute(kind="null")

Mute all or some tracks in the stream.

If kind is null, all tracks will be muted. If kind is ‘video’ or ‘audio’, only tracks of the corresponding kind will be muted.

Arguments
  • kind (string()) – The kind of track to mute.

ManagedStream.muted(kind="null")

Checks if a subset of tracks are muted. If kind is null, this checks if all tracks are muted. Otherwise, checks if all tracks of the specified kind (‘video’ or ‘audio’) are muted.

Arguments
  • kind (string()) – The kind of track to check the muted state of.

Returns

Boolean – Whether the specified kind of track is muted (all tracks if kind is null).

ManagedStream.unmute(kind="null")

Unmute all or some tracks in the stream.

If kind is null, all tracks will be unmuted. If kind is ‘video’ or ‘audio’, only tracks of the corresponding kind will be unmuted.

Arguments
  • kind (string()) – The kind of track to unmute.