RoomSession
A RoomSession allows you to start and control video sessions.
For example, the following code joins a video session and listens for new members joining:
Obtaining a token
The room token is obtained from the REST API from your backend server.
Please refer to the Create Room Token endpoint reference to learn how to obtain Video Room tokens.
Constructor
Creates a new RoomSession. Note that the room will not be joined until join has been called.
Parameters
The RoomSession constructor accepts the following parameters:
token
SignalWire video room token (get one from the REST APIs)
rootElement
HTML element in which to display the video stream.
applyLocalVideoOverlay
Whether to apply the local-overlay on top of your video.
iceServers
List of ICE servers.
localStream
A custom media stream to use in place of a camera.
logLevel
Logging level.
speakerId
Id of the speaker device to use for audio output. If undefined, picks a default speaker.
stopCameraWhileMuted
Whether to stop the camera when the member is muted.
stopMicrophoneWhileMuted
Whether to stop the microphone when the member is muted.
audio
Audio constraints to use when joining the room. Deprecated: please use the equivalent parameter in join.
video
Video constraints to use when joining the room. Deprecated: please use the equivalent parameter in join.
Properties
The RoomSession class has the following properties:
active
Whether the connection is currently active. Read-only.
cameraId
The id of the video device, or null if not available. Read-only.
cameraLabel
The label of the video device, or null if not available. Read-only.
deviceList
Contains any additional devices added via addCamera, addMicrophone, or addDevice. Read-only.
interactivityMode
The current interactivity mode (member or audience) for the local member.
Member participants are allowed to transmit their own audio and/or video to the rest of the room (as in a typical video conference), while audience participants can only view and/or listen. See join. Read-only.
localAudioTrack
Provides access to the local audio MediaStreamTrack. Read-only.
localStream
Provides access to the local MediaStream. Read-only.
localVideoTrack
Provides access to the local video MediaStreamTrack. Read-only.
localOverlay
Provides access to the local video overlay. Use this for example to mirror the local video. Read-only.
memberId
The id of the current member within the room. Read-only.
microphoneId
The id of the audio input device, or null if not available. Read-only.
microphoneLabel
The label of the audio input device, or null if not available. Read-only.
permissions
The list of permissions currently available to the local member. Read-only.
previewUrl
If the Room has been created with the property enable_room_previews set to true, this field contains the URL to the room preview. Read-only.
remoteStream
Provides access to the remote MediaStream. Read-only.
roomId
The unique identifier for the room. Read-only.
roomSessionId
The unique identifier for the room session. Read-only.
screenShareList
Contains any local screen shares added to the room via startScreenShare. Read-only.