MediaStream

MediaStream

Class used for handling RTCMediaStream. Helper methods are listed inside MediaStreamHelpers.

Constructor

(private) new MediaStream()

Source:

Methods

(static) addLocalMediaStreams(targetMid, roomState)

Function that sets User's Stream to send to Peer connection.

Parameters:
Name Type Description
targetMid String

The mid of the target peer

roomState SkylinkState

Skylink State of current room

Source:

(static) getStreams(roomState) → {streamList}

Function that returns all active streams including screenshare stream if present.

Parameters:
Name Type Description
roomState SkylinkState
Source:

(static) getUserMedia(state, mediaOptions) → {Promise}

Function that retrieves camera Stream.

Parameters:
Name Type Description
state SkylinkState
mediaOptions GetUserMediaOptions

The camera Stream configuration options.

Source:

(static) getUserMediaLayer(roomState, options)

Function that filters user input from getUserMedia public method

Parameters:
Name Type Default Description
roomState SkylinkState
options GetUserMediaOptions null
Source:

(static) muteStreams(roomState, options, streamId)

Function that mutes the stream.

Parameters:
Name Type Description
roomState SkylinkState
options Object
Properties
Name Type Description
audioMuted boolean
videoMuted boolean
streamId String
Source:

(static) onRemoteTrackAdded(stream, currentRoomState, targetMid, isScreensharingopt)

Function that handles the RTCPeerConnection.ontrack event on remote stream added.

Parameters:
Name Type Attributes Default Description
stream MediaStream

https://developer.mozilla.org/en-US/docs/Web/API/MediaStream

currentRoomState SkylinkState

Current room state

targetMid String

The mid of the target peer

isScreensharing boolean <optional>
false

The flag if stream is a screenshare stream.

Source:

(static) sendStream(roomState, options)

Function that sends the MediaStream object if present or mediaStream settings.

Parameters:
Name Type Description
roomState SkylinkState
options MediaStream | Object
Source:

(static) stopStreams(roomState, streamId)

Function that stops the getUserMedia() streams.

Parameters:
Name Type Description
roomState SkylinkState
streamId String

The id of the stream to stop if there is more than one getUserMedia stream.

Source: