rtcpool.media
- class RTCStream(med_str)
Represents a media stream broadcast to all peers.
Create an RTCStream.
- Arguments
med_str (
MediaStream()
) – The MediaStream to broadcast.
- RTCStream.closed
type: Boolean
Whether this RTCStream is closed.
- RTCStream.raw
type: MediaStream
The underlying
MediaStream
that this class wraps.
- RTCStream.tracks
type: array
The array of
MediaStreamTrack
s in the stream.
- RTCStream.apply(rtc_conn)
Applies this medium to a given connection. This is used internally by
Pool()
to automatically add media to peer connections when relevant. You do not need to call it yourself, and doing so may cause undefined behavior.- Arguments
rtc_conn (
RTCPeerConnection()
) – The connection to which to add the MediaStreamTracks.
- RTCStream.close()
Closes the media stream.
- RTCStream.fromUserMedia(constraints)
Creates an RTC stream from a call to navigator.mediaDevices.getUserMedia.
- Arguments
constraints (
Object()
) – The getUserMedia constrains defining the media to be gotten.
- Returns
Promise.<RTCStream> – An RTCStream wrapping the media returned by getUserMedia.
- class BroadcastDataChannel(label, options)
Represents a data channel broadcast to all peers.
To create individual channels between endpoints, see
Pool.dataChannel()
Creates a BroadcastDataChannel with the given label and options.
- Arguments
label (
string()
) – The label to be assigned to the data channels.options (
Object()
) – The RTCDataChannel options to create channels with.
- BroadcastDataChannel.closed
type: Boolean
Whether this BroadcastDataChannel is closed.
- BroadcastDataChannel.events
type: EventTarget
The interface for all events triggered a data channel managed by this class.
Manages all standard events for RTCDataChannel.
- BroadcastDataChannel.apply(rtc_conn)
Applies this medium to a given connection. This is used internally by
Pool()
to automatically add media to peer connections when relevant. You do not need to call it yourself, and doing so may cause undefined behavior.- Arguments
rtc_conn (
RTCPeerConnection()
) – The connection to create a data channel for.
- BroadcastDataChannel.close()
Close all data channels open, and mark this broadcast channel as closed.
- BroadcastDataChannel.send(data)
Send the provided data through all open channels.