StreamManager
Class that provides API for creating and managing audio and video streams.
Methods
createAudioStream
createAudioStream(config: , deviceId: string
): Promise<LocalStream>
Creates an audio stream.
Returns a promise that resolves to a LocalStream object.
Parameters
config:
Audio stream configuration
deviceId:
string
OptionalPreferred audio device id
Returns
type:
Promise<LocalStream>
createScreenSharingStream
createScreenSharingStream(config: ): Promise<LocalScreenSharingStream[]>
Creates a screen sharing stream.
Returns a promise that resolves to a LocalScreenSharingStream object.
Parameters
config:
OptionalScreen sharing configuration
Returns
type:
Promise<LocalScreenSharingStream[]>
createVideoStream
createVideoStream(config: , deviceId: string
): Promise<LocalStream>
Creates a video stream.
The specified quality in the video configuration can be lowered if the device cannot provided, or if the stream capture has already begun.
Please avoid concurrent calls of this method with DevicePermission.requestCameraPermission and getUserMedia.
Returns a promise that resolves to a LocalStream object.
Parameters
config:
Video stream configuration
deviceId:
string
OptionalPreferred video device id
Returns
type:
Promise<LocalStream>
getStream
getStream(id: string
): null | LocalStream | LocalScreenSharingStream
Returns a local audio or video stream by its id or null if there is no stream with the provided id.
Parameters
id:
string
Stream id
Returns
type:
null | LocalStream | LocalScreenSharingStream
stopStream
stopStream(id: string
): void
Stops and removes a stream by its id.
Stream stop results in closing all MediaStreamTrack associated with the stream and releasing its source (microphone, camera, or display)
After calling this method, the stream cannot be obtained by the StreamManager.getStream method.
Parameters
id:
string
Stream id
Returns
type:
void
wrapAudioStream
wrapAudioStream(stream: ):
Creates a local stream with a provided MediaStream object.
Parameters
stream:
MediaStream object
Returns
type: