# roomState

Gives you access to the current state of the room - e.g. what is the layout mode or the camera and microphone status of the local user. Also the [roomStateUpdated](https://docs.digitalsamba.com/reference/sdk/events/roomstateupdated) event is being emitted if the room state changes at any point in time.

```javascript
const roomState = sambaFrame.roomState;
console.log('Current room layout mode is:', roomState.layout.mode);
```

And here is a full TypeScript definition of the room state object:

```typescript
interface RoomState {
  appLanguage: string;
  frameMuted: boolean;
  media: {
      videoEnabled: boolean;
      audioEnabled: boolean;
      activeDevices: {
         videoinput: "... camera id here...";
         audioinput: "...mic id here...";
         audiooutput: "...speakers id here...";
      }
  };
  layout: {
    mode: LayoutMode;
    showToolbar: boolean;
    toolbarPosition: 'left' | 'right' | 'bottom';
    localTileMinimized: boolean;
    contentMode?: 'maximize' | 'pin';
    content?: {
        userId: UserId;
        type: UserTileType;
    };
  };
  captionsState: {
    showCaptions: boolean;
    spokenLanguage: CaptionsSpokenLanguage;
    fontSize: CaptionsFontSize;
  };
  virtualBackground: {
    enabled: boolean;
    enforced?: boolean;
    type?: 'blur' | 'image' | 'imageUrl';
    name?: string;
    value?: string | { src: string; thumb: string; alt: string };
  };
}

* `roomState.media.<videoEnabled|audioEnabled>`. Whether local user's media is enabled.
* `roomState.layout.mode`. Current layout mode, either `auto` or `tiled`
* `roomState.layout.showToolbar`. Whether toolbar is displayed
* `roomState.layout.toolbarPosition`. Current toolbar position
* `roomState.captionsState.showCaptions`. Whether captions are displayed
* `roomState.captionsState.spokenLanguage`. Current captions spoken language string
* `roomState.captionsState.fontSize`. Current captions font size string (`small|medium|large`)
* `roomState.virtualBackground.enabled`. Whether local user has a virtual background.
* `roomState.virtualBackground.enforced`. Whether virtual background is enforced. If set to `true` user won't be able to change their VB from UI.
* `roomState.virtualBackground.type`. Type of current virtual background — `blur|image|imageUrl`
* `roomState.virtualBackground.value`. String denomination for blur (`balanced`|`strong`), url for custom image, config object for predefined images
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalsamba.com/reference/sdk/properties/roomstate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
