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:
SignalWire video room token (get one from the REST APIs)
HTML element in which to display the video stream.
Whether to apply the local-overlay on top of your video.
List of ICE servers.
A custom media stream to use in place of a camera.
Logging level.
Id of the speaker device to use for audio output. If undefined, picks a default speaker.
Whether to stop the camera when the member is muted.
Whether to stop the microphone when the member is muted.
Audio constraints to use when joining the room. Deprecated: please use the equivalent parameter in join.
Video constraints to use when joining the room. Deprecated: please use the equivalent parameter in join.
Properties
The RoomSession class has the following properties:
Whether the connection is currently active. Read-only.
The id of the video device, or null if not available. Read-only.
The label of the video device, or null if not available. Read-only.
Contains any additional devices added via addCamera, addMicrophone, or addDevice. Read-only.
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.
Provides access to the local audio MediaStreamTrack. Read-only.
Provides access to the local MediaStream. Read-only.
Provides access to the local video MediaStreamTrack. Read-only.
Provides access to the local video overlay. Use this for example to mirror the local video. Read-only.
The id of the current member within the room. Read-only.
The id of the audio input device, or null if not available. Read-only.
The label of the audio input device, or null if not available. Read-only.
The list of permissions currently available to the local member. Read-only.
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.
Provides access to the remote MediaStream. Read-only.
The unique identifier for the room. Read-only.
The unique identifier for the room session. Read-only.
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