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 build a video application guide 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.
Methods
Join the room session
Leave the room session
Destroy the room session
Add a camera device to the room
Add a microphone device to the room
Add a media device to the room
Update the camera device
Update the microphone device
Update the speaker device
Mute the microphone
Unmute the microphone
Mute the video
Unmute the video
Stop receiving audio from the room
Resume receiving audio from the room
Get list of members in the room
Remove a member from the room
Remove all members from the room
Disconnect all members from the room
Promote audience member to member
Demote member to audience
Start recording the room
Get list of active recordings
Start streaming the room
Get list of active streams
Play media in the room
Get list of active playbacks
Start screen sharing
Set the room layout
Get available room layouts
Set position for a member in the layout
Set positions for multiple members
Get room metadata
Set room metadata
Update room metadata
Delete room metadata
Get member metadata
Set member metadata
Update member metadata
Delete member metadata
Set input volume level
Set output volume level
Set input sensitivity level
Hide video for muted members
Prioritize members with raised hands
Raise or lower hand
Set local media stream
Lock the room
Unlock the room
Send DTMF digits
Subscribe to an event
Subscribe to an event once
Unsubscribe from an event
Remove all event listeners
createScreenShareObject
Create screen share object
hideVideoMuted
Hide muted video
showVideoMuted
Show muted video