*** id: 1bffacce-32eb-4e77-9aa7-ded76b8228f1 title: RoomSession position: 2 slug: /js/reference/video/room-session max-toc-depth: 3 ---------------- 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: ```javascript const roomSession = new SignalWire.Video.RoomSession({ token: "", rootElement: document.getElementById("myVideoElement"), }); roomSession.on("member.joined", (e) => { console.log(`${e.member.name} joined`); }); roomSession.join(); ``` ### Obtaining a token The room token is obtained from the REST API from your backend server. Please refer to the [build a video application](/docs/browser-sdk/v3/js/guides/build-a-video-app#getting-a-video-room-token-using-curl) guide to learn how to obtain Video Room tokens. ## Constructor Creates a new RoomSession. Note that the room will not be joined until [join](#join) has been called. ```javascript const roomSession = new SignalWire.Video.RoomSession({ token: "", // ... }); ``` ### Parameters The RoomSession constructor accepts the following parameters: SignalWire video room token (get one from the [REST APIs](/docs/apis/video/room-tokens/create-room-token)) HTML element in which to display the video stream. Whether to apply the local-overlay on top of your video. List of [ICE servers](https://developer.mozilla.org/en-US/docs/Web/API/RTCIceServer). A custom [media stream](https://developer.mozilla.org/en-US/docs/Web/API/MediaStream) 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](/docs/browser-sdk/v3/js/reference/video/room-session/join).* Video constraints to use when joining the room. *Deprecated: please use the equivalent parameter in [join](/docs/browser-sdk/v3/js/reference/video/room-session/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](/docs/browser-sdk/v3/js/reference/video/room-session/add-camera), [addMicrophone](/docs/browser-sdk/v3/js/reference/video/room-session/add-microphone), or [addDevice](/docs/browser-sdk/v3/js/reference/video/room-session/add-device). *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](/docs/browser-sdk/v3/js/reference/video/room-session/join). *Read-only.* Provides access to the local audio [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack). *Read-only.* Provides access to the local [MediaStream](https://developer.mozilla.org/en-US/docs/Web/API/MediaStream). *Read-only.* Provides access to the local video [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/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](https://developer.mozilla.org/en-US/docs/Web/API/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](/docs/browser-sdk/v3/js/reference/video/room-session/start-screen-share). *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 *Create screen share object* *Hide muted video* *Show muted video* ## Events Events emitted by the RoomSession class.