> This is part 1 of 2 of the full documentation (pages 1–100 of 137).
> The content is paginated: fetch every part to see all of it.
> Next part: https://docs.whereby.com/llms-full.txt/1
> Page index: https://docs.whereby.com/llms.txt

# Welcome to Whereby Embedded

Whereby Embedded is the easiest way to add video calls to your web page or mobile app. Get up and running in minutes, not months, so you're free to focus on what you do best — your business.

### Create your video experience

{% columns %}
{% column %}
**🚀 Start here**

* [Overview of Whereby Embedded](/getting-started/overview-of-whereby-embedded)
* [Set up your Embedded account](/getting-started/overview-of-whereby-embedded/initial-setup)<br>
  {% endcolumn %}

{% column %}
**🌐 Build for web**

* [Web component & Pre-built UI](/whereby-for-web-browser/web-component-and-pre-built-ui)
* [Web app quickstart](/whereby-for-web-browser/web-component-and-pre-built-ui/web-app-quickstart)
  {% endcolumn %}
  {% endcolumns %}

{% columns %}
{% column %}
**📱 Mobile app integration**

* [Android](/whereby-for-mobile-development/whereby-for-android)
* [iOS](/whereby-for-mobile-development/whereby-for-ios)
  {% endcolumn %}

{% column %}
**⚙️ Advanced / custom setups**

* [React-based Browser SDK](/whereby-for-web-browser/react-based-browser-sdk)
* [Whereby Core SDK](/reference/core-sdk-reference)
  {% endcolumn %}
  {% endcolumns %}

***

### Further resources

* Join our [Discord developer community](https://discord.com/invite/uWRcPWbGJB) to collaborate and find answers.
* ﻿﻿Design a better, faster video call experience with our [Figma Video Call Ul Kit](https://www.figma.com/community/file/1411023646481069706/video-call-ui-kit-by-whereby).
* ﻿﻿Consult our [End User Support Center](/end-user/end-user-support-guides) for product help.


# Overview of Whereby Embedded

With Whereby Embedded, you can add video calls and conferencing to your website quickly and easily.

[Whereby Embedded](https://whereby.com/information/embedded) consists of a network of signaling, STUN, and media servers that you can use as a service.

Other advantages include:

* **Ease of use**: Customers and partners don’t need to sign up for an account to join a meeting.
* **Integrated**: Whereby is embedded right inside your website or app, meaning that you don’t need to install a separate solution for video calls.
* **Mobile compatibility**: Whereby is a solution that not only works well on desktop, but on mobile browsers, too.
* **Fully customizable**: You can easily swap out logos, color schemes, and style and lay out your Whereby experience however you want.
* **Ease of testing**: You don’t need to provide a credit card to test or evaluate Whereby.
* **Private and compliant**: Whereby Embedded is GDPR compliant, ISO 27001 certified and can be implemented to meet HIPAA compliance.
* **Proven track record**: Whereby is a leader in key industry verticals, such as Telehealth and e-Learning.

Whereby is also transparent on pricing. You can [compare our plan types](https://whereby.com/information/embedded/pricing), or use our [rate calculator](https://whereby.com/information/embedded/rate-calculator) to estimate the monthly cost of a custom plan.

### What can you do with Whereby Embedded?

Whereby Embedded has two main usage models:

* The [web component and pre-built UI](/whereby-for-web-browser/web-component-and-pre-built-ui) can be embedded in a web app (and native apps via a WebView), giving you a working video calling system in minutes. The web component supports both desktop and mobile browsers. This solution provides full access to all Whereby [product features](/whereby-product-features/using-the-rest-api), plus styling and customization options to make it suitable for most customer needs. **We recommend that all customers start with the web component.**
* Customers who require a fully customizable setup should check out our [Whereby Browser SDK](/whereby-for-web-browser/react-based-browser-sdk). These allow you to develop a web app suited to your exact needs.
* If you want to integrate Whereby into [Android](/whereby-for-mobile-development/whereby-for-android) and [iOS](/whereby-for-mobile-development/whereby-for-ios) apps, we've got guides to help you out.

Whereby Embedded has all the essential [product features](/whereby-product-features/using-the-rest-api) you’d expect from a video calling system, including file sharing, captions, recording and transcribing, screen sharing, breakout rooms, and more. These features can be configured and controlled by a combination of API calls, global dashboard settings, and individual app settings.

### Next steps

To get started with Whereby Embedded, run through our [initial setup steps](/getting-started/overview-of-whereby-embedded/initial-setup), then head over to our [web app quickstart](/whereby-for-web-browser/web-component-and-pre-built-ui/web-app-quickstart) to see how quick it is to get Whereby Embedded up and running.


# Initial setup

Follow these steps below to set up your Whereby Embedded account!

{% hint style="success" %}
These steps are essential for anyone using Whereby Embedded, whether you are using the [web component and prebuilt UI](/whereby-for-web-browser/web-component-and-pre-built-ui), the [Whereby Browser SDK](/whereby-for-web-browser/react-based-browser-sdk), or another solution.
{% endhint %}

### 1. Sign up for an Embedded account

To start with, sign up for a Whereby Embedded account:

1. Go to the ['Choose your Embedded' plan](https://whereby.com/information/embedded/select-plan) page.
2. Choose the Free plan for now. This gives you everything you need to test out the product; you can always upgrade your plan later on when you start implementing a production app.
3. Follow the steps to create an account.

{% hint style="info" %}
Note that Whereby has another product — [Whereby Meetings](https://whereby.com/information/meetings) — which provides you with static meeting rooms accessed through the Whereby website that you can use to meet friends, colleagues, and customers. Whereby Meetings has no access to our API or webhooks.
{% endhint %}

### 2. Generate an API key

From your account dashboard, go to “**Configure**” → “**API**” section. Under the **API keys** portion, click the **Generate key** button to create a new key.

Here you will be prompted to name your key and set an expiration date. You can choose between: 7 days, 30 days, 90 days, or Never. When you're done generating your new key, click **Save**.

<div align="left"><figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FBAUKulEsa4tEM3yF7p7P%2FAPIkey.png?alt=media&amp;token=da4c0226-8d60-4b4e-825d-b72f4e163b49" alt="" width="563"><figcaption></figcaption></figure></div>

Your API key is only displayed once. Copy the key and save it to your secrets manager. You'll need it to send requests to our REST API.

### 3. Create a meeting room

Before you can create an embedded Whereby app, you need to create a meeting room. This is a key entity in the Whereby architecture — an app is passed a specific meeting room URL to join that meeting, and you can configure each meeting as required. Meeting room options include setting the number of participants, the end date of the meeting, whether it will be recorded or streamed, and more.

There are a couple of different ways to create a meeting room:

* **Via your account dashboard**: Go to the **Rooms** screen, click the **Create room** button, and follow the steps to create your room. You can choose the defaults on most screens, but you’ll need to choose an end date for your meeting on the final options screen.
* **Via our /**[**meetings**](/reference/whereby-rest-api-reference/meetings) **API endpoint**: The request has the following requirements:
  * It must be sent to `https://api.whereby.dev/v1/meetings`.
  * It must be authenticated using Bearer Token authentication. Send your API key as part of the [`Authorization`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Authorization) header.
  * It must be a [`POST`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Methods/POST) request with a body containing a valid JSON string ([`Content-Type`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Type)`: application/json`). There are many [options](/reference/whereby-rest-api-reference/meetings) you can include in the JSON, but at the very least, it must contain an `endDate` field.

{% hint style="info" %}
**Which creation method should I use?**

At this point in your journey, it doesn’t matter. In our quickstarts and starter guides, we’ll assume you are providing a static room URL, and your app will join the same room every time.

However, in a production app, you will likely want to allow different users or customers to create rooms dynamically. They probably don’t want to all share the same room. For this reason, we’d recommend getting used to using the API call method.
{% endhint %}

The following cURL example shows a minimal meeting room request (replace `YOUR-API-KEY` with the API key you generated in the previous step), which you can enter into your terminal/command line to create a meeting room:

```
curl https://api.whereby.dev/v1/meetings \
  --header "Authorization: Bearer YOUR-API-KEY" \
  --header "Content-Type: application/json" \
  --request POST \
  --data '{
    "endDate": "2099-07-01T10:01:32.041Z",
    "roomMode": "group",
    "fields": [
      "hostRoomUrl"
    ]
  }'
```

{% hint style="info" %}
**Note**: If you don’t have cURL available on your machine, you can generate the HTTP request using a different app, such as [Postman](https://docs.whereby.com/whereby-101/using-the-rest-api/using-postman).
{% endhint %}

{% hint style="info" %}
**Note**: While not mandatory for a valid API request, we've included the following data fields, as they are very useful to become familiar with early on:

* `roomMode` allows you to specify the capacity of the room you are creating. The default value, `normal`, allows up to 4 people to join the meeting. Setting `roomMode` to `group` allows more than 4 people to join.
* `fields.hostRoomUrl` causes a host URL to be provided in the response. Joining via this URL allows you to join the room as a host. See [User roles & Meeting Permissions](/whereby-product-features/user-roles-and-privileges) for more details of host privileges.
  {% endhint %}

#### Getting the meeting room URL

Getting the meeting room URL to provide to your app depends on how you created the meeting room.

* If you created it via your account dashboard, you’ll see a list of the currently active rooms on the **Rooms** screen. To get the URL, click on the “link” icon on your room row, then click **Copy participant link**.
* If you create it via an API call, the response will contain a JSON string along the following lines:<br>

  ```json
  {
    "startDate":"2025-08-06T19:37:21.658Z",
    "endDate":"2099-07-01T10:01:32.041Z",
    "roomName":"/50041254-faca-4e6b-b551-d36e79ea4987",
    "roomUrl":"https://my-company.whereby.com/50041254-faca-4e6b-b551-d36e79ea4987",
    "meetingId":"107585562",
    "hostRoomUrl":"https://my-company.whereby.com/50041254-faca-4e6b-b551-d36e79ea4987?roomKey=..."
  }
  ```

  \
  You need to copy the `roomUrl` field value.

#### Which creation method should I use?

At this point in your journey, it doesn’t matter. In our quickstarts and starter guides, we’ll assume you are providing a static room URL, and your app will join the same room every time.

However, in a production app, you will likely want to allow different users or customers to create rooms dynamically. They probably don’t want to all share the same room. For this reason, we’d recommend getting used to using the API call method.

### Next steps

Now that you’re set up, we'd recommend creating an embedded Whereby app using the [prebuilt web component](/whereby-for-web-browser/web-component-and-pre-built-ui/web-app-quickstart).


# Pre-built UI vs. React-based Browser SDK

Choosing the right integration path

Choosing how to integrate Whereby depends on how much control you need over the experience. Most teams can get up and running quickly using our pre-built UI, while the React-based Browser SDK is available for more advanced, fully customized use cases.

### Choose the right approach

{% columns %}
{% column %}
**🚀 Pre-built UI (Recommended)**

Fastest way to add video calls to your product using our ready-made interface.

* Minimal setup required
* Built-in UI and user experience
* Customize with attributes & parameters
  {% endcolumn %}

{% column %}
**🛠 React-based Browser SDK**

Flexible toolkit for building a fully custom video experience using React.

* Requires more development effort
* Full control over UI and workflows
* Compose your own interface and logic
  {% endcolumn %}
  {% endcolumns %}

***

### Compare the options

* Start with the **pre-built UI** if your goal is to launch quickly and meet standard video calling needs.
* Choose the **React-based Browser SDK** if you have specific customization requirements that go beyond the pre-built experience.
* In most cases, teams find that the **pre-built UI** meets their needs, especially with the available configuration options, without requiring a fully custom implementation.

***

### Get started

{% columns %}
{% column %}
**🚀 Start with pre-built UI**

* [Web component & pre-built UI](/whereby-for-web-browser/web-component-and-pre-built-ui)
  {% endcolumn %}

{% column %}
**🛠 Explore the SDK**

* [React-based Browser SDK](/whereby-for-web-browser/react-based-browser-sdk)
  {% endcolumn %}
  {% endcolumns %}


# Web component & pre-built UI

The quick way to get up and running with Whereby is using our web component & pre-built UI

The [Web Component](/reference/using-the-whereby-embed-element) included in our SDK will allow you to embed a Whereby room in any webpage. It allows you to leverage the thoughtfully designed, pre-built Whereby interface and user experience we've developed over the last 10+ years.

### Get started

#### 🚀 Quickstart

* [Start here if you've not built an embedded web app before](/whereby-for-web-browser/web-component-and-pre-built-ui/web-app-quickstart)

#### ⚙️ Configuration

* [Configuring with attributes](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes)
* [Using commands](/whereby-for-web-browser/web-component-and-pre-built-ui/using-commands)
* [Using events](/whereby-for-web-browser/web-component-and-pre-built-ui/using-whereby-events)

#### 🏁 Deploy

* [Deployment to your own site](/whereby-for-web-browser/web-component-and-pre-built-ui/quickly-deploy-whereby-to-your-domain)
* [Embed with low code](/whereby-for-web-browser/web-component-and-pre-built-ui/embed-with-low-code)

***

### Further resources

* [Product features](/whereby-product-features/using-the-rest-api)
* [Web component reference](/reference/using-the-whereby-embed-element)
* [Full customization with React-based SDK](/whereby-for-web-browser/react-based-browser-sdk)


# Web app quickstart

## Prerequisites

This guide assumes that you’ve already created a Whereby Embedded account and a meeting room to join with your web app. If you’ve not already taken these steps, you can do so by following the [Whereby Embedded initial setup guide](/getting-started/overview-of-whereby-embedded/initial-setup).

## Setting up the app

Our sample app uses vanilla HTML, CSS, and JavaScript. You can create your own sample files to follow along with the tutorial or download our [web app starter template](https://github.com/whereby/demos/tree/main/webapp-template) to use as a starting point.

{% hint style="info" %}
**Note**: You can also find our [finished web component quickstart web app](https://github.com/whereby/demos/tree/main/web-component-quickstart) on GitHub.
{% endhint %}

## Using the component

The prebuilt web component is available as part of the [Whereby Browser SDK](https://www.npmjs.com/package/@whereby.com/browser-sdk), published on npm. You can include it in your app via a package manager, such as npm or yarn, and install instructions can be found [here](/whereby-for-web-browser/react-based-browser-sdk/quick-start).

### Install methods

To install the web component, there are different methods that can be used. You can either use a `<script>` element, import via the package manager, or by importing the SDK.

#### Using a \<script> element

For simple apps like this one, however, a package manager can be overkill. You can also include it via a `<script>` element with the source set to point to our CDN.

Add the following to the `<head>` of your HTML document:

```html
<script src="https://cdn.srv.whereby.com/embed/v3-embed.js" type="module">
</script>
```

#### Using a package manager

When using React or a bundler like Webpack, Rollup, Parcel, etc., you can install the Whereby Browser SDK in your project using npm:

```bash
npm install @whereby.com/browser-sdk
```

#### Importing the SDK

With the browser SDK included in your project, you can then import it as follows:

```javascript
import "@whereby.com/browser-sdk/embed"
```

### How to use

After installation, add the following to your HTML document’s `<body>`, substituting `YOUR-ROOM-URL` for the room URL you obtained in the initial setup guide:

```html
<whereby-embed
  room="YOUR-ROOM-URL">
</whereby-embed>
```

{% hint style="info" %}
**Note**: You can use a `hostRoomUrl` instead of the `roomUrl`, if you want to give the user [host privileges](/whereby-product-features/user-roles-and-privileges#hosts).
{% endhint %}

To ensure the component fits the page, we’ll set it to fill the entire viewport for now. Add the following rules to your web app’s CSS:

```css
:root {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body,
whereby-embed {
  height: inherit;
  margin: inherit;
}
```

Load your sample app in a web browser. You should see the Whereby interface appear, allowing you to enter your name and join the meeting room.

## Customizing your app

Now that you’ve got a basic app running, you’ll want to customize it to your liking. Whereby’s web component has many options for customizing your app:

* [Global settings](/whereby-product-features/dashboard-preferences) via your account dashboard.
* Per-room settings via component [attributes](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes) and [room creation settings](/whereby-product-features/using-the-rest-api).
* Creating custom behavior and controls using [commands](/whereby-for-web-browser/web-component-and-pre-built-ui/using-commands) and [events](/whereby-for-web-browser/web-component-and-pre-built-ui/using-whereby-events).

Our next steps are to explore a couple of the customization options that Whereby has to offer. Subsequent sections will explain all the options in full.

### Setting custom brand colors

1. In your account dashboard: Go to the **Configure** screen and access the **Appearance** section.
2. Set new primary, secondary, and focus highlight colors.
3. Set a new background color, and upload a background image.
4. Upload a company logo.
5. Reload your sample app to see how these settings change the look and feel.

### Setting web component attributes

There are many different attributes you can set on the web component to configure various aspects of the video call experience. Let's set a couple now. Update the component as follows:

```html
<whereby-embed
  room="YOUR-ROOM-URL"
  cameraEffect="blur"
  minimal="on"
  logo="off">
</whereby-embed>
```

The effect of the [attributes](/reference/using-the-whereby-embed-element#attributes-of-the-component) is as follows:

* `cameraEffect="blur"`: Sets a blur effect on the camera background by default.
* `minimal="on"`: Uses the minimal Whereby UI.
* `logo="off"`: Hides the company logo.

Save your code and reload your app to see the effect of the attributes.

You’ve just built a working video calling app with Whereby Embedded and customized it with your own branding and layout. Next, we'll explore advanced options like event handling and custom controls.

## See also

* [Meeting controls](https://whereby.frontkb.com/en/categories/1013762-meeting-controls)


# Configuring with attributes

This article takes an in-depth look at the attributes available to the `<whereby-embed>` element. These allow you to customize the meeting experience for each user after the room has been created, for example, by enabling and disabling Whereby functionality, setting user avatars and room backgrounds, and more.

{% hint style="info" %}
Note that the attributes are *only* compatible with Whereby's web component and pre-built UI and will not work with the React Hooks SDK.
{% endhint %}

### Prerequisites

This guide assumes that you’ve already created a Whereby Embedded account and a meeting room, and have joined it by adding the `<whereby-embed>` component to a web app.

* If you’ve not created a Whereby Embedded account and a meeting room, you can do so by following the [Whereby Embedded initial setup guide](/getting-started/overview-of-whereby-embedded/initial-setup).
* If you've not created a video call web app using `<whereby-embed>`, you can clone our [finished pre-built component quickstart web app](https://github.com/whereby/demos/tree/main/web-component-quickstart) from GitHub, or you can build the app yourself by following our [Web app quickstart](/whereby-for-web-browser/web-component-and-pre-built-ui/web-app-quickstart).

### Getting started

1. To begin with, open your web app in your web browser and your code editor.
2. Have a look at the following `<whereby-embed>` example, which features several attributes:<br>

   ```html
   <whereby-embed
     room="YOUR-ROOM-URL"
     cameraEffect="blur"
     minimal="on"
     logo="off">
   </whereby-embed>
   ```

   \
   These attributes respectively specify which room you want to connect to (`YOUR-ROOM-URL` should be your room URL), automatically add the "blur" camera effect to the user's video, enable the minimal pre-built UI, and hide the user's company logo.
3. If you're using the pre-built component quickstart web app, the last three attributes should already be present. If not, you'll have to add them yourself.
4. Add and remove them a few times, refreshing the browser tab where the app is loaded each time so you can see the difference the attributes make.

### Adding an avatar image

To add an avatar image for a user, follow these steps:

1. Upload an appropriate avatar image to an online location. The URL must be `https` and contain no URL parameters.
2. From your account dashboard, go to "**Configure**" > "**API**". Under the **Allowed domains** panel, add both the domain where you uploaded the avatar image, and the domain where your web app is running, separated by a space. In general, these must be `https`, but `http://localhost` domains are allowed for testing purposes.
3. Press the `Save` button that appears under the text field.
4. Add the following attribute to your `<whereby-embed>` element, replacing `YOUR-AVATAR-URL` with the URL of your avatar image:<br>

   ```html
   avatarUrl="YOUR-AVATAR-URL"
   ```
5. Refresh your app to see your avatar in action. You should be able to see it next to your name in the **People** panel within the meeting room.

### Enabling some features

The `minimal` setting has hidden too many features. Let's re-enable the **Leave** and **Chat** controls.

1. Add the following attributes to your `<whereby-embed>` element:<br>

   ```html
   leaveButton="on"
   chat="on"
   ```
2. Refresh your app: you should see that the **Leave** and **Chat** controls have been added back in.

### Hiding the toolbar altogether

For the final customization, we'll take a step in the opposite direction and hide the bottom toolbar completely.

1. Add the following attributes to your `<whereby-embed>` element:<br>

   ```
   bottomToolbar="off"
   ```
2. Refresh your app: The bottom toolbar should have disappeared, and the rest of the UI should have expanded to fill the space.

We have done this to set the scene for our [Using commands](/whereby-for-web-browser/web-component-and-pre-built-ui/using-commands) article, in which we use commands to create our own custom toolbar.

{% hint style="info" %}
**Note**: You can find our [finished web component quickstart web app](https://github.com/whereby/demos/tree/main/web-component-quickstart) with attributes example on GitHub.
{% endhint %}

### See also

[Attribute reference](/reference/using-the-whereby-embed-element#attributes-of-the-component): contains a table detailing every available attribute.


# Using commands

Now that you've mastered attributes, let's move onto using custom commands!

The `<whereby-embed>` web component exposes a set of methods your application can invoke to perform actions in the room. This is ideal for implementing custom controls for your Whereby component-based video call functionality. In this article, we'll show you how to recreate the bottom toolbar, which we hid at the end of the [Configuring with attributes](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes) guide.

### Prerequisites

This guide assumes that you’ve already created a Whereby Embedded account and a meeting room, and have joined it by adding the `<whereby-embed>` component to a web app.

* If you’ve not created a Whereby Embedded account and a meeting room, you can do so by following the [Whereby Embedded initial setup guide](/getting-started/overview-of-whereby-embedded/initial-setup).
* If you've not created a video call web app using `<whereby-embed>`, you can clone our [finished web component quickstart web app with attributes](https://github.com/whereby/demos/tree/main/web-component-with-attributes) on GitHub.

### Getting started

1. Open your example web app in your browser and your code editor.
2. If you're using your own example, make sure you've got the `bottomToolbar="off"` attribute set on your `<whereby-embed>` attribute.
3. From your account dashboard, go to "**Configure**" > "**API**". Under the **Allowed domains** panel, add the domain where your web app is running. In general, this must be `https`, but `http://localhost` domains are allowed for testing purposes. **Your app domain&#x20;*****must*****&#x20;be present here; otherwise, the Whereby commands will not work.**
4. Press the `Save` button that appears under the text field.

### Adding control buttons

In this article, we are going to re-implement our own custom versions of the Camera, Microphone, Chat, People, and Leave controls. The first thing we need to achieve this is an HTML button bar.

Add the following HTML snippet to your document, above the `<whereby-embed>` element:

```html
<section id="button-bar">
  <button id="camera">Mute video</button>
  <button id="mic">Mute audio</button>
  <button id="chat">Show chat</button>
  <button id="people">Show people</button>
  <button id="leave">Leave meeting</button>
</section>
```

### Styling the button bar

Let's give our buttons some style.

1. Add the following CSS to your stylesheet to make sure the `<body>` element spans the full height of the screen, but the `<whereby-embed>` element leaves a gap at the bottom to make space for the button bar. If you are starting from our finished web component quickstart web app with attributes example, you'll also want to remove the current CSS rule that targets `body` and\
   `whereby-embed`.<br>

   ```css
   body {
     height: inherit;
     margin: inherit;
   }

   whereby-embed {
     height: calc(100% - 30px);
     margin: inherit;
   }
   ```
2. Next, add the following rule to place the button bar in the gap at the bottom of the screen, center the buttons, and get things looking neat:<br>

   ```css
   #button-bar {
     position: absolute;
     bottom: 0;
     width: 100%;
     background-color: black;
     padding: 10px 0;
     display: flex;
     justify-content: center;
     gap: 20px;
   }
   ```

### Adding button functionality

Now we'll get our buttons working.

1. Add the following line to the bottom of your HTML `<head>`:<br>

   ```html
   <script defer src="index.js"></script>
   ```
2. Create an `index.js` file in your app directory and add the following statements to grab references to your control buttons and the `<whereby-embed>` element:<br>

   ```javascript
   const cameraBtn = document.getElementById("camera");
   const micBtn = document.getElementById("mic");
   const chatBtn = document.getElementById("chat");
   const peopleBtn = document.getElementById("people");
   const leaveBtn = document.getElementById("leave");
   const whereby = document.querySelector("whereby-embed");
   ```
3. Add the following event handler functions to perform the expected actions when you press those buttons:

{% code overflow="wrap" %}

```javascript
cameraBtn.addEventListener("click", () => {
  whereby.toggleCamera();
  cameraBtn.textContent === "Mute video" ? cameraBtn.textContent = "Unmute video" : cameraBtn.textContent = "Mute video";
});

micBtn.addEventListener("click", () => {
  whereby.toggleMicrophone();
  micBtn.textContent === "Mute audio" ? micBtn.textContent = "Unmute audio" : micBtn.textContent = "Mute audio";
});

chatBtn.addEventListener("click", () => {
  whereby.toggleChat();
  chatBtn.textContent === "Show chat" ? chatBtn.textContent = "Hide chat" : chatBtn.textContent = "Show chat";
});

peopleBtn.addEventListener("click", () => {
  whereby.togglePeople();
  peopleBtn.textContent === "Show people" ? peopleBtn.textContent = "Hide people" : peopleBtn.textContent = "Show people";
});

leaveBtn.addEventListener("click", () => {
  whereby.leaveRoom();
  window.location.href = "https://whereby.com";
});
```

{% endcode %}

{% hint style="info" %}
**Note**: You can find our [finished web component quickstart web app with commands](https://github.com/whereby/demos/tree/main/web-component-with-commands) example on GitHub.
{% endhint %}

### See also

* [Command reference](/reference/using-the-whereby-embed-element#sending-commands): contains a table detailing every available event.


# Using Whereby events

Now that you've mastered using custom commands, let's move onto events!

The `<whereby-embed>` web component fires custom events that allow your application to respond to real-time changes in the meeting room. This enables you to create dynamic user interfaces, provide helpful feedback, and implement custom behaviors based on what's happening during the video call.

In this article, we'll show you how to enhance your custom controls with event-driven features, like participant counters and connection status indicators.

### Prerequisites

This guide assumes that you've already created a Whereby Embedded account and a meeting room, and have joined it by adding the `<whereby-embed>` component to a web app.

* If you've not created a Whereby embedded account and a meeting room, you can do so by following the [Whereby Embedded initial setup guide](/getting-started/overview-of-whereby-embedded/initial-setup).
* If you've not built custom controls for your video call web app, you can clone our [finished web component quickstart web app with commands](https://github.com/whereby/demos/tree/main/web-component-with-commands) on GitHub.

### Getting Started

Event listeners allow your application to react to changes in the meeting room without constantly checking the room's state. This is essential for creating responsive user interfaces that provide real-time feedback to users. For example, you can update participant counts as people join and leave, show connection quality indicators, or display helpful messages when users encounter issues.

Open your existing web app with custom controls in your browser and code editor. We'll be building on the button bar you created in the [commands](/whereby-for-web-browser/web-component-and-pre-built-ui/using-commands) tutorial to add dynamic status indicators and user feedback.

### Adding a Status Bar

First, let's add a status bar above your existing button bar to display real-time information about the meeting.

Add the following HTML snippet to your document, above the existing `#button-bar`:

```html
<section id="status-bar">
  <div id="participant-count">Participants: 0</div>
  <div id="connection-status">Connection: Good</div>
  <div id="notification"></div>
</section>
```

### Styling the Status Bar

Let's style the new status bar and adjust the existing layout to accommodate it.

First, update your existing CSS rules to make room for both bars:

{% code expandable="true" %}

```css
whereby-embed {
  height: calc(100% - 80px); /* Increased from 30px to accommodate both bars */
  margin: inherit;
}

#button-bar {
  position: absolute;
  bottom: 0;
  width: 100%;
  background-color: black;
  padding: 10px 0;
  display: flex;
  justify-content: center;
  gap: 20px;
}
```

{% endcode %}

Now, add styling for the status bar:

{% code expandable="true" %}

```css
#status-bar {
  position: absolute;
  bottom: 50px; /* Position above the button bar */
  width: 100%;
  background-color: #333;
  color: white;
  padding: 10px 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  font-size: 14px;
}

#notification {
  background-color: #007bff;
  padding: 5px 10px;
  border-radius: 4px;
  min-height: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#notification.show {
  opacity: 1;
}

.connection-good { color: #28a745; }
.connection-unstable { color: #ffc107; }
.connection-offline { color: #dc3545; }
```

{% endcode %}

### Implementing Participant Counter

Now let's add JavaScript to track participants in real-time. Add the following code to your existing `index.js` file:

{% code expandable="true" %}

```javascript
// Add these references alongside your existing button references
const participantCounter = document.getElementById("participant-count");
const connectionStatus = document.getElementById("connection-status");
const notification = document.getElementById("notification");

// Track participant count
whereby.addEventListener("participantupdate", (event) => {
  const count = event.detail.count;
  participantCounter.textContent = `Participants: ${count}`;
  
  // Show notification when someone joins or leaves
  if (count > 1) {
    showNotification(`${count} people in meeting`);
  }
});

// Welcome new participants
whereby.addEventListener("participant_join", (event) => {
  showNotification("Someone joined the meeting!");
});

whereby.addEventListener("participant_leave", (event) => {
  showNotification("Someone left the meeting");
});
```

{% endcode %}

### Adding Connection Status Monitoring

Connection quality is crucial for video calls. Let's add a connection status indicator that updates in real-time:

{% code expandable="true" %}

```javascript
// Monitor connection status
whereby.addEventListener("connection_status_change", (event) => {
  const status = event.detail.status;
  
  // Remove existing connection classes
  connectionStatus.className = "";
  
  switch(status) {
    case "stable":
      connectionStatus.textContent = "Connection: Good";
      connectionStatus.classList.add("connection-good");
      break;
    case "unstable":
      connectionStatus.textContent = "Connection: Unstable";
      connectionStatus.classList.add("connection-unstable");
      showNotification("Connection is unstable - check your internet");
      break;
    case "offline":
      connectionStatus.textContent = "Connection: Offline";
      connectionStatus.classList.add("connection-offline");
      showNotification("You appear to be offline");
      break;
    default:
      connectionStatus.textContent = "Connection: Unknown";
  }
});
```

{% endcode %}

### Creating a Notification System

Add a helper function to display temporary notifications to users:

{% code expandable="true" %}

```javascript
// Helper function to show notifications
function showNotification(message, duration = 3000) {
  notification.textContent = message;
  notification.classList.add("show");
  
  setTimeout(() => {
    notification.classList.remove("show");
  }, duration);
}

// Show helpful messages for common issues
whereby.addEventListener("deny_device_permission", (event) => {
  if (event.detail.denied) {
    showNotification("Camera/microphone access denied. Check your browser settings.", 5000);
  }
});

// Provide feedback when users toggle controls
whereby.addEventListener("camera_toggle", (event) => {
  const isOn = event.detail.enabled;
  showNotification(isOn ? "Camera turned on" : "Camera turned off");
});

whereby.addEventListener("microphone_toggle", (event) => {
  const isOn = event.detail.enabled;
  showNotification(isOn ? "Microphone turned on" : "Microphone turned off");
});
```

{% endcode %}

### Room Lifecycle Management

Finally, let's add some room lifecycle events to provide a complete user experience:

{% code expandable="true" %}

```javascript
// Handle room ready state
whereby.addEventListener("ready", () => {
  showNotification("Room is ready!");
});

// Handle successful join
whereby.addEventListener("join", () => {
  showNotification("You joined the meeting");
});

// Handle pre-call check results
whereby.addEventListener("precall_check_completed", (event) => {
  const status = event.detail.status;
  if (status === "failed") {
    showNotification("Device check failed - you may experience issues", 5000);
  }
});
```

{% endcode %}

Your enhanced video call interface now provides real-time feedback to users about participant changes, connection quality, device issues, and room status. The event-driven approach ensures your UI stays synchronized with the actual state of the meeting without requiring manual polling or state management.

### See Also

* [Event reference](/reference/using-the-whereby-embed-element#listening-to-events): contains a table detailing every available event
* [Using commands](/whereby-for-web-browser/web-component-and-pre-built-ui/using-commands): learn how to create custom controls for your Whereby component


# Quickly deploy Whereby to your domain

### Summary

We've put together a simple tool to make deploying Whereby's Pre-built experience on your site even easier. It's recommended that you use a dedicated domain or subdomain. You'll then be able to use the unique roomNames that are returned from our API.

**Example API response:**

{% code overflow="wrap" %}

```json
{
    "startDate": "2024-11-15T16:11:33.568Z",
    "endDate": "2024-11-29T16:11:33.044Z",
    "roomName": "/your-url-c4jx6g",
    "roomUrl": "https://your-account.whereby.com/your-url-c4jx6g",
    "meetingId": "93259794"
}
```

{% endcode %}

You can then use the `roomName` from above as a path on the domain you've deployed our webapp to:

```html
https://video.yoursite.com/your-url-c4jx6g
```

### Deploy the tool

1. Go to our webapp repo and fork for your own customizations and website
   1. <https://github.com/whereby/embed-wrapper>
2. Deploy the app to your favourite hosting provider (e.g. [Netlify](https://www.netlify.com), [Vercel](https://vercel.com) etc)
3. In `assets/index.js` the `roomUrl` variable to include your Whereby subdomain

```javascript
const roomUrl = new URL("https://your-account.whereby.com")
```

4. In the same file, you can choose to manage the room features [available as attributes](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes) by using the [setAttribute](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute) method

```javascript
whereby.setAttribute("minimal", true)
whereby.setAttribute("screenshare", false)
whereby.setAttribute("background", false)
```


# Embed with low code

If you want to embed video rooms in a website using HTML or a framework that supports HTML elements like React.js, a great option for doing this is by using a simple iframe.

{% embed url="<https://youtu.be/kNhhpA_RXg4?feature=shared>" %}

Use a `roomUrl` you've created as the `src` attribute as in the example below.

```html
<iframe
  src="https://subdomain.whereby.com/room?minimal"
  allow="camera; microphone; fullscreen; display-capture; autoplay; compute-pressure"
></iframe>
```

{% hint style="danger" %}
Using an \<iframe> is the only option for low code builders, but that we generally do not recommend embedding via an iframe. Instead, we suggest using our [Web Component](/reference/using-the-whereby-embed-element), as it provides more options and flexibility.
{% endhint %}

### Additional details

* If you'd like more programmatic control around the meeting experience, this is where browser [events](/whereby-for-web-browser/web-component-and-pre-built-ui/using-whereby-events) and [commands](/whereby-for-web-browser/web-component-and-pre-built-ui/using-commands) come in!
* The above code can be used for in website builders like [Squarespace or Wordpress](/integrating-whereby-in-specific-environments/embedding-in-squarespace-or-wordpress).
* When embedding, you can customize the room by [toggling features and behaviors via URL parameters](/reference/using-the-whereby-embed-element).
* You can restrict which domains are allowed to embed your rooms via the [Allowed domains feature](/further-resources/faq-and-troubleshooting/allowed-domains-and-localhost) on your dashboard.


# React-based Browser SDK

The React-based Browser SDK is a flexible toolkit that lets you build a fully custom video calling experience using Whereby’s APIs, components, and event system using React.

### Get started

#### 🚀 Start here

* [Start here to get your first implementation running](/whereby-for-web-browser/react-based-browser-sdk/quick-start)

#### 🎨 Customize the experience

* [Customizing the toolbar](/whereby-for-web-browser/react-based-browser-sdk/how-to-customize-the-toolbar)
* [Customizing video tiles](/whereby-for-web-browser/react-based-browser-sdk/custom-video-tiles-with-react)

#### Share content in the room

* [Sharing YouTube and Miro](/whereby-for-web-browser/react-based-browser-sdk/sharing-youtube-and-miro)
* [Room integrations without React](/whereby-for-web-browser/react-based-browser-sdk/room-integrations-without-react)

***

### Further resources

{% columns %}
{% column %}
**⚙️ Core concepts**

* [Grid logic](/whereby-for-web-browser/react-based-browser-sdk/grid-logic)
  {% endcolumn %}

{% column %}
**🔄 Migration**

* [Migrating from version 2.x to 3](/whereby-for-web-browser/react-based-browser-sdk/migrate-from-version-2.x-to-3)
  {% endcolumn %}
  {% endcolumns %}


# Browser SDK quickstart

This guide shows you how to use the Whereby Browser SDK to create a custom React video calling application with full control over the user interface. Unlike the web component approach, the Browser SDK provides granular access to video streams, participants, and room actions, enabling you to build completely tailored video experiences.

{% hint style="info" %}
The Browser SDK is ideal when you need to integrate video calling seamlessly into existing applications, implement custom layouts, or create specialized video experiences like telehealth platforms, virtual classrooms, or branded conference solutions.
{% endhint %}

### Prerequisites

This guide assumes you have a React development environment set up and are familiar with React hooks and JSX syntax. You'll also need:

* A Whereby Embedded account with an active subscription
* A created meeting room with its URL
* Node.js and npm or yarn installed
* A React project (create one with [Vite](https://vitejs.dev/guide/), [Parcel](https://parceljs.org/recipes/react/), Create React App, or similar)

If you haven't created a Whereby embedded account and meeting room yet, follow the [Whereby Embedded initial setup guide](/getting-started/overview-of-whereby-embedded/initial-setup).

### Getting Started

#### Install the SDK

Add the Whereby Browser SDK to your React project:

```bash
npm install @whereby.com/browser-sdk
```

For yarn users:

```bash
yarn add @whereby.com/browser-sdk
```

#### Basic Implementation

The Browser SDK centers around the `useRoomConnection` hook, which manages the connection to your Whereby room and provides access to participants, actions, and UI components.

1. **Import the necessary components**:

```javascript
import React, { useEffect } from "react";
import { useRoomConnection, VideoView } from "@whereby.com/browser-sdk/react";
```

2. **Set up the room connection**:

```javascript
const ROOM_URL = "https://your-subdomain.whereby.com/your-room-id";

function MyVideoApp() {
  const { state, actions } = useRoomConnection(ROOM_URL, {
    localMediaOptions: {
      audio: true,
      video: true,
    }
  });

  const { connectionStatus, localParticipant, remoteParticipants } = state;
  const { joinRoom, leaveRoom } = actions;

  useEffect(() => {
    joinRoom();
    return () => leaveRoom();
  }, [joinRoom, leaveRoom]);

  return (
    <div className="video-app">
      {/* Your custom UI here */}
    </div>
  );
}
```

3. **Render video streams**:

```javascript
return (
  <div className="video-app">
    {/* Local participant video */}
    {localParticipant?.stream && (
      <div className="local-video">
        <VideoView stream={localParticipant.stream} muted />
      </div>
    )}
    
    {/* Remote participants */}
    {remoteParticipants.map((participant) => (
      <div key={participant.id} className="remote-video">
        <VideoView stream={participant.stream} />
      </div>
    ))}
  </div>
);
```

4. **Add basic styles** to make your video elements visible:

```css
.video-app {
  display: flex;
  gap: 20px;
  padding: 20px;
}

.local-video, .remote-video {
  width: 300px;
  height: 200px;
}

.local-video video, .remote-video video {
  width: 100%;
  height: 100%;
  border-radius: 8px;
}
```

### Adding Controls

Enhance your video app with camera and microphone controls:

```javascript
function MyVideoApp() {
  const [isCameraOn, setIsCameraOn] = React.useState(true);
  const [isMicrophoneOn, setIsMicrophoneOn] = React.useState(true);
  
  const { state, actions } = useRoomConnection(ROOM_URL, {
    localMediaOptions: {
      audio: true,
      video: true,
    }
  });

  const { localParticipant, remoteParticipants } = state;
  const { joinRoom, leaveRoom, toggleCamera, toggleMicrophone } = actions;

  useEffect(() => {
    joinRoom();
    return () => leaveRoom();
  }, [joinRoom, leaveRoom]);

  return (
    <div className="video-app">
      {/* Video streams */}
      {localParticipant?.stream && (
        <VideoView stream={localParticipant.stream} muted />
      )}
      
      {remoteParticipants.map((participant) => (
        <VideoView key={participant.id} stream={participant.stream} />
      ))}
      
      {/* Controls */}
      <div className="controls">
        <button 
          onClick={() => {
            toggleCamera();
            setIsCameraOn(prev => !prev);
          }}
        >
          {isCameraOn ? 'Turn Camera Off' : 'Turn Camera On'}
        </button>
        
        <button 
          onClick={() => {
            toggleMicrophone();
            setIsMicrophoneOn(prev => !prev);
          }}
        >
          {isMicrophoneOn ? 'Mute' : 'Unmute'}
        </button>
      </div>
    </div>
  );
}
```

### Complete Example

Here's a fully functional video app that demonstrates the core Browser SDK features:

```javascript
import React, { useEffect, useState } from "react";
import { useRoomConnection, VideoView } from "@whereby.com/browser-sdk/react";

const ROOM_URL = "https://your-subdomain.whereby.com/your-room-id";

function App() {
  return (
    <div className="app">
      <h1>My Custom Video App</h1>
      <MyVideoApp />
    </div>
  );
}

function MyVideoApp() {
  const [isCameraOn, setIsCameraOn] = useState(true);
  const [isMicrophoneOn, setIsMicrophoneOn] = useState(true);
  
  const { state, actions } = useRoomConnection(ROOM_URL, {
    localMediaOptions: {
      audio: true,
      video: true,
    }
  });

  const { localParticipant, remoteParticipants, connectionStatus } = state;
  const { joinRoom, leaveRoom, toggleCamera, toggleMicrophone } = actions;

  useEffect(() => {
    joinRoom();
    return () => leaveRoom();
  }, [joinRoom, leaveRoom]);

  if (connectionStatus === "connecting") {
    return <div>Connecting to room...</div>;
  }

  return (
    <div className="video-container">
      <div className="participants">
        {localParticipant?.stream && (
          <div className="participant local">
            <VideoView stream={localParticipant.stream} muted />
            <span>You</span>
          </div>
        )}
        
        {remoteParticipants.map((participant) => (
          <div key={participant.id} className="participant remote">
            <VideoView stream={participant.stream} />
            <span>{participant.displayName || "Guest"}</span>
          </div>
        ))}
      </div>
      
      <div className="controls">
        <button 
          className={isCameraOn ? "active" : "inactive"}
          onClick={() => {
            toggleCamera();
            setIsCameraOn(prev => !prev);
          }}
        >
          📹 Camera
        </button>
        
        <button 
          className={isMicrophoneOn ? "active" : "inactive"}
          onClick={() => {
            toggleMicrophone();
            setIsMicrophoneOn(prev => !prev);
          }}
        >
          🎤 Microphone
        </button>
      </div>
    </div>
  );
}

export default App;
```

**Note**: Replace `"https://your-subdomain.whereby.com/your-room-id"` with your actual room URL from the Whereby dashboard.

### Customizing Your App

The Browser SDK provides extensive customization options:

**Advanced Features**: Add screen sharing with `startScreenshare()` and `stopScreenshare()` actions, implement chat functionality using the `chatMessages` state and `sendChatMessage()` action, or handle room locks with the `knock()` action.

**Custom Layouts**: Create grid layouts, spotlight views, or presentation modes by manipulating how you render the `VideoView` components and applying custom CSS.

**Event Handling**: Access detailed room state including participant count, connection status, and media device states to build sophisticated UI logic.

**Branding**: Since you control the entire UI, you can implement your brand colors, logos, and styling without limitations.

### See Also

* [Browser SDK React Hooks Tutorial](/telehealth-industry-solutions/using-whereby-react-hooks-build-a-telehealth-app): Build a complete telehealth-style video app with advanced features
* [Browser SDK Reference](/reference/react-hooks-reference): Complete documentation of all available hooks, actions, and components


# Grid logic

The `<VideoGrid />` component is simple to use, but it contains a set of complex rules that decide how the various video cells are rendered.

## Layouts

The `<VideoGrid />` component consists of three specific grid layouts:\
`Presentationgrid`, `Videogrid` and `Subgrid`.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/LqNvk5OzwYi5ChYpeTD8/image.png" alt=""><figcaption></figcaption></figure>

The placement of the grids will change depending on container size, number of presentations and number of participants in the video and subgrid. For example, if there are no active presentations, the video grid will fill the presentation space. The same rule applies to the subgrid.

## Participant distribution

The selection of which participants reside in which grid section is decided based on a set of rules:

### Presentationgrid

The presentation grid consists of all screen shares and spotlighted participants.

### Videogrid

The video grid consists of all participants that have enabled video, are not spotlighted, and are not in the subgrid. By default, the `Videogrid` can have 12 active video cells. However, this is can be customised.

### Subgrid

The general rule is that all participants with their video off, will move to the subgrid. Any participant joining after the video limit in the `Videogrid` is reached, will also be automatically moved into the subgrid.

## Room integrations

When someone shares a YouTube video or a Miro board, `<VideoGrid />` places it like a cell and shows it in an iframe. You can draw the cell yourself with [`renderIntegration`](/reference/react-hooks-reference/videogrid#rendering-room-integrations), or turn this off with `enableIntegrations={false}`.

* The first running integration takes the `Presentationgrid`. While it's there, spotlighted participants move to the `Videogrid` instead of sharing the stage with it.
* Any further running integrations go to the `Subgrid`.
* Maximizing a participant gives them the stage. The integration stays mounted in a hidden cell, so a video keeps playing, and it returns to the stage when the participant is restored. The same happens to extra integrations when the subgrid is turned off.
* An integration cell takes the content's aspect ratio, 16:9 by default.

An iframe reloads when React moves it in the DOM, so the grid always renders integration cells first in its list, with a key built from the session id. Participants joining, leaving or getting spotlighted don't move them. See [Sharing YouTube and Miro](/whereby-for-web-browser/react-based-browser-sdk/sharing-youtube-and-miro) for the full feature.


# Customizing the toolbar

Whereby's browser SDK makes it easy to add video calling to your web or mobile application. You can also use our [React hooks](https://docs.whereby.com/reference/react-hooks-reference) and components to create a fully-customized UI.

In this tutorial, we'll create a custom toolbar using our video call SDK, React, CSS, and SVG. Before we begin, you'll need a [Whereby Embedded](https://whereby.com/information/embedded) account.

{% hint style="info" %}
You can get started on Whereby for free with 2,000 participant minutes each month — perfect for trying our features.
{% endhint %}

This tutorial assumes:

* You're familiar with JavaScript, React, Node, and either [npm](https://www.npmjs.com/) or [Yarn](https://yarnpkg.com/).
* You've already set up a React project. If not, [Vite](https://vitejs.dev/guide/) or [Parcel](https://parceljs.org/recipes/react/) can get you up-and-running quickly.

Before you begin, create a meeting room from your account dashboard or using Whereby's [REST API](https://docs.whereby.com/whereby-101/creating-and-deleting-rooms). Since this is a tutorial, it’s fine to create an unlocked room.

### What we’re creating

This tutorial will walk you through creating a custom toolbar similar to the one shown below. Icons are SVG images from the [Lucide](https://lucide.dev/) collection.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/nr4OH6HXAwviIXUjWjbm/HowToCustomizeToolbar1.webp" alt=""><figcaption><p>Figure 1: The toolbar’s design</p></figcaption></figure>

Once you've set up your React project, add the Whereby Browser SDK and Lucide. If you're using npm, type the following.

```bash
npm i @whereby.com/browser-sdk lucide-react
```

Yarn users: use `yarn add` to install both packages.

```bash
yarn add @whereby.com/browser-sdk lucide-react
```

Lucide icons are available as JSX components. It saves the step of making SVG icons compatible with JSX.

### Adding Whereby to your application

To add video calling to your application, you'll first need to add the`WherebyProvider` component. `WherebyProvider` ensures that all of your components have access to Whereby's internal state.

Update your `index.js` file and wrap your main component — `App` in this case — in `WherebyProvider`. Your code should resemble the example below.

```jsx
import React from 'react';
import { createRoot } from 'react-dom/client';
import App from './App';
import { WherebyProvider } from '@whereby.com/browser-sdk/react'

const root = document.getElementById('app');
const container = createRoot(root);
container.render(
  <WherebyProvider>
    <App />
  </WherebyProvider>
);
```

{% hint style="success" %}
Whereby added `WherebyProvider` in version 3.0 of the SDK. This is a significant change from earlier versions. See our [migration guide](https://docs.whereby.com/reference/react-hooks-reference/guides-and-concepts/migrate-from-version-2.x-to-3) for more.
{% endhint %}

Add the URL of your meeting room as well. Pass it to App as a roomUrl prop.

```jsx
const ROOM_URL = 'https://<example>.whereby.com/9c72b1a0-5871-47fd-0000-xxxxxx';

const root = document.getElementById('app');
const container = createRoot(root);
container.render(
  <WherebyProvider>
    <App roomUrl={ROOM_URL} />
  </WherebyProvider>
);
```

### Connect to the meeting room

Use the SDK’s [`useRoomConnection`](https://docs.whereby.com/reference/react-hooks-reference/api-reference/useroomconnection) hook to connect to your room. This hook returns a [RoomConnectionOptions](https://docs.whereby.com/reference/react-hooks-reference/types#roomconnectionoptions) object containing three properties:

* `state`, an object that reflects the status and settings of the current room, including the call's participants;
* `events`, an event emitter object that fires in-room events as they're happening; and
* `actions`, an object representing the available actions in the room.

`useRoomConnection.actions` contains the methods you'll need to join the meeting, and create the toolbar controls.

```jsx
import React from 'react';
import {useRoomConnection, VideoView } from "@whereby.com/browser-sdk/react";
// Import the `VideoView` component as well, so that you can see yourself.
```

Invoke the `joinRoom` action from React's [useEffect](https://react.dev/reference/react/useEffect) hook.

```jsx
const App = ({roomUrl}) => {
  // Connect to the room
  const roomConnection = useRoomConnection(roomUrl, {
    localMediaOptions: {
      audio: true,
      video: true,
    }
  });

  const {state, actions} = roomConnection;
  const { joinRoom } = actions;

  React.useEffect(() => {
    joinRoom();
  }, []);

  return (
    <>
      {state.localParticipant &&
        <VideoView stream={state.localParticipant.stream} />
      }
      <div className="toolbar">
      </div>
    </>
  );
}
```

Your `App.jsx` file should look a bit like the code above. Now to create each button.

### Create your toolbar buttons

This toolbar needs three controls: one to toggle the user's camera, one to toggle the user's microphone, and one that allows the user to leave the meeting. Start with the `CameraToggle` component.

`CameraToggle` should include two buttons: one to turn the camera on, and one to turn the camera off. When clicked, it'll show or hide the appropriate button and turn the video stream on or off.

Import the `Video` and `VideoOff` components from `lucide-react`. Use the `button` element to create the controls.

```jsx
import React from 'react';
import { Video, VideoOff } from 'lucide-react';

const CameraToggle = ({action}) => {
  return (
    <>
      <button
        className="toolbar__button"
        type="button"
        title="Turn video off"
      >
        <Video />
      </button>

      <button
        className="toolbar__button"
        type="button"
        title="Turn video on"
      >
        <VideoOff />
      </button>
    </>
  );
}

export default CameraToggle;
```

To keep track of which button should be visible, you'll also need to manage state. Use the `React.useState()` hook to define a `hidden` property and set its initial value.

```jsx
const Camera = ({action}) => {
  const [hidden, setHidden] = React.useState(true);
  // ... return component body here.
}
```

### Connecting actions to buttons

`CameraToggle` expects an `action` prop, in this case, `toggleCamera`. Import `CameraToggle` into `App.jsx`, then set `toggleCamera` as the value of its `action` prop.

```jsx
/* App.jsx */
import React from 'react';
import CameraToggle from './CameraToggle';

//...

const {
  joinRoom,
  toggleCamera
} = actions;

//...

return (
  <>
    {localParticipant &&
      <VideoView stream={localParticipant.stream} />
    }
    <div className="toolbar">
      <CameraToggle action={toggleCamera} />
    </div>
  </>
);
//...
```

Now add an `onClick` handler to both buttons. Set the value of `hidden` and call the `toggleCamera` action. A `true` argument turns the camera on and `false` turns it off.

```jsx
/* CameraToggle.jsx */

//...
return (
  <>
    <button
      className="toolbar__button"
      type="button"
      aria-label="Turn camera off"
      onClick={() => {
        setHidden(false);
        action(false);
      }}
      hidden={!hidden}
    >
      <Video />
    </button>

    <button
      className="toolbar__button"
      type="button"
      aria-label="Turn camera on"
      onClick={() => {
        setHidden(true);
        action(true)
      }}
      hidden={hidden}
    >
      <VideoOff />
    </button>
  </>
);
```

Each time the participant clicks `CameraToggle`, they'll start or stop their video stream, and show or hide the appropriate button. Use the same technique to create a `MicrophoneToggle` component with the `toggleMicrophone` action.

### Allowing participants to leave

Creating a `Leave` component is much simpler. There's no need to manage state.

```jsx
import React from 'react';
import { DoorOpen } from 'lucide-react';

const Leave = ({action}) => {
  return (
    <button
      className="toolbar__button"
      type="button"
      title="Leave the meeting"
    >
      <DoorOpen />
    </button>
  );
}

export default Leave;
```

Don’t forget to add `MicrophoneToggle` and `Leave` to `App`. Your video and toolbar should resemble the image in Figure 2.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/0HnNKYjpQoVz5wbghcNA/HowToCustomizeToolbar2.webp" alt=""><figcaption><p>Figure 2: The VideoView component and the toolbar before adding CSS.</p></figcaption></figure>

### Styling the toolbar

Add a `style.css` file to your project and import it into `App.jsx`.

```jsx
import React from 'react';
import { useRoomConnection, VideoView } from "@whereby.com/browser-sdk/react";

import CameraToggle from './CameraToggle';
import MicrophoneToggle from './MicrophoneToggle';
import Leave from './Leave';

import './style.css';
```

As designed, each toolbar button is circle-shaped. Buttons are centered within the toolbar and have an equal amount of space between them. [CSS Flexbox](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_flexible_box_layout) works well for this. Add a `.toolbar` rule set for `style.css`.

```css
.toolbar {
  display: flex;
  justify-content: center;
  gap: 4rem;
	background: hsla(0, 50%, 100%, 0.5);
  backdrop-filter: blur(10px);
  border-radius: .5rem;
}
```

The toolbar should now look a bit like Figure 3.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/KGuXMM64MMv14BUvrK8z/HowToCustomizeToolbar3.webp" alt=""><figcaption><p>Figure 3</p></figcaption></figure>

Now let’s style the buttons themselves. Add a `.toolbar__button` ruleset to `style.css`. Combine it with `:not([hidden])` so that hidden buttons remain hidden. Using `display: flex` centers the icon within each button.

```css
.toolbar__button:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
  inline-size: 4rem;
  block-size: 4rem;
  background: linear-gradient(45deg, #434D6F, #292F44);
  border-radius: 100rem;
  border: 0px;
  cursor: pointer;
}
```

Figure 4 shows the result.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/3ivbzAhzSQdPpaPu2wzJ/HowToCustomizeToolbar4.webp" alt=""><figcaption><p>Figure 4: Toolbar buttons before SVG-specific styles.</p></figcaption></figure>

### Styling SVG

You're almost there! According to the toolbar's design, each icon should be a bit larger, with a thinner stroke, and off-white color. You can modify some SVG properties including `stroke` and `stroke-width` with CSS. Add another rule set to `style.css`.

```css
.toolbar__button {
  background: transparent;
  border: 0px;
  cursor: pointer;
  padding: 0;
  /* About 48 pixels when the root font size is 16px */
  inline-size: 3rem;
  block-size: 3rem;

  /* Equivalent to .toolbar__button svg */
  svg {
    inline-size: 100%;
    block-size: 100%;
    stroke: hsl(60, 55%, 95%);
    stroke-width: 1px;
  }
}
```

Now your toolbar is complete. In real-world applications, remember to add `:hover` and `:focus` styles to your buttons.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/ju8UAC8h4MVsqzBcPdTK/HowToCustomizeToolbar5.webp" alt=""><figcaption><p>Figure 5</p></figcaption></figure>

This tutorial walked you through a simple toolbar with a few features. You can, however, add additional controls. For example, the `startScreenshare()` [action](https://docs.whereby.com/reference/react-hooks-reference/api-reference/useroomconnection#actions) allows participants to share their screen with other attendees. You can also add buttons for meeting hosts that allow a host to mute or remove participants. Since all of Whereby’s meeting room controls are available as actions, you can make your toolbar as robust as you’d like.

> Written by [Tiffany Brown](https://whereby.com/blog/author-tiffany-brown/)


# Customizing video tiles

Discover how to customize the video tiles in a Whereby call using the Browser SDK with React hooks.

## Intro and getting started

One advantage of the Whereby Browser SDK is ease of customization. You can customize your video calling UI right down to the video tiles using what you already know: CSS, JavaScript, and React.

In this tutorial, you'll create a pair of video tiles. Before starting, you'll need a [Whereby Embedded](https://whereby.com/information/embedded) account. Once you have your account, create a meeting room using your account dashboard or Whereby's [REST API](https://docs.whereby.com/whereby-101/creating-and-deleting-rooms). You can leave the room unlocked for development purposes.

{% hint style="success" %}
You can get started on Whereby for free with 2,000 participant minutes each month — perfect for trying our features.
{% endhint %}

This tutorial assumes:

* You're familiar with React, Node, and either [npm](https://www.npmjs.com/) or [Yarn](https://yarnpkg.com/).
* You've already set up a React project. If not, [Vite](https://vitejs.dev/guide/) or [Parcel](https://parceljs.org/recipes/react/) can get you up-and-running quickly.
* You've read our earlier post, [How To Add Video Conferencing to Your Web App Using the Whereby Browser SDK](https://whereby.com/blog/how-to-add-video-conferencing-to-your-web-app-using-the-whereby-browser-sdk/).

You'll need this background to understand some of the code examples here.

### What we're creating <a href="#whatwerecreating" id="whatwerecreating"></a>

Whereby is well-suited to coaching, telehealth, remote classrooms, and virtual meetings. We'll use the Whereby Browser SDK and CSS to create video tiles for a remote 1-to-1 coaching business, BreatheCoaching. The image below illustrates what we're going to build.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/FQPSl1sK5zdmEzk8Fzuw/CustomizeVideoTiles-01.webp" alt="" width="563"><figcaption></figcaption></figure>

### Create a Participant component <a href="#createaparticipantcomponent" id="createaparticipantcomponent"></a>

Start by adding a `Participant` component to your project. This is the component we'll use to display each participant's video.

```tsx
import React from "react";

const Participant = (props) => {

  /*
   * In the parent component: 
   * <Participant {...localParticipant} {...components} />
   */
  const {
    VideoView,
    stream
  } = props;

  return (
    <div>
      {stream && 
        <VideoView mirror stream={stream} />
      }
    </div>
  )
}

export default Participant;
```

`Participant` expects a `VideoView` component prop from its parent. `VideoView` requires also a `stream` prop value — the `stream` property of either a [`LocalParticipant`](https://docs.whereby.com/reference/react-hooks-reference/types#localparticipant-less-than-object-greater-than) or [`RemoteParticipant`](https://docs.whereby.com/reference/react-hooks-reference/types#remoteparticipant-less-than-object-greater-than) object. Pass the `stream` prop of `Participant` along to `VideoView`, as shown above.

At this point, the video tile should fill your entire browser, as in Figure 2. By default, the `VideoView` component expands to fit the width of its container. Let's constrain its width with some CSS.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/9PXCsfsKea57yDsiwohl/CustomizeVideoTiles-02.webp" alt="" width="563"><figcaption><p>Figure 2</p></figcaption></figure>

### Managing the video tile's dimensions <a href="#managingthevideotilesdimensions" id="managingthevideotilesdimensions"></a>

Add a `Participant.css` file to your project. Import it into the `Participant` component file as shown below.

```tsx
import React from "react";
import 'Participant.css';
```

Add a `className` attribute with a value of `participant` to the containing `div` element. You'll use this attribute value as the selector in your CSS.

```tsx
//…

return (
  <div className="participant">
    {stream && 
      <VideoView stream={stream} />
     }
  </div>
)
```

Since the design specs for BreatheCoaching require square video tiles with rounded corners, set the `width` property for the `.participant` class. Use the [`aspect-ratio`](https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio) CSS property to enforce square dimensions.

```css
:root {
  --localParticipantWidth: 200px;
}

.participant {
  aspect-ratio: 1;
  width: var(--localParticipantWidth);
}
```

Now our video tile is 200 pixels wide by 200 pixels tall. Our video *source* however, is only 112.5 pixels tall (Figure 3).

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/eRE7VGPXXnTj8lvAzVf8/CustomizeVideoTiles-03.webp" alt="" width="563"><figcaption><p>Figure 3</p></figcaption></figure>

Videos maintain their aspect ratio regardless of the dimensions of the `video` element or its containing ancestors. To resolve this, use the [`object-fit`](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) CSS property and the `cover` value.

```css
.participant > video {
  object-fit: cover;
}
```

Using `object-fit: cover` causes the browser to scale the video source so that it fills the container, but maintains its aspect ratio. Your video tile should now resemble Figure 4.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/B3STUkr9PuJUpbHymXkY/CustomizeVideoTiles-04.webp" alt="" width="563"><figcaption><p>Figure 4</p></figcaption></figure>

### Rounding the corner <a href="#roundingthecorner" id="roundingthecorner"></a>

Our design also calls for rounded video tile corners. Add a `border-radius` declaration to the `.participant` rule set, along with `overflow: hidden`. The latter rule ensures that the corners of the video don't extend past its container.

```css
.participant {
  aspect-ratio: 1;
  width: var(--localParticipantWidth);
  border-radius: 25%;
  overflow: hidden;
}
```

Your video tile should now resemble Figure 5.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/tIEPtJ13HGOU6CSrmdmQ/CustomizeVideoTiles-05.webp" alt="" width="563"><figcaption><p>Figure 5</p></figcaption></figure>

Although the local and remote participant tiles are different sizes, there's a lot of overlap in their appearance. Instead of creating a separate component, let's add some code to support a remote participant variation.

### Same component, different look <a href="#samecomponentdifferentlook" id="samecomponentdifferentlook"></a>

Each participant object contains a property named `isLocalParticipant`. For remote participants, the value of this property is always `false`. Use this property to conditionally add a `remote` class to the remote participant tile. First, update the destructuring assignment to extract `isLocalParticipant` from `props`.

```tsx
 const {
  VideoView,
  stream,
  isLocalParticipant
} = props;
```

Then conditionally add a `remote` class to the containing `div`.

```tsx
return (
  <div className={`participant ${ !isLocalParticipant ? '' : 'remote'}`>
    {stream && 
      <VideoView stream={stream} />
     }
  </div>
)
```

{% hint style="warning" %}
**Note:** Using the ternary operator is fine for tutorials. For production-ready projects, consider the [classnames](https://www.npmjs.com/package/classnames) package instead.
{% endhint %}

Finally, add a `.remote` rule set to `Participants.css`. Override the `width` property value from `.participant` and add a transparent border. Use the [`box-shadow` property](https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow) to add the halo.

```css
:root {
  --localParticipantWidth: 200px;
  --remoteParticipantWidth: 400px; /* Add a --remoteParticipantWidth custom property */
}

//…

.remote {
  width: var(--remoteParticipantWidth);
  border: 1.2rem solid transparent;
  box-shadow: 0 0 2rem 0.5rem #fff;
}
```

{% hint style="info" %}
**Note:** You can also use the [`filter`](https://developer.mozilla.org/en-US/docs/Web/CSS/filter) property and the `drop-shadow()` filter to create the halo effect.
{% endhint %}

Your remote participant tile should look a bit like Figure 6.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/bydcrodSRveYQRjxZPRp/CustomizeVideoTiles-06.webp" alt="" width="563"><figcaption><p>Figure 6</p></figcaption></figure>

Put it together with the rest of our UI design, and you can launch BreatheCoaching in no time.

> Written by [Tiffany Brown](https://whereby.com/blog/author-tiffany-brown/)


# Sharing YouTube and Miro

Let participants share a YouTube video or a Miro board with everyone in the room, using room integrations in the React-based Browser SDK.

Room integrations let a participant share a YouTube video or a Miro board with the whole room. One person starts it and everyone sees the same thing. When the presenter plays, pauses or seeks a YouTube video, everyone's player follows.

This guide builds the feature in four steps: pick, start, show, stop. It assumes you already have a room working with `useRoomConnection`. If you don't, start with the [Browser SDK quickstart](/whereby-for-web-browser/react-based-browser-sdk/quick-start).

Room integrations are available in every room, on every plan.

## How it works

The Whereby app loads integrations straight into its own page. Your app runs on your domain, so the SDK can't do that. Instead, each integration runs in an iframe that Whereby serves from the integration's own origin, and the SDK talks to it with `postMessage`.

The hooks are headless. They give you `iframeProps` for an `<iframe>` that you render, place and size. `VideoGrid` uses the same hook to render integrations for you. Nothing inside the frame is yours to style. It's the integration's UI.

A share goes through these stages:

1. **Pick.** The user chooses a video or a board in the integration's picker, which runs in an iframe from [`useRoomIntegrationPicker`](/reference/react-hooks-reference/useroomintegrationpicker). If you already have a link, skip the picker and use `roomIntegrationContent`.
2. **Start.** `actions.startRoomIntegration` checks the content and sends it to the server. Your state doesn't change yet.
3. **Share.** The server records the session and broadcasts it to everyone in the room, or in the current breakout group, including the sender.
4. **Show.** The session appears in `state.roomIntegrations.running`. `VideoGrid` shows it by default. In your own layout, [`useRoomIntegrationView`](/reference/react-hooks-reference/useroomintegrationview) gives you the iframe that shows it.
5. **Sync.** When the content changes, for example the presenter pauses, the change goes to the server and comes back to everyone through the state. The hook sends each frame only the props that changed.
6. **Stop.** The person who started it, or a host, stops it with `actions.stopRoomIntegration` or the close control inside the content.

The room connection state is the source of truth. An iframe that reloads asks for the session's current props and catches up.

## Step 1: Offer what can be shared

`state.roomIntegrations.embeddable` lists the integrations your app can run. Today that's YouTube and Miro. The SDK fetches the list after you join, so it's empty until `hasFetched` is `true`.

```tsx
const { state, actions } = useRoomConnection(roomUrl, { localMediaOptions: { audio: true, video: true } });
const { roomIntegrations, connectionStatus } = state;
const [picking, setPicking] = React.useState<RoomIntegration | null>(null);

{roomIntegrations.embeddable.map((integration) => (
    <button
        key={integration.roomIntegrationId}
        disabled={connectionStatus !== "connected"}
        onClick={() => setPicking(integration)}
    >
        <img src={integration.icons.small} alt="" /> Share {integration.title}
    </button>
))}
```

Build the menu from `embeddable`, not `enabled`. `enabled` also contains integrations such as Google Docs and Trello that can't run in your app (see [Limitations](#limitations)).

## Step 2: Pick something to share

`useRoomIntegrationPicker` loads the integration's picker into an iframe you render. When the user picks something, `onPicked` receives `{ tagName, shareUrl, props }`.

```tsx
import { useRoomIntegrationPicker, type UseRoomIntegrationPickerOptions } from "@whereby.com/browser-sdk/react";

function Picker(props: UseRoomIntegrationPickerOptions) {
    const { iframeProps } = useRoomIntegrationPicker(props);
    return iframeProps ? <iframe {...iframeProps} className="picker" /> : null;
}
```

Render it while the user is picking, and remove it when they're done:

```tsx
{picking && (
    <div className="picker-dialog">
        <button onClick={() => setPicking(null)}>Close</button>
        <Picker
            integration={picking}
            onPicked={(content) => {
                actions.startRoomIntegration({ roomIntegrationId: picking.roomIntegrationId, ...content });
                setPicking(null);
            }}
            onCancel={() => setPicking(null)}
            onError={(error) => {
                console.warn("Picker failed", error.message);
                setPicking(null);
            }}
        />
    </div>
)}
```

A few rules for the picker frame:

* **Spread all of `iframeProps`, including `ref`.** The hook uses the ref to check that answers come from this frame. Without it, `onPicked` never fires. In development the hook warns you.
* **Give it room.** The picker is a full page. Something like 600 × 600 pixels works on desktop.
* **Don't add `sandbox`.** Some providers open a window to sign the user in, and a sandbox blocks it without an error.
* **One answer per mount.** The hook stops listening after the first answer. Unmounting the picker when the user is done, as above, gets you a fresh one next time.

### Share a link without the picker

If your app already knows what to share, such as a video attached to a lesson, build the content with `roomIntegrationContent` and skip the picker:

```tsx
import { roomIntegrationContent } from "@whereby.com/browser-sdk/react";

function shareVideo(url: string) {
    const youtube = state.roomIntegrations.embeddable.find((integration) => integration.name === "youtube");
    const content = roomIntegrationContent.youtube({ url });

    if (!youtube || !content) {
        return; // YouTube isn't available, or the link isn't a YouTube link
    }

    actions.startRoomIntegration({ roomIntegrationId: youtube.roomIntegrationId, ...content });
}
```

`youtube()` accepts most YouTube link formats and bare video ids, and reads the start time from `t=`. `miro()` only accepts Miro embed links (`miro.com/app/live-embed/...` from **Share → Embed** in Miro), not board URLs. Both return `null` for input they can't use. See [Building content without the picker](/reference/react-hooks-reference/useroomconnection/room-integrations#building-content-without-the-picker) for every option.

## Step 3: Start

`startRoomIntegration` doesn't change your state on its own. It checks the content and sends it to the server. A moment later the server's broadcast adds the session to `state.roomIntegrations.running` for everyone, you included. Don't show the integration optimistically. Render from `running`.

If the local checks fail, or the server refuses, `state.roomIntegrations.error` is set instead. See [Handling errors](#handling-errors).

## Step 4: Show it

### Inside `VideoGrid`

If you use `VideoGrid`, you don't need to do anything. The grid shows running integrations by default, in an iframe that fills the integration's cell:

```tsx
<VideoGrid />
```

Here's where the grid puts running integrations:

* The first running integration takes the presentation stage. Spotlighted participants move to the video grid while it's there.
* Any other running integrations go to the subgrid. With `enableSubgrid={false}` they stay mounted in hidden cells instead.
* If you maximize a participant, the integration leaves the stage but stays mounted in a hidden cell, so a video keeps playing. When you un-maximize, it comes back where it was.
* The cell takes its shape from the content's aspect ratio, 16:9 unless the content says otherwise.

The grid keeps integration cells first in its list, with a stable key, so React never moves the iframe when participants join, leave or get spotlighted. See [Grid logic](/whereby-for-web-browser/react-based-browser-sdk/grid-logic#room-integrations) for the full rules.

To draw the cell yourself, for example to add a "Shared by" label or a volume control, pass `renderIntegration`. The grid still decides where the cell goes and how big it is. Build the frame with `useRoomIntegrationView`:

```tsx
import { useRoomIntegrationView, type RoomIntegrationSessionView } from "@whereby.com/browser-sdk/react";

function IntegrationFrame({ session }: { session: RoomIntegrationSessionView }) {
    const { iframeProps } = useRoomIntegrationView({ session });

    return iframeProps ? (
        <iframe {...iframeProps} allowFullScreen style={{ border: "none", width: "100%", height: "100%" }} />
    ) : null;
}

<VideoGrid renderIntegration={({ session }) => <IntegrationFrame session={session} />} />;
```

To keep integrations out of the grid, for example because you show them in your own layout, pass `enableIntegrations={false}`. The grid then lays out participants as if nothing were running.

### In your own layout

Render a frame for each entry in `running`, keyed by the session id, using the `IntegrationFrame` component from above. If the same page also has a `VideoGrid`, pass it `enableIntegrations={false}` so the content doesn't appear twice.

```tsx
<div className="stage">
    {state.roomIntegrations.running.map((session) => (
        <div key={session.roomIntegrationSessionId} className="integration-box">
            <IntegrationFrame session={session} />
        </div>
    ))}
</div>
```

The hook needs the latest `session` object on every render to send prop changes to the frame. Reading it from `state.roomIntegrations.running` each render does that.

### Keep the iframe mounted

Moving an iframe to a different parent element reloads it, and so does unmounting and remounting it. For YouTube, a reload means the player loads from scratch and then seeks back to the room's position. Users notice.

* Use `session.roomIntegrationSessionId` as the key.
* When your layout changes, for example switching between a stage view and a sidebar, keep the frame in the same parent and change its size and position with CSS.
* Don't put the frame inside something that unmounts, such as a tab panel that's removed when hidden. Hide it with CSS instead.

### Volume and loading state

The view hook also returns `getVolume` and `setVolume` for a per-device volume control, and accepts `onContentReady` to tell you when the content has loaded. See [useRoomIntegrationView](/reference/react-hooks-reference/useroomintegrationview).

## Step 5: Stop

Two people can stop an integration: the participant who started it, and a host. The SDK works this out for you in `session.canStop`.

```tsx
<button
    disabled={!session.canStop}
    onClick={() => actions.stopRoomIntegration({ roomIntegrationSessionId: session.roomIntegrationSessionId })}
>
    Stop sharing
</button>
```

Stopping removes the session from `running` for everyone, and their frames unmount.

Integrations can also close themselves. When the content sends a close message, for example when a YouTube video ends, `useRoomIntegrationView` stops the session if `canStop` is `true` for you. Participants who can't stop it ignore the message, so the session stops once, from the presenter's or a host's page.

Use `session.isPresenter` and `session.presenterDisplayName` for labels such as "Shared by Alex".

## Late joiners and breakout groups

People who join while an integration is running get it as part of joining. It's in `running` as soon as the room connects, and the frame starts from the session's current props, not the ones it was started with.

Integrations are scoped to breakout groups:

* Starting an integration inside a breakout group shares it with that group only.
* `running` only contains sessions for where you are now. In a group you see that group's sessions. In the main room you see the main room's.
* When you move between the main room and a group, `running` changes to match, and the frames for the old location unmount.

## Handling errors

`state.roomIntegrations.error` is `{ code, message }` or `null`. Show your own text based on `code`, since `message` is written for developers.

```tsx
const ERROR_TEXT: Partial<Record<RoomIntegrationError, string>> = {
    not_allowed_to_stop: "Only the person who shared this, or a host, can stop it.",
    integration_not_enabled: "This integration isn't available in this room.",
    invalid_content: "That link can't be shared.",
};

{roomIntegrations.error && (
    <p role="alert">{ERROR_TEXT[roomIntegrations.error.code] ?? "Something went wrong. Please try again."}</p>
)}
```

The error stays until the next successful start, stop or list fetch replaces it, so clear your banner in your own UI when the user dismisses it. The [reference](/reference/react-hooks-reference/useroomconnection/room-integrations#errors) lists every code.

Picker failures don't go into `state`. They arrive through the picker's `onError`.

## Limitations

* **Only YouTube and Miro work in SDK apps.** Google Docs, Trello and generic integrations check the embedding origin on the provider's side and refuse to load inside your domain. They can be switched on for the room and show up in `enabled`, but `isEmbeddable` is `false` and they aren't in `embeddable`. If someone shares one from the Whereby app, it still appears in `running`, but the frame won't render it. Check `session.integration.isEmbeddable` and show a placeholder instead, in your own layout or from `renderIntegration`. `VideoGrid`'s default view doesn't do this check.
* **Miro needs an embed link.** A normal board URL won't work with `roomIntegrationContent.miro()`. Use the picker, or a link from **Share → Embed** in Miro.
* **Picker sign-in may open a window.** Some providers sign the user in through a separate window. Don't sandbox the picker frame.
* **One integration on the stage.** `VideoGrid` stages the first running integration. Others go to the subgrid. The participant menu's maximize and float actions only apply to participants, not to integrations.
* **No content-frame helper in core.** Outside React you speak the iframe protocol yourself. See [Room integrations without React](/whereby-for-web-browser/react-based-browser-sdk/room-integrations-without-react).

## Full example

```tsx
import * as React from "react";
import {
    VideoGrid,
    useRoomConnection,
    useRoomIntegrationPicker,
    type RoomIntegration,
    type UseRoomIntegrationPickerOptions,
} from "@whereby.com/browser-sdk/react";

function Picker(props: UseRoomIntegrationPickerOptions) {
    const { iframeProps } = useRoomIntegrationPicker(props);
    return iframeProps ? <iframe {...iframeProps} style={{ border: "none", width: 600, height: 600 }} /> : null;
}

export function Room({ roomUrl }: { roomUrl: string }) {
    const { state, actions } = useRoomConnection(roomUrl, { localMediaOptions: { audio: true, video: true } });
    const { roomIntegrations } = state;
    const [picking, setPicking] = React.useState<RoomIntegration | null>(null);

    React.useEffect(() => {
        actions.joinRoom();
        return () => actions.leaveRoom();
    }, []);

    return (
        <>
            <div className="toolbar">
                {roomIntegrations.embeddable.map((integration) => (
                    <button key={integration.roomIntegrationId} onClick={() => setPicking(integration)}>
                        Share {integration.title}
                    </button>
                ))}
                {roomIntegrations.running.map((session) => (
                    <button
                        key={session.roomIntegrationSessionId}
                        disabled={!session.canStop}
                        onClick={() =>
                            actions.stopRoomIntegration({ roomIntegrationSessionId: session.roomIntegrationSessionId })
                        }
                    >
                        Stop {session.integration.title}
                    </button>
                ))}
            </div>

            {roomIntegrations.error && <p role="alert">{roomIntegrations.error.message}</p>}

            {picking && (
                <Picker
                    integration={picking}
                    onPicked={(content) => {
                        actions.startRoomIntegration({ roomIntegrationId: picking.roomIntegrationId, ...content });
                        setPicking(null);
                    }}
                    onCancel={() => setPicking(null)}
                    onError={() => setPicking(null)}
                />
            )}

            <div style={{ height: "70vh", width: "100%" }}>
                <VideoGrid />
            </div>
        </>
    );
}
```

The `Examples/Room integrations` stories in the [SDK repository](https://github.com/whereby/sdk) show the same pieces, with a message log of everything passing between the page and the frames.


# Room integrations without React

Share YouTube videos and Miro boards from an app built on @whereby.com/core, without React, or start them from Node.

This guide covers room integrations for apps that use `@whereby.com/core` directly: Vue, Svelte, Angular, plain JavaScript, or a Node process. If you use React, follow [Sharing YouTube and Miro](/whereby-for-web-browser/react-based-browser-sdk/sharing-youtube-and-miro) instead. The hooks there do most of what this page does by hand.

{% hint style="info" %}
**TODO:** add the `@whereby.com/core` and `@whereby.com/browser-sdk` versions that ship room integrations before publishing.
{% endhint %}

Read the [How it works](/whereby-for-web-browser/react-based-browser-sdk/sharing-youtube-and-miro#how-it-works) section of the React guide first. The model is the same. Each integration runs in an iframe that Whereby serves from the integration's origin. Your page talks to it with `postMessage`. The room connection state is the source of truth.

Without React you need three pieces:

1. **A share menu**, built from `getState().roomIntegrations.embeddable`.
2. **A picker frame.** `@whereby.com/core` builds the URL, and `@whereby.com/browser-sdk` has a listener you can use without React.
3. **A content frame** for each running session. Core has no helper for this, so you implement the [content frame protocol](/reference/core-sdk-reference/api-reference/room-integration-iframe-protocol#content-frame) yourself. The code below is under 100 lines.

The examples assume you've joined a room as in the [Core SDK quick start](/reference/core-sdk-reference/quick-start):

```ts
import { WherebyClient } from "@whereby.com/core";

const client = new WherebyClient();
const roomConnection = client.getRoomConnection();

roomConnection.initialize({ roomUrl, localMediaOptions: { audio: true, video: true } });
await roomConnection.joinRoom();
```

## Watch the room integration state

Room integration state lives in `getState().roomIntegrations` (see [RoomConnectionClient: Room Integrations](/reference/core-sdk-reference/api-reference/roomconnectionclient/room-integrations)). There's no dedicated subscription, so use `subscribe` and skip updates where `roomIntegrations` hasn't changed. `subscribe` doesn't call you straight away, so render once yourself as well:

```ts
let previous = null;

function onState(state) {
    if (state.roomIntegrations === previous) {
        return;
    }
    previous = state.roomIntegrations;

    renderShareMenu(state.roomIntegrations.embeddable);
    syncIntegrationFrames(state.roomIntegrations.running); // defined below
    renderError(state.roomIntegrations.error);
}

roomConnection.subscribe(onState);
onState(roomConnection.getState());
```

The list of integrations loads shortly after you join. `embeddable` is empty until `roomIntegrations.hasFetched` is `true`.

## Pick something to share

The picker is a page on the integration's origin. Load it with `roomIntegrationPickerUrl` and wait for one answer with `subscribeToRoomIntegrationPicker`:

```ts
import { roomIntegrationPickerUrl } from "@whereby.com/core";
import { subscribeToRoomIntegrationPicker } from "@whereby.com/browser-sdk/react";

function openPicker(integration, container) {
    const iframe = document.createElement("iframe");
    iframe.src = roomIntegrationPickerUrl({ integration, parentOrigin: window.location.origin });
    iframe.title = `${integration.title} picker`;
    iframe.allow = "clipboard-read; clipboard-write; fullscreen";
    iframe.style.cssText = "border: none; width: 600px; height: 600px";

    const unsubscribe = subscribeToRoomIntegrationPicker({
        pickerOrigin: new URL(integration.webview).origin,
        getSource: () => iframe.contentWindow,
        onOutcome: (outcome) => {
            iframe.remove();

            if (outcome.type === "submitted") {
                const { tagName, shareUrl, props } = outcome.content;
                roomConnection.startRoomIntegration({
                    roomIntegrationId: integration.roomIntegrationId,
                    tagName,
                    shareUrl,
                    props,
                });
            } else if (outcome.type === "error") {
                console.warn("Picker failed", outcome.error.message);
            }
            // outcome.type === "cancelled": the user closed the picker
        },
    });

    container.appendChild(iframe);

    // Call this if your own UI closes the picker first
    return () => {
        unsubscribe();
        iframe.remove();
    };
}
```

`subscribeToRoomIntegrationPicker` checks both the origin and the source window of every message, then reports the first `submitted`, `cancelled` or `error` outcome and stops listening. `getSource` is a function because `contentWindow` is `null` until the frame attaches.

Don't add a `sandbox` attribute. Some providers open a window to sign the user in, and a sandbox blocks it without an error.

{% hint style="info" %}
`subscribeToRoomIntegrationPicker` is exported from the `@whereby.com/browser-sdk/react` entry point, which needs `react` and `react-dom` installed even though the function doesn't use them. If you'd rather not install React, write the listener yourself with `ROOM_INTEGRATION_PICKER_MESSAGES` from `@whereby.com/core`:

```ts
import { ROOM_INTEGRATION_PICKER_MESSAGES } from "@whereby.com/core";

function onPickerMessage(event) {
    if (event.origin !== pickerOrigin || event.source !== iframe.contentWindow) {
        return;
    }
    const { type, payload } = event.data || {};
    if (type === ROOM_INTEGRATION_PICKER_MESSAGES.FORM_SUBMIT) {
        // payload: { tagName, shareUrl, props }
    } else if (type === ROOM_INTEGRATION_PICKER_MESSAGES.FORM_CLOSE) {
        // cancelled
    } else if (type === ROOM_INTEGRATION_PICKER_MESSAGES.ERROR) {
        // payload: { message }
    } else {
        return;
    }
    window.removeEventListener("message", onPickerMessage);
}
window.addEventListener("message", onPickerMessage);
```

{% endhint %}

### Or share a link directly

`roomIntegrationContent` builds the content from a YouTube link or a Miro embed link, with no picker:

```ts
import { roomIntegrationContent } from "@whereby.com/core";

const { embeddable } = roomConnection.getState().roomIntegrations;
const youtube = embeddable.find((integration) => integration.name === "youtube");
const content = roomIntegrationContent.youtube({ url: "https://youtu.be/dQw4w9WgXcQ?t=30" });

if (youtube && content) {
    roomConnection.startRoomIntegration({ roomIntegrationId: youtube.roomIntegrationId, ...content });
}
```

`startRoomIntegration` doesn't change local state. The session shows up in `roomIntegrations.running` when the server broadcasts it, for you and everyone else at about the same time.

## Show running integrations

Each running session needs an iframe that speaks the content frame protocol. `mountIntegrationFrame` creates one, handles its messages, and returns `update` and `destroy` functions:

```ts
const PROPS = "whereby:props";

function outboundProps(session) {
    return {
        ...session.props,
        ispresenter: session.isPresenter,
        presenterdisplayname: session.presenterDisplayName,
        roomintegrationsessionid: session.roomIntegrationSessionId,
        breakoutgroupid: session.breakoutGroupId,
    };
}

function mountIntegrationFrame(initialSession, container) {
    let session = initialSession;
    let lastSent = null; // null until the frame says it's ready

    const frameOrigin = new URL(session.integration.webview).origin;
    const src = new URL(session.integration.webview);
    src.searchParams.set("parentOrigin", window.location.origin);
    src.searchParams.set("roomintegrationsessionid", session.roomIntegrationSessionId);

    const iframe = document.createElement("iframe");
    iframe.src = src.href;
    iframe.title = session.integration.title;
    iframe.allow = "autoplay; fullscreen; encrypted-media; picture-in-picture";
    iframe.allowFullscreen = true;
    iframe.style.cssText = "border: none; width: 100%; height: 100%";

    // Always the exact origin, never "*"
    const post = (type, payload) => iframe.contentWindow?.postMessage({ type, payload }, frameOrigin);

    function onMessage(event) {
        // Both checks: other frames from the same integration share this origin
        if (event.origin !== frameOrigin || event.source !== iframe.contentWindow) {
            return;
        }
        const { type, payload } = event.data || {};
        const { roomIntegrationSessionId } = session;

        switch (type) {
            case "whereby:frameReady":
                // First load or a reload: send everything
                lastSent = outboundProps(session);
                post(PROPS, lastSent);
                break;
            case "whereby:updateProps":
                // Send to the room. The change comes back through the state and update() below.
                if (payload?.props) {
                    roomConnection.updateRoomIntegrationProps({ roomIntegrationSessionId, props: payload.props });
                }
                break;
            case "whereby:close":
                if (session.canStop) {
                    roomConnection.stopRoomIntegration({ roomIntegrationSessionId, intent: "end" });
                }
                break;
        }
    }

    window.addEventListener("message", onMessage);
    container.appendChild(iframe);

    return {
        update(nextSession) {
            session = nextSession;
            if (!lastSent) {
                return; // whereby:frameReady will send the full props
            }
            const next = outboundProps(session);
            const patch = {};
            for (const key of Object.keys(next)) {
                if (next[key] !== lastSent[key]) {
                    patch[key] = next[key];
                }
            }
            lastSent = next;
            if (Object.keys(patch).length) {
                post(PROPS, patch);
            }
        },
        destroy() {
            window.removeEventListener("message", onMessage);
            iframe.remove();
        },
    };
}
```

Then keep one frame per running session. Mount new sessions, update existing ones, and destroy the ones that stopped:

```ts
const frames = new Map(); // roomIntegrationSessionId -> { update, destroy }
const stage = document.querySelector("#stage");

function syncIntegrationFrames(running) {
    const ids = new Set(running.map((session) => session.roomIntegrationSessionId));

    for (const [id, frame] of frames) {
        if (!ids.has(id)) {
            frame.destroy();
            frames.delete(id);
        }
    }

    for (const session of running) {
        const existing = frames.get(session.roomIntegrationSessionId);
        if (existing) {
            existing.update(session);
        } else {
            frames.set(session.roomIntegrationSessionId, mountIntegrationFrame(session, stage));
        }
    }
}
```

`running` already only contains sessions for where you are, the main room or your breakout group. Late joiners get the running sessions when they join, so `syncIntegrationFrames` mounts them on the first state update.

### Optional messages

`mountIntegrationFrame` leaves out the messages you don't strictly need. Add them to the `switch` if you want them:

* `whereby:contentReady` tells you the content has loaded, so you can hide a spinner.
* `whereby:audioOverride` with `{ enabled: false }` asks you to turn the local microphone off, and `{ enabled: null }` drops that request.
* `whereby:setVolume` and `whereby:getVolume` control the volume on this device. YouTube takes `0` to `1`.

The [iframe protocol reference](/reference/core-sdk-reference/api-reference/room-integration-iframe-protocol) has every payload.

### Don't move the iframe

Moving an iframe to another parent, or removing and re-adding it, reloads it. The frame posts `whereby:frameReady` again and the code above resends the full props, so nothing breaks, but a YouTube video restarts its player. Mount each frame once and change its size and position with CSS when your layout changes.

## Stop sharing

```ts
for (const session of roomConnection.getState().roomIntegrations.running) {
    if (session.canStop) {
        roomConnection.stopRoomIntegration({ roomIntegrationSessionId: session.roomIntegrationSessionId });
    }
}
```

`canStop` is `true` for the participant who started the session and for hosts. For anyone else, `stopRoomIntegration` sets the `not_allowed_to_stop` error and sends nothing.

## Start from Node

`roomIntegrationContent` doesn't need a browser, so a Node process in the room can start a share. An [Assistant](/reference/assistant-sdk-reference) can queue up a video when a session starts, for example. The Assistant SDK installs `@whereby.com/core`, so you can import from both:

```ts
import "@whereby.com/assistant-sdk/polyfills";
import { Assistant } from "@whereby.com/assistant-sdk";
import { roomIntegrationContent, type RoomIntegrationsState } from "@whereby.com/core";

const assistant = new Assistant({ assistantKey: "my-assistant-key" });
await assistant.joinRoom("https://your-subdomain.whereby.com/your-room-name");

const roomConnection = assistant.getRoomConnection();

// The list of integrations loads after joining. Wait for it.
const roomIntegrations = await new Promise<RoomIntegrationsState>((resolve) => {
    const check = (state) => {
        if (state.roomIntegrations.hasFetched) {
            unsubscribe();
            resolve(state.roomIntegrations);
        }
    };
    const unsubscribe = roomConnection.subscribe(check);
    check(roomConnection.getState());
});

const youtube = roomIntegrations.embeddable.find((integration) => integration.name === "youtube");
const content = roomIntegrationContent.youtube({ url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ" });

if (youtube && content) {
    roomConnection.startRoomIntegration({ roomIntegrationId: youtube.roomIntegrationId, ...content });
}
```

The Assistant is the presenter for that session, so it can stop it later. Everyone in the room still needs a browser to see the content. The Assistant only starts and stops sessions, it doesn't render anything.

Check `roomConnection.getState().roomIntegrations.error` after starting, in case the server refuses the request.

## Limitations

The [limitations in the React guide](/whereby-for-web-browser/react-based-browser-sdk/sharing-youtube-and-miro#limitations) apply here too. Only YouTube and Miro render in SDK apps, Miro needs an embed link, and there's no core helper for the content frame.


# Migrating from version 2.x to 3

Version 3 of the browser-sdk contains three breaking changes:

* `WherebyProvider` is now **required** to be rendered, and all usage of browser-sdk needs to be in children of the provider.
* `useRoomConnection` does **not** automatically join the room any longer. It's required to manually call `joinRoom()` from `useRoomConnection.actions`
* `useRoomConnection.components` is **deprecated.**

## Provider

It's now mandatory to wrap your react app in a `WherebyProvider.`

This is typically done in the `index.tsx/js` file.

```tsx
import * as React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import App from './App'
import { WherebyProvider } from '@whereby.com/browser-sdk/react'

ReactDOM.render(
  <WherebyProvider>
    <App />
  </WherebyProvider>,
  document.getElementById('root')
);
```

## joinRoom

Starting in version `3.0.0`, The `useRoomConnection` hook does not automatically join the room when initialized. It's required to manually call the `joinRoom()` function. This gives you as the developer more control of the lifecycle of the room connection. It's still possible to auto-join, but it requires some additional code. This code snippet mimicks the old behaviour, and auto-joins when the component is mounted.

```tsx
function MyVideoApp( { roomUrl, localStream }) {
    const { state, actions } = useRoomConnection(
        "<room_url>"
        {
            localMediaOptions: {
                audio: true,
                video: true,
            }
        }
    );

    const { connectionState, remoteParticipants } = state;
    const { joinRoom, leaveRoom } = actions;
    
    React.useEffect(() => {
        joinRoom();
        return () => leaveRoom();
    }, []);

    return <div className="videoGrid">
        { /* Render any UI, making use of state */ }
        { remoteParticipants.map((p) => (
            <VideoView key={p.id} stream={p.stream} />
        )) }
    </div>;
}
```

## useRoomConnection.components

From version `3`, the `useRoomConnection.components` field is deprecated. It's no longer needed to bind components to the room connection, since we have the provider. The only change required is to import components directly from the library, instead of getting them from the hook.<br>

This is an example of rendering a `VideoView` in version `2:`

```tsx
import { useRoomConnection } from "@whereby.com/browser-sdk/react";

function MyVideoApp( { roomUrl, localStream }) {
    // The components field here is now deprecated.
    const { state, actions, components } = useRoomConnection(
        "<room_url>"
        {
            localMediaOptions: {
                audio: true,
                video: true,
            }
        }
    );

    const { connectionState, remoteParticipants } = state;
    const { joinRoom, leaveRoom } = actions;
    // This is the old way of getting the VideoView component
    const { VideoView } = components;
    
    React.useEffect(() => {
        joinRoom();
        return () => leaveRoom();
    }, []);

    return <div className="videoGrid">
        { /* Render any UI, making use of state */ }
        { remoteParticipants.map((p) => (
            <VideoView key={p.id} stream={p.stream} />
        )) }
    </div>;
}
```

In version `3` , the code will look like this instead:

```tsx
import { VideoView, useRoomConnection } from "@whereby.com/browser-sdk/react";

function MyVideoApp( { roomUrl, localStream }) {
    const { state, actions } = useRoomConnection(
        "<room_url>"
        {
            localMediaOptions: {
                audio: true,
                video: true,
            }
        }
    );

    const { connectionState, remoteParticipants } = state;
    const { joinRoom, leaveRoom } = actions;
    
    React.useEffect(() => {
        joinRoom();
        return () => leaveRoom();
    }, []);

    return <div className="videoGrid">
        { /* Render any UI, making use of state */ }
        { remoteParticipants.map((p) => (
            <VideoView key={p.id} stream={p.stream} />
        )) }
    </div>;
}
```


# Whereby in Next.js

Next.js is a popular framework for React and is rendered server-side. The Whereby browser-sdk relies on browser specific API’s to work so due to this, usage with Next.js has some challenges.

The default way of building Next.js app currently uses an [app router architecture](https://nextjs.org/docs/app/building-your-application/routing#the-app-router). Conceptually, the in-room functionality of a Whereby call happens in a single route (there should be no reloads in the middle of a call). This means:

1. We need to dedicate a single page route for the call
2. Make sure the page is running on the `client,` in order have access to the necessary browser API’s.

{% hint style="info" %}
In Next.js, every component is a server component by default. You need to opt-out to make use of browser specific API’s. This can be done by adding `“use client”` directive at the top of a file, above the imports.
{% endhint %}

Read more about client components in the Next.js documentation [here](https://nextjs.org/docs/app/building-your-application/rendering/client-components). Unfortunately, this is not enough for our use case. Client components in Next.js are still pre-rendered by default, and we need to opt-out of that as well, to be able to access all the browser API’s we need. We can do this with `next/dynamic`. See more info [here](https://nextjs.org/docs/app/building-your-application/optimizing/lazy-loading#nextdynamic).

### Provider

We need a “client” component that will setup our connection to Whereby for us, and provide us with the global Whereby state.

`components/provider.tsx`

```tsx
"use client";

import * as React from "react";

import { WherebyProvider } from "@whereby.com/browser-sdk/react";

function Provider({ children }: { children: React.ReactNode }) {
    return (
        <WherebyProvider>
            <>{children}</>
        </WherebyProvider>
    );
}

export default Provider;

```

The next step is to include this provider anywhere in the app, but it needs to be above (a parent of), any component that will utilize the Whereby SDK. The root level `layout.tsx` is a natural place to put it, and that gives all pages and components access to it. We need to import it using Next.js dynamic import, like this:

`app/layout.tsx`

```tsx
const Provider = dynamic(() => import("../components/provider"), { ssr: false });
```

### The room component

We can now create a room component, this is a minimal example:

`components/room.tsx`

```tsx
"use client";

import * as React from "react";

import { useRoomConnection, VideoGrid } from "@whereby.com/browser-sdk/react";

interface Props {
    roomUrl: string;
}

function Room({ roomUrl }: Props) {
    const { actions } = useRoomConnection(roomUrl, { localMediaOptions: { audio: true, video: true } });
    const { joinRoom, leaveRoom } = actions;

    React.useEffect(() => {
        joinRoom();
        return () => leaveRoom();
    }, [joinRoom, leaveRoom]);

    return (
        <div className={"w-full h-full"}>
            <VideoGrid />
        </div>
    );
}

export default Room;

```

As with the provider, this also needs to be a client component. To see more examples of how to customize the room layout, you can see a more in-depth guide on that [here.](/telehealth-industry-solutions/using-whereby-react-hooks-build-a-telehealth-app)

### Using the room component

Now we can import and use the room component anywhere in our app. The important thing to remember is that we need to use Next.js’s `dynamic` import, as explained in the beginning of this guide.

`app/page.tsx`

```tsx
import * as React from "react";
import dynamic from "next/dynamic";

const Room = dynamic(() => import("../components/room"), { ssr: false });

// Replace this with your own Whereby room URL
const roomUrl = "";

export default function Home() {
    return (
        <main className="h-screen w-screen">
            <Room roomUrl={roomUrl} />
        </main>
    );
}

```

That should be all that’s needed to run the Whereby browser-sdk in Next.js. We also have an example implementation of this in our [repository](https://github.com/whereby/sdk/tree/main/apps/nextjs-example), where you can see a working example of a setup with Next.js and the Whereby browser-sdk.


# Whereby for iOS

You can add Whereby to your iOS app with a native SDK or a WebView approach, depending on how much control you need.

Whereby Embedded works great in mobile browsers, but we support native iOS integrations as well.

### Choose your approach

{% columns %}
{% column %}
**🚀 iOS SDK**

Recommended for a more native iOS experience and faster integration.

**→** [Start with the iOS SDK](/whereby-for-mobile-development/whereby-for-ios/using-wherebys-native-sdk)
{% endcolumn %}

{% column %}
**🔧 WKWebView**

Best if you already use WebView in your app or want more manual control.

**→** [Use the WKWebView approach](/whereby-for-mobile-development/whereby-for-ios/in-ios-apps)
{% endcolumn %}
{% endcolumns %}

***

### Compare the options

* The **iOS SDK** provides the most native experience and is the quickest way to get started.
* The **WKWebView** approach offers more flexibility for custom implementations.
* **Both approaches** support customization depending on your app’s needs.


# Whereby Native iOS SDK

{% embed url="<https://www.youtube.com/watch?v=ZX27LEH_Ut4>" %}

The Whereby iOS SDK enables you to integrate Whereby into your iOS app as a native component, rather than a web-based experience. This offers control and customization over the meeting experience, and allows you to hook into powerful features such as listening to room events and sending commands to the room from the host application. Please note that certain features available on web may not yet be supported in the native iOS SDK.

## Quickstart guide

Below you'll find some basic guidance to help you get started. But for detailed instructions check out the [SDK documentation on GitHub](https://github.com/whereby/ios-sdk), or play around with our [iOS demo app](https://github.com/whereby/ios-sdk-demo), which showcases the available customization options.

### Prerequisites

This guide assumes that you’ve already created a Whereby Embedded account and a meeting room. If you’ve not already taken these steps, you can do so by following the [Whereby Embedded initial setup guide](/getting-started/overview-of-whereby-embedded/initial-setup).

### Setting up the app

Create a new project for a simple app using the latest version of Xcode.

### Installing the Whereby native iOS SDK

#### Using Swift Package Manager

1. Open your project in Xcode and select File > Add Package Dependencies...
2. In the Search or Enter Package URL text field, search for `Whereby` or enter the repository URL:

   ```
   https://github.com/whereby/ios-sdk.git
   ```
3. Add the package

For more details, see [Adding Package Dependencies to Your App](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app).

#### Using CocoaPods

{% hint style="warning" %}
CocoaPods: New versions of the Whereby iOS SDK will no longer be published to CocoaPods after **October 2026**. Existing CocoaPods versions will remain available and installations will remain functional. Please migrate to Swift Package Manager.
{% endhint %}

1. Add the `WherebySDK` pod to your project's Podfile:

   ```bash
   target 
       ...
       pod 'WherebySDK'
   end
   ```
2. In the Terminal, navigate to the directory containing your Podfile and run:

   ```bash
   pod install
   ```

For more details, see [Cocoapods Instructions](https://cocoapods.org/pods/Instructions).

### Setting the required permissions and capabilities

To get a Whereby instance running on iOS, you need to set a series of **permissions** — Whereby requires access to the phone's camera, microphone, and photo library (for file sharing).

Declare the required permissions in your `Info.plist` file like so:

```xml
<key>NSCameraUsageDescription</key>
<string>This app requires access to your camera</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app requires access to your microphone</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>This app requires access to your photo library to save photos or videos</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to your photo library to view and select photos for uploading or sharing</string>
```

We also recommend enabling two **background modes** in your app target, under the `Signing & Capabilities` tab:&#x20;

* Audio, AirPlay, and Picture in Picture
* Voice over IP

Without them, iOS suspends your app shortly after the user locks the screen or switches to another app. A user waiting to be let into a locked room silently disappears from the host's view; a call in progress could lose its connection. With the audio background mode enabled, the Whereby SDK keeps the call's audio session running so the connection stays alive in the background. The Voice over IP mode complements the SDK's CallKit integration, which shows the calls in the system call UI and on the lock screen.

### Embedding Whereby

Replace the initial/main `UIViewController` with the code below and update the room URL in the example to your own Whereby room URL.

{% tabs %}
{% tab title="Swift" %}

```swift
import UIKit
import WherebySDK

class ViewController: UIViewController {
    
    private var url = URL(string: "https://your-whereby-room-URL")!

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        
        // Configure how to join the room. The only mandatory parameter is the room URL.
        let roomConfig = WherebyRoomConfig(url: url)
        
        // Instantiate the WherebyRoomViewController and set the presentation style.
        let roomViewController = WherebyRoomViewController(config: roomConfig, isPushedInNavigationController: false)
        roomViewController.modalPresentationStyle = .fullScreen

        // Finally, present the WherebyRoomViewController and join the room.
        present(roomViewController, animated: true) {
            roomViewController.join()
        }
    }
}
```

{% endtab %}
{% endtabs %}

Run this simple app on a device to explore the full potential of the Whereby native iOS SDK in action.

***

## Customization

{% hint style="info" %}
Note that URL Parameters are not supported with the Native iOS SDK
{% endhint %}

You can modify the room configuration (`WherebyRoomConfig`) to preselect the media mode (audio-only or video).

You can also customize the `WherebyRoomViewController` to tailor the user experience to your use case. For example, you can:

* Show or hide specific UI elements (header, buttons, control bar, etc.).
* Set a background color, like any standard `UIViewController`.
* Send commands such as toggling the microphone or camera if you prefer to implement your own controls.

Additionally, you can set up a delegate (`WherebyRoomViewControllerDelegate`) to listen for events, such as when a participant joins or leaves the room.

For a complete list of supported customization options, check out our [Demo App](https://github.com/whereby/ios-sdk-demo) repository. If there’s a customization feature you’d like to see in the future, please submit an issue for review.


# Using a WKWebView

When embedding Whereby in a WebView, you will have access to all features available on the web, directly within your iOS app. While it is relatively simple to build a basic app this way, please note that it comes with certain limitations compared to a native implementation, such as restricted background mode support, additional logic required for file sharing, etc.

## Quickstart guide

This guide shows you how to embed a Whereby room in a native iOS app using the [WKWebView](https://developer.apple.com/documentation/webkit/wkwebview) class. After that, it also introduces some customization options to give you an idea of what’s available. For a complete running example, checkout our [iOS WebView demo app](https://github.com/whereby/ios-webview-demo) repository.

{% hint style="info" %}
The example built up in this article is based on `Whereby Web`, which provides advanced tools, such as integrations and Breakout Groups. However, we also offer a [native iOS SDK](/whereby-for-mobile-development/whereby-for-ios/using-wherebys-native-sdk) that allows you to customize the user experience in your iOS app. With the iOS SDK, you can create custom iOS UIButtons and UIViews, send commands to the room, and listen to room events to implement custom callbacks.
{% endhint %}

### Prerequisites

This guide assumes that you’ve already created a Whereby Embedded account and a meeting room. If you’ve not already taken these steps, you can do so by following the [Whereby Embedded initial setup guide](/getting-started/overview-of-whereby-embedded/initial-setup).

When embedding Whereby in a WebView, depending on your implementation, you can use the following types of URLs:

* A Whereby room URL (which takes the user directly to the Whereby pre-call screen).
* A custom web app that embeds Whereby using the Embedded element.
* A React app that embeds Whereby with the React Hooks SDK.

### Setting up the app

Create a new project for a simple app using the latest version of Xcode.

### Setting the required permissions

To get a Whereby instance running on iOS, you need to set a series of permissions — Whereby requires access to the phone's camera, microphone, and photo library (for file sharing).

Declare the required permissions in your `Info.plist` file like so:

```xml
<key>NSCameraUsageDescription</key>
<string>This app requires access to your camera</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app requires access to your microphone</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>This app requires access to your photo library to save photos or videos</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to your photo library to view and select photos for uploading or sharing</string>
```

### Embedding Whereby

The next step is to set up a [WKWebView](https://developer.apple.com/documentation/webkit/wkwebview) class ready for embedding the Whereby instance. This supports embedding pages that use WebRTC from iOS 14.5 onwards.

Replace the initial/main `UIViewController` with the code below and update the URL in the example to your own Whereby room URL or web app URL.

{% tabs %}
{% tab title="Swift" %}

```swift
import UIKit
import WebKit

class ViewController: UIViewController {
    
    private var webView: WKWebView!
    private var url = URL(string: "https://your-whereby-room-URL")!

    override func viewDidLoad() {
        super.viewDidLoad()

        // Create a configuration for the WKWebView:
        let config = WKWebViewConfiguration()
        config.allowsInlineMediaPlayback = true
        config.mediaTypesRequiringUserActionForPlayback = []
        
        // Initialize the WKWebView with the custom configuration and delegate:
        webView = WKWebView(frame: .zero, configuration: config)
        
        // Add the webView to the view hierarchy:
        view.addSubview(webView)
        
        // Apply constraints to the webView
        webView.translatesAutoresizingMaskIntoConstraints = false
        NSLayoutConstraint.activate([
            webView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 0),
            webView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: 0),
            webView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 0),
            webView.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0)
        ])

        // Finally: load the webView
        webView.load(URLRequest(url: url))
    }
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
This is a minimal implementation that sticks to the default behavior of WKWebView. It is recommended to extend the configuration by implementing delegate methods to improve the user experience. For example, you can:

* Avoid repeated media permission prompts.
* Enable and manage file sharing.
* Handle external link redirections.

For a complete example, check out our public repository: [ios-webview-demo](https://github.com/whereby/ios-webview-demo).
{% endhint %}

***

## Customizing your app

Now that you’ve got a basic app running, you’ll want to customize it to your liking. Whereby has many options for customizing your app:

* Global settings via your account dashboard
* Per-room settings via component [attributes](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes) and [room creation settings](/whereby-product-features/using-the-rest-api).

In this section, we’ll go through a couple of options to give you an idea of what’s available.

#### Setting custom brand colors

1. In your account dashboard: Go to the **Configure** screen and access the **Appearance** panel.
2. Set new primary, secondary, and focus highlight colors.
3. Set a new background color, and upload a background image.
4. Upload a company logo.
5. Re-run your app to see how these settings change the look and feel.

#### Setting web component attributes

There are many different attributes you can set on the web component to configure various aspects of the video call experience. Let's add some to the room URL:

```swift
private var url = URL(string: "https://your-whereby-room-URL?skipMediaPermissionPrompt&minimal")!
```

The effect of the attributes is as follows:

* `skipMediaPermissionPrompt`: Skip the screen prompting the user to grant permission, as this can be handled directly by the WebView itself.
* `minimal`: Uses the minimal Whereby UI.

Save your code and re-run your app to see the effect of the attributes.

### See also

* [Meeting controls](https://whereby.helpscoutdocs.com/article/458-meeting-controls)


# Whereby for Android

Bring video calling to your Android app using Whereby’s native SDK or a WebView-based setup.

Mobile browser is the easiest way in, but Whereby also supports native Android integrations.

### Choose your approach

{% columns %}
{% column %}
**🚀 Android SDK**

Recommended for a more native Android experience and faster setup.

**→** [Start with the Android SDK](/whereby-for-mobile-development/whereby-for-android/using-wherebys-native-sdk)
{% endcolumn %}

{% column %}
**🔧 WebView**

Best if your app already uses WebView or you want more configuration control.

**→** [Use the WebView approach](/whereby-for-mobile-development/whereby-for-android/in-android-apps)
{% endcolumn %}
{% endcolumns %}

***

### Compare the options

* The **Android SDK** handles more setup for you and is the quickest way to launch.
* The **WebView** approach gives you greater flexibility, but requires more manual configuration.
* Choose the path that best fits your app architecture and customization needs.


# Whereby Android SDK

The Whereby Android SDK is [available through Jitpack](https://jitpack.io/#whereby/android-sdk) and can also be found on [GitHub](https://github.com/whereby/android-sdk). It loads the Whereby web component through a WebView and integrates with your editor to make it easier to customize the Whereby Embedded experience. You can also hook into powerful features, such as listening to room events and sending commands to the room from the host application. This gives you the possibility to implement your own controls. Media permissions are already handled in the SDK.

## Quickstart guide

This guide shows you how to embed a Whereby room in a native Android app using the Whereby Android SDK. For a complete running example, checkout our [Android SDK demo app](https://github.com/whereby/android-sdk-demo) repository.

### Prerequisites

This guide assumes that you’ve already created a Whereby Embedded account and a meeting room. If you’ve not already taken these steps, you can do so by following the [Whereby Embedded initial setup guide](/getting-started/overview-of-whereby-embedded/initial-setup).

### Setting up the app

To start, open the latest version of Android Studio and create a new project with an empty Activity, keeping the recommended settings.

### Installing the Whereby SDK

The framework is distributed using [Jitpack](https://docs.jitpack.io/). If it is not already the case, add the Maven and Jitpack repositories to your Android project. This can be done either in the project **build.gradle** file (not to be confused with the *module* build.gradle file) or in the **settings.gradle** file:

{% tabs %}
{% tab title="Groovy DSL" %}

```groovy
repositories {
    ...
    mavenCentral()
    maven { url 'https://jitpack.io' }  
}
```

{% endtab %}

{% tab title="Kotlin DSL" %}

<pre class="language-kotlin"><code class="lang-kotlin">repositories {
    ...
    mavenCentral()
    maven("https://jitpack.io")
<strong>}
</strong></code></pre>

{% endtab %}
{% endtabs %}

Then, add the Whereby SDK dependency to your module **build.gradle** file. You can specify either a full name `X.X.X` version (see the [list of released versions](https://github.com/whereby/android-sdk/releases)), or simply use a range format `X.+`:

{% tabs %}
{% tab title="Groovy DSL" %}

```groovy
dependencies {
    ...
    def WHEREBY_SDK_VERSION = '1.+'
    implementation("com.github.whereby:android-sdk:$WHEREBY_SDK_VERSION@aar") { transitive = true }
}
```

{% endtab %}

{% tab title="Kotlin DSL" %}

```kotlin
dependencies {
    val wherebySdkVersion = "1.+"
    implementation("com.github.whereby:android-sdk:$wherebySdkVersion@aar") {
        isTransitive = true
    }
}
```

{% endtab %}
{% endtabs %}

*Remember to sync your project after updating the gradle files.*

### Implementing the main activity

Unlike the WebView approach, there is no need to manually set up permissions — these are already handled by the SDK.

Replace the app's main Activity with the code below, and update the URL in the example to your own Whereby room URL.

{% tabs %}
{% tab title="Java" %}

```java
package com.example.myapplication;

import android.os.Bundle;
import androidx.fragment.app.FragmentActivity;

import com.whereby.sdk.*;

public class MainActivity extends FragmentActivity {

    // Replace with your own
    public static final String ROOM_URL_STRING = "https://your-whereby-room-URL";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (savedInstanceState != null) return;

        // 1. Setup the WherebyRoomConfig
        WherebyRoomConfig config = new WherebyRoomConfig(ROOM_URL_STRING);

        // 2. Instantiate the WherebyRoomFragment to be presented
        WherebyRoomFragment fragment = WherebyRoomFragment.newInstance(config);

        // 3. Replace the fragment with the WherebyRoomFragment
        getSupportFragmentManager()
                .beginTransaction()
                .replace(android.R.id.content, fragment, "tag")
                .commit();
    }
}
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
package com.example.myapplication

import android.os.Bundle
import androidx.fragment.app.FragmentActivity
import com.whereby.sdk.*

class MainActivity : FragmentActivity() {

    companion object {
        // Replace with your own
        const val ROOM_URL_STRING = "https://your-whereby-room-URL"
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        if (savedInstanceState != null) return

        // 1. Setup the WherebyRoomConfig
        val config = WherebyRoomConfig(ROOM_URL_STRING)

        // 2. Instantiate the WherebyRoomFragment to be presented
        val fragment = WherebyRoomFragment.newInstance(config)

        // 3. Replace the fragment with the WherebyRoomFragment
        supportFragmentManager
            .beginTransaction()
            .replace(android.R.id.content, fragment, "tag")
            .commit()
    }
}
```

{% endtab %}
{% endtabs %}

### Testing the app

Run the app in Android Studio, and you should see your Whereby instance running, allowing you to join the room with both camera and microphone enabled.

{% hint style="info" %}
This is a minimal implementation. It is recommended to extend the configuration to improve the user experience. For example, you can:

* Send commands to the `WherebyRoomFragment` to toggle the camera or microphone, allowing you to implement your own controls.
* Listen for room events, such as when the user leaves the room, to redirect them to the previous screen.

For a complete example that support both Activity and Fragment, check out our public repository: [android-sdk](https://github.com/whereby/android-sdk-demo)[-demo](https://github.com/whereby/android-sdk-demo).
{% endhint %}

***


# Using a WebView

When embedding Whereby in a WebView, you will have access to all features available on the web, directly within your Android app. While it is relatively simple to build a basic app this way, please note that it comes with certain limitations, such as restricted background mode support, additional logic required for file sharing, etc.

{% hint style="info" %}
We offer an [Android SDK](/whereby-for-mobile-development/whereby-for-android/using-wherebys-native-sdk) that is a wrapper around a WebView and allows you to tap into powerful features such as listening to room events and using custom buttons to send commands to the room from your application. It also already handles the media permissions.
{% endhint %}

## Quickstart guide

This guide shows you how to embed a Whereby room in a native Android app using a WebView. After that, it also introduces some customization options to give you an idea of what’s available. For a complete running example, check out our [Android WebView demo app](https://github.com/whereby/android-webview-demo) repository.

### Prerequisites

This guide assumes that you’ve already created a Whereby Embedded account and a meeting room. If you’ve not already taken these steps, you can do so by following the [Whereby Embedded initial setup guide](/getting-started/overview-of-whereby-embedded/initial-setup).

When embedding Whereby in a WebView, depending on your implementation, you can use the following types of URLs:

* A Whereby room URL (which takes the user directly to the Whereby pre-call screen).
* A custom web app that embeds Whereby using the Embedded element.
* A React app that embeds Whereby with the React Hooks SDK.

### Setting up the app

To start, open the latest version of Android Studio and create a new project with an empty Activity, keeping the recommended settings.

### Setting the required permissions

To run a Whereby instance on Android, you must grant a set of permissions — including access to the device’s camera, internet connectivity, audio settings, and recording capabilities. Additional permissions may be required if, for example, you need to store shared files; however, these are not covered in this guide.

Add the following permissions to your app's manifest file:

{% tabs %}
{% tab title="XML" %}

```xml
<manifest>
    ...
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    ...
</manifest>
```

{% endtab %}
{% endtabs %}

### Implementing the main activity

Replace the app's main Activity with the code below and update the URL in the example to your own Whereby room URL or web app URL.

{% tabs %}
{% tab title="Java" %}

```java
package com.example.androidwebview5;

import android.Manifest;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.webkit.PermissionRequest;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.Toast;

import androidx.annotation.NonNull;

public class MainActivity extends Activity {

    public static final String ROOM_URL = "https://your-whereby-room-URL";
    private static final String ROOM_PARAMS = "?skipMediaPermissionPrompt"; // Permissions are handled manually in code
    private static final int PERMISSION_REQUEST_CODE = 1;

    private static final String[] RUNTIME_PERMISSIONS = new String[] {
            Manifest.permission.CAMERA,
            Manifest.permission.RECORD_AUDIO
    };

    private WebView webView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // 1. Configure the WebView settings
        webView = new WebView(this);
        WebSettings settings = webView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setDomStorageEnabled(true);
        settings.setDatabaseEnabled(true);
        settings.setMediaPlaybackRequiresUserGesture(false);

        // 2. Set a custom WebChromeClient to handle the media permissions
        webView.setWebChromeClient(new WebChromeClient() {
            @Override
            public void onPermissionRequest(final PermissionRequest request) {
                runOnUiThread(() -> {
                    request.grant(request.getResources());
                });
            }
        });

        // 3. Setup the activity content view with the webView
        setContentView(webView);
        
        // 4. Request the permisssions
        requestPermissions(RUNTIME_PERMISSIONS, PERMISSION_REQUEST_CODE);
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);

        if (requestCode == PERMISSION_REQUEST_CODE) {
            boolean allGranted = true;
            for (int r : grantResults) {
                if (r != PackageManager.PERMISSION_GRANTED) { allGranted = false; break; }
            }
            if (allGranted) {
                webView.loadUrl(ROOM_URL + ROOM_PARAMS);
            } else {
                Toast.makeText(this, "Camera/mic permission denied.", Toast.LENGTH_LONG).show();
            }
        }
    }
}
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
package com.example.androidwebview5

import android.Manifest
import android.app.Activity
import android.content.pm.PackageManager
import android.os.Bundle
import android.webkit.PermissionRequest
import android.webkit.WebChromeClient
import android.webkit.WebSettings
import android.webkit.WebView
import android.widget.Toast

class MainActivity : Activity() {

    companion object {
        private const val ROOM_URL = "https://your-whereby-room-URL"
        private const val ROOM_PARAMS = "?skipMediaPermissionPrompt" // Permissions are handled manually in code
        private const val PERMISSION_REQUEST_CODE = 1

        private val RUNTIME_PERMISSIONS = arrayOf(
            Manifest.permission.CAMERA,
            Manifest.permission.RECORD_AUDIO
        )
    }

    private lateinit var webView: WebView

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        // 1. Configure the WebView settings
        webView = WebView(this)
        val settings: WebSettings = webView.settings
        settings.javaScriptEnabled = true
        settings.domStorageEnabled = true
        settings.databaseEnabled = true
        settings.mediaPlaybackRequiresUserGesture = false

        // 2. Set a custom WebChromeClient to handle the media permissions
        webView.webChromeClient = object : WebChromeClient() {
            override fun onPermissionRequest(request: PermissionRequest) {
                runOnUiThread {
                    request.grant(request.resources)
                }
            }
        }

        // 3. Setup the activity content view with the webView
        setContentView(webView)

        // 4. Request the permissions
        requestPermissions(RUNTIME_PERMISSIONS, PERMISSION_REQUEST_CODE)
    }

    override fun onRequestPermissionsResult(
        requestCode: Int,
        permissions: Array<out String>,
        grantResults: IntArray
    ) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults)

        if (requestCode == PERMISSION_REQUEST_CODE) {
            val allGranted = grantResults.all { it == PackageManager.PERMISSION_GRANTED }
            if (allGranted) {
                webView.loadUrl(ROOM_URL + ROOM_PARAMS)
            } else {
                Toast.makeText(this, "Camera/mic permission denied.", Toast.LENGTH_LONG).show()
            }
        }
    }
}

```

{% endtab %}
{% endtabs %}

### Testing the app

Run the app in Android Studio, and you should see your Whereby instance running, allowing you to join the room with both camera and microphone enabled.

{% hint style="info" %}
This is a minimal implementation that sticks to the default behavior of WebView. It is recommended to extend the configuration to improve the user experience. For example, you can:

* Enable and manage file sharing.
* Handle external link redirections.

For a complete example that support both Activity and Fragment, check out our public repository: [android-webview-demo](https://github.com/whereby/android-webview-demo).
{% endhint %}

***

### Customizing your app

Now that you’ve got a basic app running, you’ll want to customize it to your liking. Whereby has many options for customizing your app:

* Global settings via your account dashboard.
* Per-room settings via component [attributes](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes) and [room creation settings](/whereby-product-features/using-the-rest-api).

In this section, we’ll go through a couple of options to give you an idea of what’s available.

#### Setting custom brand colors

1. In your account dashboard: Go to the **Configure** screen and access the **Appearance** panel.
2. Set new primary, secondary, and focus highlight colors.
3. Set a new background color, and upload a background image.
4. Upload a company logo.
5. Re-run your app to see how these settings change the look and feel.

#### Setting web component attributes

There are many different attributes you can set on the web component to configure various aspects of the video call experience. Let's add some to the room URL:

```java
ROOM_URL = "https://your-whereby-room-URL?skipMediaPermissionPrompt&minimal"
```

The effect of the attributes is as follows:

* `skipMediaPermissionPrompt`: Skip the screen prompting the user to grant permission, as this can is already handled in the code.
* `minimal`: Uses the minimal Whereby UI.

Save your code and re-run your app to see the effect of the attributes.

### See also

* [Meeting controls](https://whereby.helpscoutdocs.com/article/458-meeting-controls)


# Whereby in React Native

If you're building with React Native, you can integrate Whereby using either our SDK or a WebView-based approach, depending on your needs.

### Choose your approach

{% columns %}
{% column %}
**🚀 React Native SDK**

Recommended if you want the fastest path to a native integration.

**→** [Start with the React Native SDK](/whereby-for-mobile-development/in-react-native/quick-start)
{% endcolumn %}

{% column %}
**🔧 WebView**

Best if your app already uses WebView or you want more manual control.

**→** [Use the WebView approach](/whereby-for-mobile-development/in-react-native/in-react-native)
{% endcolumn %}
{% endcolumns %}

***

### Compare the options

* The **SDK** is the quickest way to get started and handles more set up for you.
* The **WebView** approach offers more flexibility if you already rely on WebView in your app.
* **Both** **options** support customization depending on your use case.


# Whereby React Native SDK

The Whereby React Native SDK can be found on [GitHub](https://github.com/whereby/sdk/tree/main/packages/react-native-sdk). It loads the Whereby web component through a WebView and integrates with your editor to make it easier to customize the Whereby Embedded experience. You can also listen to room events and send commands to the room from the host application, giving you the possibility to implement your own controls.

## Quickstart guide

This guide shows you how to embed a Whereby room in an Expo app using the Whereby React Native SDK. For a complete running example, check out our [React Native SDK demo app](https://github.com/whereby/sdk/tree/main/apps/react-native-webview-example) repository.

### Prerequisites

This guide assumes that you’ve already created a Whereby Embedded account and a meeting room. If you’ve not already taken these steps, you can do so by following the [Whereby Embedded initial setup guide](/getting-started/overview-of-whereby-embedded/initial-setup).

### Setting up the app

To start, open the terminal to install the latest version of Expo CLI (if you haven’t already), and then create a new Expo app:

```bash
npm install -g expo-cli
npx create-expo-app whereby-rn-app --template blank
cd whereby-rn-app
```

### Installing the Whereby SDK

The official Whereby React Native SDK can be installed via npm or yarn. You will need `expo-camera` and `expo-av` packages to manage the media permissions on Android.

```bash
npm install typescript @types/react
npm install @whereby.com/react-native-sdk
npm install expo-camera
npm install expo-audio
```

### Implementing the app

Open your editor, rename the main file to `App.tsx`, and replace its contents with the following TypeScript code (make sure to update the URL in the example with your own Whereby room URL):

```typescript
import { WherebyEmbed } from "@whereby.com/react-native-sdk/embed";
import { AudioModule } from "expo-audio";
import { Camera } from "expo-camera";
import * as React from "react";
import { Platform, View, Text, Alert } from "react-native";

const ROOM_URL = "https://your-whereby-room-URL";

export default function Room() {

    // iOS renders immediately; Android gates on runtime permissions
    const [hasMediaPermission, setHasMediaPermission] = React.useState(Platform.OS !== "android");

    React.useEffect(() => {
        if (Platform.OS !== "android") return;
        (async () => {
            const [cameraStatus, audioRecordingStatus] = await Promise.all([
                Camera.requestCameraPermissionsAsync(),
                AudioModule.requestRecordingPermissionsAsync(),
            ]);
            if (cameraStatus.granted && audioRecordingStatus.granted) {
                setHasMediaPermission(true);
            } else {
                Alert.alert("Camera and microphone permissions are required", "Please enable them in Settings.");
                setHasMediaPermission(false);
            }
        })();
    }, []);

    if (!hasMediaPermission) {
        return <View />;
    }

    return (
        <View style={{ flex: 1 }}>
            <WherebyEmbed
                style={{ flex: 1 }}
                room={ROOM_URL}
                skipMediaPermissionPrompt
            />
        </View>
    );
}

```

### Running the app

From the terminal, start Expo and use your preferred device (Android or iOS), or a simulator to load the app. Accept the media permissions, and you’ll be able to join the room.

```bash
npx expo start
```

{% hint style="info" %}
This is a minimal implementation. It is recommended to extend the configuration to handle cases where the user denies media permissions and to further improve the user experience. For example, you can:

* Send commands to toggle the camera or microphone, allowing you to implement your own controls.
* Listen for room events, such as when the user leaves the room, to redirect them to the previous screen.

For a complete example, check out our public repository: [react-native-sdk](https://github.com/whereby/sdk/tree/main/apps/react-native-webview-example)[-demo](https://github.com/whereby/android-sdk-demo).
{% endhint %}

### Note for particular implementation

The `expo-audio` and `expo-camera` packages already handle permissions in the manifest and Info.plist. However, if you use a custom implementation, you may need to add the following to your `app.json` or `app.config.ts`:

```json
{
  "expo": {
    "plugins": ["expo-camera", "expo-audio"],
    "android": {
      "permissions": ["CAMERA", "RECORD_AUDIO"]
    },
    "ios": {
      "infoPlist": {
        "NSCameraUsageDescription": "Allow access to camera for video calls.",
        "NSMicrophoneUsageDescription": "Allow access to microphone for calls."
      }
    }
  }
}

```

And then run:

```
eas run -p android
eas run -p ios
```


# Using a WebView

If you’re using React Native CLI, you can embed Whereby rooms with just a few simple steps as laid out in this guide.

{% hint style="success" %}
Before starting, you will need to add the corresponding permissions to be able to access both the camera and microphone, as described in the [Android](/whereby-for-mobile-development/whereby-for-android/in-android-apps) and [iOS](/whereby-for-mobile-development/whereby-for-ios/in-ios-apps) sections.
{% endhint %}

Follow this [guide](https://github.com/react-native-webview/react-native-webview/blob/master/docs/Getting-Started.md#react-native-webview-getting-started-guide) to add and setup the `react-native-webview` library in your React Native project.

Finally, add the WebView component to your code, setup the properties, and fill the room URL and parameters.

{% hint style="warning" %}
It's been reported that the Whereby camera and microphone modals that appear on hover don't always properly close while running in the Android Simulator. If you experience this issue, try running your application on a physical device.
{% endhint %}

Here is a short example:

{% tabs %}
{% tab title="React native" %}

```jsx
import React, { Component } from 'react';
import { WebView } from 'react-native-webview';

const roomUrl = ''; // Replace by your own
const roomParameters = '?needancestor&skipMediaPermissionPrompt';

export default class App extends Component {
  render() {
    return (
      <WebView
        startInLoadingState
        source={{ uri: roomUrl + roomParameters }}
        // If using html as source, you need to include baseUrl: "https://whereby.com" as a secondary prop
        mediaPlaybackRequiresUserAction={false}
        mediaCapturePermissionGrantType={'grant'}

        // iOS specific:
        allowsInlineMediaPlayback

        // Android specific:
        javaScriptEnabled
        domStorageEnabled
      />
    );
  }
}
```

{% endtab %}
{% endtabs %}


# Whereby with Flutter

Flutter is Google's free and open-source UI framework for creating natively compiled cross-platform mobile apps.

### Prerequisites

Before starting, you will need to add the corresponding permissions to be able to access both the camera and microphone as described in the [Android](/whereby-for-mobile-development/whereby-for-android/in-android-apps) and [iOS](/whereby-for-mobile-development/whereby-for-ios/in-ios-apps) sections.

### Getting started <a href="#getting-started" id="getting-started"></a>

We recommend using the [flutter\_inappwebview](https://pub.dev/packages/flutter_inappwebview) and [permission\_handler](https://pub.dev/packages/permission_handler) modules to handle media permissions in the webview. Update the settings in your iOS and Android projects to match the requirements.

{% hint style="warning" %}
Note that there is a [known issue](https://github.com/flutter/flutter/issues/19718) to show the keyboard in Android webviews.
{% endhint %}

Add the WebView component to your code, setup the properties, and fill the room URL and parameters.

Here is a short example:

{% tabs %}
{% tab title="Dart" %}

```dart
import 'package:flutter/material.dart';
import 'dart:io' show Platform;
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:permission_handler/permission_handler.dart';

var _url = ""; // Replace by your own

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    if (Platform.isAndroid) {
      _url += '?skipMediaPermissionPrompt';
    }
    return MaterialApp(
      home: InAppWebViewPage(),
    );
  }
}

class InAppWebViewPage extends StatefulWidget {
  InAppWebViewPage();

  @override
  _InAppWebViewPageState createState() => new _InAppWebViewPageState();
}

class _InAppWebViewPageState extends State<InAppWebViewPage> {
  _InAppWebViewPageState();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: Text("Meeting")),
        body: Container(
            child: Column(children: <Widget>[
          Expanded(
            child: Container(
              child: InAppWebView(
                initialUrlRequest: URLRequest(url: Uri.parse(_url)),
                initialOptions: InAppWebViewGroupOptions(
                    crossPlatform: InAppWebViewOptions(
                      mediaPlaybackRequiresUserGesture: false,
                    ),
                    ios: IOSInAppWebViewOptions(
                      allowsInlineMediaPlayback: true,
                    )),
                onPermissionRequest: (controller, permissionRequest) async {
                  await Permission.camera.request();
                  await Permission.microphone.request();
                  return PermissionResponse(
                      resources: permissionRequest.resources,
                      action: PermissionResponseAction.GRANT);
                },
              ),
            ),
          ),
        ])));
  }
}
```

{% endtab %}
{% endtabs %}


# Embedding in Squarespace or Wordpress

Most website builders offer some way of adding blocks containing content hosted elsewhere. Here we look at two popular options, SquareSpace and WordPress.

{% hint style="warning" %}
Due to technical limitations, you are not currently able to embed Whereby rooms within a Wix site.
{% endhint %}

## Squarespace

Squarespace allows for you to build simple and beautiful websites with ease. Below are the steps in order to embed Whereby on your site, but if you have additional questions about building your site please review [Squarespace Help Center](https://support.squarespace.com/hc/en-us).

{% hint style="info" %}
**Note:** Adding iframes to a Code Block is a Premium feature available in Squarespace's current Website Business plan and higher.
{% endhint %}

**1** In the section you'd like to Embed Whereby, select the "+" to create a new block

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/jALtr5kMVST0FHE0MH8T/squarespace1.png" alt="" width="563"><figcaption></figcaption></figure>

**2** Select the "Code" option

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/BWcNoo0P4DMR5bA2bQ91/Squarespace%20code%20block.png" alt="" width="563"><figcaption></figcaption></figure>

**3** Enter in your iframe code into the block. Example iframe code below. You may need to include a height and width attribute to fit your site accordingly.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/4z50wV8vIyD9pHGpSyTT/squarespace3.png" alt="" width="375"><figcaption></figcaption></figure>

```
<iframe
  src="https://subdomain.whereby.com/room?minimal"
  allow="camera; microphone; fullscreen; display-capture; autoplay; compute-pressure"
></iframe>
```

## Wordpress

Below are the steps in order to embed Whereby on your WordPress site, but if you have additional questions about building your site please review WordPress [**WordPress Help Center**](https://wordpress.com/support/).

{% hint style="info" %}
HTML tags like script, iframe, form, input, and style are not available on Premium, Personal, or free plans. You need to upgrade to the [WordPress.com](http://wordpress.com) Business Plan and install a custom plugin or theme to use them.
{% endhint %}

**1** Select the "+" to create a new block

w

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/ffJJdq4fhmqQnqDL2kAg/wordpress1.png" alt="" width="563"><figcaption></figcaption></figure>

**2** In the search box, enter "code" and select the "Custom HTML" block

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/r6XE1lF4xaPmcGjZLEXG/Word%20press%20html%20block.png" alt="" width="563"><figcaption></figcaption></figure>

**3** Enter in your iframe code into the block. Example iframe code below. You may need to include height and width attributes to fit your site accordingly.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/UoM0Qb7z9WodFKgu0Ht0/wordpress3.png" alt="" width="563"><figcaption></figcaption></figure>

```
<iframe
  src="https://subdomain.whereby.com/room?minimal"
  allow="camera; microphone; fullscreen; display-capture; autoplay; compute-pressure"
></iframe>
```


# No code video conferencing in Bubble

Planet No Code has built a tutorial to help create the video conferencing app of your dreams!

[Bubble.io](https://bubble.io/) is a visual programming platform that allows users to create software with limited or no programming knowledge.

Our friends at Planet No Code have put together a robust series of tutorials to help you build a video conferencing app, with no code required!

{% embed url="<https://www.planetnocode.com/>" %}

### Tutorials

#### [Bubble setup](https://www.planetnocode.com/tutorial/plugins/api-connector/whereby-embedded-api/no-code-video-conferencing-app-with-whereby-part-1/)

{% embed url="<https://www.youtube.com/watch?v=JqKl4KFRzJE>" %}

#### [Whereby video conferencing API setup](https://www.planetnocode.com/tutorial/plugins/api-connector/whereby-embedded-api/no-code-video-conferencing-app-with-whereby-part-2/)

{% embed url="<https://www.youtube.com/watch?v=XcPhKGUf8KA>" %}

#### [Meeting page setup](https://www.planetnocode.com/tutorial/plugins/api-connector/whereby-embedded-api/no-code-video-conferencing-app-with-whereby-part-3/)

#### [Registration and security](https://www.planetnocode.com/tutorial/plugins/api-connector/whereby-embedded-api/no-code-video-conferencing-app-with-whereby-part-4/)

### Further resources

* [Overview of Whereby Embedded](/getting-started/overview-of-whereby-embedded) — Get started
* [Healthcare video conferencing](/telehealth-industry-solutions/building-secure-telehealth-applications-implementation-guide) — Telehealth industry solution guides


# Meeting scheduling with Cronofy

Integrate Whereby Embedded with Cronofy for robust scheduling capabilities

Whereby's API and SDK allow you to seamlessly embed video calling into your platform. Often times in order for a video call to take place, you need to schedule something between multiple various parties. Enter Cronofy:

[**Cronofy**](https://www.cronofy.com/?utm_source=whereby\&utm_medium=docs) **offers a robust, reliable, and powerful scheduling infrastructure. Now, it has a custom integration built just for Whereby.**

{% hint style="info" %}
This feature is currently in beta and requires your Cronofy organization to be flagged for testing. If you would like to be a test user, please contact <support@cronofy.com>\
\
You can create a Cronofy account [via their website](https://app.cronofy.com/sign_up/developer?utm_source=whereby\&utm_medium=docs)
{% endhint %}

## Whereby Setup

After [creating](https://whereby.com/information/embedded/select-plan?ref=select-product) your Whereby account, you'll need to create an API key:

1. From the **Configure** section of the dashboard, select **Generate Key**<br>

   <figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/ocm0NPRw4Y2GrLtbTYEz/Twilio%20JS%20SDK%20Quick%20migration%20screenshot.jpg" alt=""><figcaption></figcaption></figure>
2. Name it what you'd like, and then make sure **copy** or save the value

## Cronofy Setup

After receiving Beta access from Cronofy support and logging into your account, you'll need to enable and setup Whereby:

1. Select your **Organization Settings->Manage Integrations**
2. Choose **Set Up New Integration**<br>

   <figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/lP7Ywr9JktRPN7id9baZ/cronofy-docs-1.png" alt=""><figcaption></figcaption></figure>
3. Scroll and select Whereby
4. Input your Whereby API key and select **Save**
5. After saving your API key, check the boxes for the Cronofy apps/projects you'd like to use Whereby as a conferencing solution

### Creating events with Whereby

Cronofy has a complete [API reference available](https://docs.cronofy.com/developers/api/conferencing-services/create/?utm_source=whereby\&utm_medium=docs), below is the basics to get things working:

1. From the Whereby integration page, copy the `profile_id`
2. Use the `profile_id` in the `conferencing` object in an event creation request

```json
{
  "event_id": "cronofy-whereby-001",
  "summary": "Consultation with Dr R. Astley",
  "description": "We'll discuss what it means to never give up",
  "start": "2024-08-13T16:00:00Z",
  "end": "2024-08-13T17:00:00Z",
  "tzid": "America/Detroit",
  "conferencing": {
    "profile_id": "int_667c316c707e9e0a5ec87fe2_0000000000"
  }
}
```

Stay up to date with future features and how to use the Whereby integration via [their documentation](https://docs.cronofy.com/developers/api-alpha/whereby/?utm_source=whereby\&utm_medium=docs)!


# Room creation

Rooms are where video calls (sessions) take place. Create or delete Whereby rooms programmatically using a simple API request. Rooms can be created on demand, or ahead of time for scheduled meetings.

{% embed url="<https://youtu.be/3-uORdwjlBc>" %}

{% hint style="info" %}
To use the API, you’ll need to create an API key. A new key is generated from the “Configure” section in the Embedded dashboard. Your API key is secret and should only be used from your server.
{% endhint %}

### Creating rooms

Once you have secured your API key, you can create a room by sending an HTTP request with the necessary properties in the body. Available properties and formats can be found in the [API reference](/reference/core-sdk-reference/api-reference). Some features like the URL pattern of the room name and room size (`roomMode`) can only be set during the meetings creation.

`endDate` is interpreted as UTC by default, but other time zones are supported by including an offset in hours and minutes. For example, Eastern Standard Time (EST) would be expressed as `2099-08-11T07:56:01-05:00`.

Rooms are fully functional from the time they are created. They can then be used alongside [our SDK to embed](/reference/whereby-rest-api-reference) on your platform

{% tabs %}
{% tab title="cURL" %}

```bash
curl https://api.whereby.dev/v1/meetings \
  --header "Authorization: Bearer $YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --request POST \
  --data @- << EOF
{
  "endDate": "2099-02-18T14:23:00.000Z",
  "fields": ["hostRoomUrl"]
}
EOF
```

{% endtab %}

{% tab title="PHP" %}

```php
$api_key = "YOUR_API_KEY";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.whereby.dev/v1/meetings');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{
  "endDate": "2099-02-18T14:23:00.000Z",
  "fields": ["hostRoomUrl"]}'
);

$headers = [
  'Authorization: Bearer ' . $api_key,
  'Content-Type: application/json'
];

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

curl_close($ch);

echo "Status code: $httpcode\n";
$data = json_decode($response);
echo "Room URL: ", $data->{'roomUrl'}, "\n";
echo "Host room URL: ", $data->{'hostRoomUrl'}, "\n";
```

{% endtab %}

{% tab title="Node" %}

```javascript
const fetch = require("cross-fetch");

const API_KEY = "YOUR_API_KEY";

const data = {
  endDate: "2099-02-18T14:23:00.000Z",
  fields: ["hostRoomUrl"],
};

function getResponse() {
    return fetch("https://api.whereby.dev/v1/meetings", {
        method: "POST",
        headers: {
            Authorization: `Bearer ${API_KEY}`,
            "Content-Type": "application/json",
        },
        body: JSON.stringify(data),
    });
}

getResponse().then(async res => {
    console.log("Status code:", res.status);
    const data = await res.json();
    console.log("Room URL:", data.roomUrl);
    console.log("Host room URL:", data.hostRoomUrl);
});

```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

API_KEY = "YOUR_API_KEY"

data = {
    "endDate": "2099-02-18T14:23:00.000Z",
    "fields": ["hostRoomUrl"],
}

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json",
}

response = requests.post(
    "https://api.whereby.dev/v1/meetings",
    headers=headers,
    json=data
)

print("Status code:", response.status_code)
data = json.loads(response.text)
print("Room URL:", data["roomUrl"])
print("Host room URL:", data["hostRoomUrl"])
```

{% endtab %}

{% tab title="Java" %}

```java
import com.fasterxml.jackson.databind.ObjectMapper;

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse.BodyHandlers;
import java.util.Collections;
import java.util.Map;

var apiKey = "YOUR_API_KEY";
var data = Map.of(
        "endDate", "2099-02-18T14:23:00.000Z",
        "fields", Collections.singletonList("hostRoomUrl")
);
var request = HttpRequest.newBuilder(
                URI.create("https://api.whereby.dev/v1/meetings"))
        .header("Authorization", "Bearer " + apiKey)
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString(new ObjectMapper().writeValueAsString(data)))
        .build();

var response = HttpClient.newHttpClient().send(request, BodyHandlers.ofString());
System.out.println("Status code: " + response.statusCode());
System.out.println("Body: " + response.body());

```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="201 Response: Success" %}

```json
{
    "meetingId": "1",
    "startDate": "2022-02-17T14:24:00.000Z",
    "endDate": "2099-02-18T14:23:00.000Z",
    "roomUrl": "https://example.whereby.com/room",
    "hostRoomUrl": "https://example.whereby.com/room?roomKey=eFhcG...i00ZG"
} 
```

{% endtab %}
{% endtabs %}

### endDate and deleting rooms

Creating rooms via the API, produces a room with a unique URL and a limited lifespan. The `endDate` property is used to indicate the time at which the room will be marked for deactivation. It **does not** indicate when a meeting will end and remove participants.

One hour after the `endDate` the room will be deactivated and things like [Webhook](/whereby-product-features/insights-suite-and-api/webhooks) events, [host](/whereby-product-features/user-roles-and-privileges) privileges, new cloud recordings, and participant minutes consumption will no longer function. The room will then automatically be deleted within 24 hours of the `endDate` provided.

{% hint style="success" %}
If you'd like to limit the length of a meeting and ensure a room is no longer being used, you can delete a room [via API request](/reference/whereby-rest-api-reference/meetings#delete-meetings-meetingid). Deleting a room will remove all participants and prevent any further use. You can also keep track of when a session (meeting) starts and ends via [webhooks](/whereby-product-features/insights-suite-and-api/webhooks) to limit a meeting by length.
{% endhint %}


# Name prefixes

When creating rooms using the REST API, you can send an extra identifier as part of your API request. This identifier will become part of the room URL, acting as a tag to enable further analysis.

Rooms created using the API get a unique name/URL based on your Whereby domain and a randomly generated ID.

Example URL:

`https://mydomain.whereby.com/8d9c4219-483e-44fe-c826-c70ce1439018`

If for some reason you need to attach your own identifier to the room URL, you can do so by using the `roomNamePrefix` parameter in the body of the POST request to include a string which will then be used as a room name prefix.

The string can be up to 39 characters long, and can contain alphanumerical characters.

{% hint style="info" %}
Note that any upper-case letters in the roomNamePrefix will be transformed to lower-case, and any whitespace will be stripped away.
{% endhint %}

Example request body:

```json
{
    "roomNamePrefix": "Customer0348-",
    "endDate": "2099-03-25T13:30:00.000Z",
    "fields": []
}
```

Response:

```json
{
    "startDate": "2022-03-11T13:56:20.593Z",
    "endDate": "2099-03-25T13:30:00.000Z"",
    "roomUrl": "https://mydomain.whereby.com/customer0348-72b919c2-17dc-4007-ac7b-56f38b8e29ba",
    "meetingId": "52755922"
}
```

### Searching insights for rooms with a prefix

After you've applied `roomNamePrefix` to your URLs, you can then use our [API](/reference/whereby-rest-api-reference) to search for rooms containing that prefix.

Example GET request URL:

```
https://api.whereby.dev/v1/meetings?roomName[startsWith]=/customer
```

Response

```json

{
    "startDate": "2024-02-08T16:57:01.017Z",
    "endDate": "2024-02-10T05:00:00.000Z",
    "roomName": "/customer123-172aa26e-802a-41a6-ba1f-142792c4f42",
    "roomUrl": "https://nickrolls.whereby.com/customer123-172aa26e-802a-41a6-ba1f-142792c4f42",
    "meetingId": "82490894"
},
{
    "startDate": "2024-02-08T16:57:18.847Z",
    "endDate": "2024-02-10T05:00:00.000Z",
    "roomName": "/customer456-b621d167-2cb1-4bb8-8aa4-46f8a58f0069",
    "roomUrl": "https://nickrolls.whereby.com/customer456-b621d167-2cb1-4bb8-8aa4-46f8a58f0069",
    "meetingId": "82490920"
}
```

Read more about [creating rooms using the API](/whereby-product-features/using-the-rest-api), and refer to our [API reference](/reference/whereby-rest-api-reference) for further details.


# Using “Create a room”

Easily create Whereby rooms using a straightforward 4-step UI flow without the need to generate an API key.

### Creating rooms

The fastest way to get started with creating Whereby Embedded rooms is through the “Create a room” flow, which can be launched from the “Get started” and “Rooms” sections in your Whereby Embedded account's Dashboard.

![First screen of the "Create Room" flow, allowing customers to create a room with no code.](https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/IQxXHpnzVShqHBVhlwg4/create-room.png)

The wizard consists of 4 self-explanatory steps:

1. Pick your preferred room size: small or large;
2. Set up recording;
3. Set up streaming;
4. Set an optional room prefix and an expiration date;

And that's all there is to it!

The Room Overview page that follows gives you a view at a glance of what you have configured, features handy [host and participant links](https://docs.whereby.com/user-roles-and-privileges), and generates a code snippet you can include in your website.

If you want to review these room details again at a later point in time, you can find an overview of all rooms you've created (incl. demo rooms and rooms generated through the API) in the new “Rooms” section that's linked from the sidebar.

{% hint style="info" %}
While the “Create a room” flow is perfect for getting started, and is probably sufficient if you only need to create a handful of meeting rooms, we recommend looking into the [REST API documentation](/reference/whereby-rest-api-reference) to generate rooms on-the-fly, and unlock the full power of Whereby Embedded.
{% endhint %}

### Deleting rooms and endDate

Creating rooms via the API, produces a room with a unique URL and a limited lifespan. There's no need to worry about meetings conflicting or rooms being used for other purposes after the intended session.

The `endDate` property is used to indicate the time at which the room will be marked for deactivation. It **does not** indicate when a meeting will end and remove participants.

One hour after the `endDate` things like [Webhook](/whereby-product-features/insights-suite-and-api/webhooks) events, [host](/whereby-product-features/user-roles-and-privileges) privileges, new cloud recordings, and minutes consumption will no longer function. The room will then automatically be deleted within 24 hours of the `endDate` provided.

{% hint style="success" %}
If you'd like to limit the length of a meeting and verify a room is no longer being used, you can delete a room [via API request](/reference/whereby-rest-api-reference/meetings#delete-meetings-meetingid). A deletion request will remove all participants and prevent any further use. You can also keep track of when a session start via [webhooks](/whereby-product-features/insights-suite-and-api/webhooks) to limit a meeting by length.
{% endhint %}


# Customizing rooms during creation

Some key properties of your rooms should be set when the room is created using the API or Create a room flow.

Some features of the meeting rooms can be set at the time of creation, within API requests. This includes (but isn't limited to):

* **Lock State** (`isLocked`) - This set the initial lock status of the rooms to create a type of waiting room for your participants. [Hosts](/whereby-product-features/user-roles-and-privileges#hosts) are able to gain access to locked room and are able to adjust the lock status, if the setting is [exposed](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes#locking-off).
* **Pattern of the room name** (`roomNamePattern`) and **Prefix** (`roomNamePrefix`) - Adjust the random string used for room names. You can also include a prefix for easier link searching and management within [insights](/whereby-product-features/insights-suite-and-api), [webhooks](/whereby-product-features/insights-suite-and-api/webhooks), or your own database.
* **Room size** (`roomMode`) - Adjust the capacity (4 vs 200) and connection type (P2P vs SFU) of your rooms being generated. Specify `normal` for a capacity of 4 and P2P. Or, `group` for a capacity of 200 and SFU. Review our [blog post](https://whereby.com/blog/p2p-vs-sfu-video-calls-which-is-best/) for further clarifications and information.

Have a look at our [API reference](/reference/whereby-rest-api-reference) for a complete overview of properties that can be set on meeting creation.

{% hint style="warning" %}
If you're using Whereby in a telehealth use case, to be HIPAA compliant, set `isLocked: true` in your API request and use `roomNamePattern = uuid`
{% endhint %}

Further customizations can be done after the room has been created, either by using [URL parameters](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes) when embedding the room, [managing preferences via the dashboard](/whereby-product-features/dashboard-preferences), or by customizing [branding elements](/whereby-product-features/branding-elements) like background and logo.


# Assistants

Whereby Assistants let you connect AI agents to video rooms, stream and process audio, and automate real-time interactions.

{% hint style="warning" %}
⚠️ **Closed Beta**\
The Assistants feature is currently in Closed Beta. You can request access by emailing <embedded@whereby.com>. Assistants will be made generally available after the beta.
{% endhint %}

{% hint style="info" %}
Assistants is a supplementary feature of our paid Whereby Embedded plans. The price will depend on your **Embedded plan** type.&#x20;

* **Build (monthly)** plan: $0.006 per minute.
* **Enterprise (annual)** plan: Please contact your Customer Success Manager, or email <embedded@whereby.com>.&#x20;
  {% endhint %}

Assistants are headless participants that connect to a Whereby room to enhance your user experience. They can:

* Access all participant audio and video streams in a connected room, including a combined audio stream of all participants
* Perform in-room actions like sending chat messages, starting cloud recording, letting participants into the room
* Alongside our [Trigger API](/reference/assistant-sdk-reference/api-reference/trigger) be triggered automatically via webhooks (e.g. when a first participant joins a room or when two or more participants join and a room session starts).

## Prerequisites

The Assistant SDK is intended for Node.js environments and depends on some external tooling:

* **Node.js ≥ 20**
* [**FFmpeg**](https://ffmpeg.org/) must be installed on the host machine if you wish to make use of the **combined audio stream** functionality.

{% hint style="warning" %}
Note: The SDK cannot be run in the browser - use [Core](/reference/core-sdk-reference) or [Browser](/reference/react-hooks-reference) SDK for creating user-interface based integrations.
{% endhint %}

## Setup

There are a few steps required to set up Assistants to be used in your Whereby sessions.

### Creating an Assistant

Before an Assistant will be granted access to your sessions, they must first be created in the Whereby dashboard. This will assign each individual assistant an `assistantKey`. This key uniquely identifies every assistant and will be later used in the implementation stage when joining a call as a Whereby Assistant.

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FY5q7C6RfvhyggbWQ6EuQ%2Fimage.png?alt=media&amp;token=48231073-57ee-42ce-80c7-4ff324a7b020" alt=""><figcaption></figcaption></figure>

In this stage, you can assign some key details to your Assistant including:

* Avatar
* Display Name
* Description
* If you are using the [Trigger API](/reference/assistant-sdk-reference/api-reference/trigger), you can also set the URL that you have listening for Whereby Webhook events.

Once you've assigned these details, you can save the Assistant and obtain the `assistantKey`.

{% hint style="info" %}
You can always edit an Assistant's configuration, view its `assistantKey`, and enable or disable it in your organization after it has been created.
{% endhint %}

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FhA1yKB3Ej1kTWSSXvGwE%2Fimage.png?alt=media&amp;token=3e3d73ad-b6fa-4ee8-9fb9-cd6acf3d2859" alt=""><figcaption></figcaption></figure>

Your Assistant will be created in a `disabled` state initially. Once you're ready to start using your Assistant, you can toggle it to the `enabled` state via the dashboard.

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FAd4eH0GtztzrHFQGVi0J%2Fimage.png?alt=media&amp;token=d904c9f4-fc80-4c83-8df4-3e83851219b1" alt=""><figcaption></figcaption></figure>

Once enabled, any Whereby Assistant that now provides the `assistantKey` copied from this interface will self-identify as this assistant.

If you'd like room hosts to be able to request this assistant from within the room, you can enable **Manual** **Invite**. More on that below.

{% hint style="info" %}
You'll need an Endpoint URL configured before Manual Invite can be enabled.
{% endhint %}

That's it for the configuration steps!

## In Room

When an assistant now joins any room (using its `assistantKey`), an in-room notification will be shown to all participants.

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FaBwVidCIB4u3u2B673Wk%2Fimage.png?alt=media&amp;token=17d2e904-49b2-409a-89a5-e387bf0f75c4" alt=""><figcaption></figcaption></figure>

A Whereby Assistant then sits in the room status bar for the duration that it is connected and until it leaves the room.

Interacting with the assistant icon in the room status displays the assistants menu.

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FkHNnEf59gDC3dLcEqXIz%2Fimage.png?alt=media&amp;token=8a5c8a03-8030-43b1-9b49-4189e4d3dec5" alt=""><figcaption></figcaption></figure>

### Manual Invite

When enabled, hosts will be able to invite your Whereby Assistant into their room with the **Invite** button in the assistants menu.

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgn3rOhbNydRwHltiyDat%2Fimage.png?alt=media&amp;token=50693810-b75f-4c93-af27-ae958f78dc93" alt=""><figcaption></figcaption></figure>

The **Invite** button will send a webhook event with the type `assistant.requested` endpoint URL configured for this assistant. You can configure your webhook server to start the requested assistant and have it join the room specified in the webhook event payload.

Once an assistant has joined the room, hosts have the ability to remove it through the assistants menu.

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FfGnQWEmTfJJ3UUOvtLIP%2Fimage.png?alt=media&amp;token=e4eed882-3b1a-4bd4-b656-bc07a29d570a" alt=""><figcaption></figcaption></figure>

When the assistant leaves the room it will announce that it is leaving to all participants remaining in the room.

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2F7uSIBhB9wg7jhO1H8K82%2Fimage.png?alt=media&amp;token=f77f1a2a-56f5-4d7a-9d69-b766993dbcc1" alt=""><figcaption></figcaption></figure>

And that's it!

Now, you can view our [Quick Start](/reference/assistant-sdk-reference/quick-start) guide to set up and explore the possibilities for your Assistant.

## Key Features

### Individual Streams

Access the individual audio and media streams of all participants in a session.

**Use cases**: video analysis, video recording, per-participant live transcription and recording

### Combined Audio

All remote participant audio mixed into a single audio stream.

**Use cases**: single track live transcription, AI models, sentiment analysis, audio only recording

### Trigger API

Start assistants automatically when specific webhooks arrive (eg `room.client.joined` )

See the [Trigger API Reference](/reference/assistant-sdk-reference/api-reference/trigger) for more details

### In-Room Actions

Assistants can perform a variety of actions inside a room — they are given the same action permissions as host users. These actions include:

* Sending and receiving chat messages
* Starting or stopping cloud recordings
* Spotlighting participants
* Request audio / video to be enabled for participants
* Admitting waiting participants

See the [Core API Reference](/reference/core-sdk-reference) for the full list of in-room actions available.

## See Also

* [Assistant SDK Reference](/reference/assistant-sdk-reference): Complete documentation to get started building a Whereby Assistant.


# Branding elements

Make your Whereby rooms truly yours by setting a custom logo, background and other branding elements. You can do this using the branding tools in the Embedded dashboard, or via the API.

{% embed url="<https://youtu.be/SZkEOh3v6qA>" %}

## Using the Branding tools in your Embedded Dashboard

The branding tools can be found under “**Configure**” → “**Appearance**”. Any configuration done here will be applied to all your rooms, unless overridden by individual room settings applied via the [Room Theme API](#using-the-room-theme-api).

![](https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/veskdCnAtsbvC42VNvip/branding%20dashboard.png)

## Using the Room Theme API

The Room Theme API lets you set up and manage branding settings for individual rooms. This could be used for tailoring the video call experience to your client's own branding, or simply to apply different visual styles for rooms used for different purposes.

Visit the [API reference docs](/reference/whereby-rest-api-reference) for a closer look at how to use the Room Theme API.

Note that branding elements configured via the API will override any "global" branding you may have applied via the Embedded Dashboard.

## Additional Branding Options

There are some supplementary branding options available via our [URL parameters](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes) that may be useful in customizing your meetings look and feel:

* [`?background=off`](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes#background-off) - This parameter allows you to hide the meeting room's background, allowing for your app or website's branding to shine through.
* [`?avatarUrl=<url>`](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes#avatarurl-less-than-url-greater-than) - Set the avatar / profile picture of the participant instead of the automatically assigned name initials.
* [`?virtualBackgroundUrl=<url>`](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes#virtualbackgroundurl-less-than-url-greater-than) - Specify an image url to use as the virtual background for the participant.


# Breakout groups

More than ever, workshops, lectures, and conferences are happening online. So it's never been more important to combine bigger (often one-way) meetings with smaller, collaborative sessions.

With Breakout Groups, you can easily implement collaborative sessions directly into your app or website.

## Setup

To use Breakout Groups, you'll need to ensure the following is true. **All of these conditions must be met** for Breakout Groups to function properly, so if you're having issues implementing Breakout Groups, these are good things to double-check:

1. The meeting is set to the `group` roomMode during [meeting creation](/reference/whereby-rest-api-reference/meetings)
2. You are using the [`?breakout=on`](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes#breakout-less-than-on-or-off-greater-than) parameter/attribute if you have `?minimal` enabled
3. The meeting will happen between the meeting creation and `endDate` that was defined in the API request to create the room
4. You are using [Host URLs](/whereby-product-features/user-roles-and-privileges) and will have a Host in the meeting to start the breakout session

## Additional information

You can also programmatically predefine the number of groups and their names before the meeting using our [?groups](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes#groups-orange-banana-coconut) parameter in the URL or[ Web Component attribute](/reference/using-the-whereby-embed-element).

After you've implemented, we have a [series of guides](/end-user/end-user-support-guides/using-breakout-groups) you can use to train your hosts on using the Breakout Groups feature.

## Known limitations

* Cloud recording does not support our Breakout Groups feature. When using Breakout Groups, the recorder will remain in the main room and will not capture any of the meeting content from individual groups.


# Dial-In

The Dial-in option allows meeting participants to join via a phone call. This is particularly useful if they have internet issues, are traveling, or cannot use video for other reasons.

{% hint style="info" %}
Dial-in is currently in closed Beta and available to selected customers only.\
Email us at <embedded@whereby.com> to join our pilot program (terms and conditions apply).
{% endhint %}

## Setup

### Per room configuration

You can configure the Dial-in feature for individual rooms. Use the [POST /meetings](/reference/whereby-rest-api-reference/meetings#post-meetings) request to create the new room. During the creation request, add the following fields to the request’s body:

```json
{    
    "endDate": "2099-03-25T13:30:00.000Z",
    “isDialInEnabled”: true,
    "fields": ["dialIn"]
}
```

{% hint style="success" %}
Multiple fields can be specified in the same request, including things like [hostRoomUrl](/reference/whereby-rest-api-reference/meetings)
{% endhint %}

**Example response:**

```json
{
	"startDate": "<now>",
	"endDate": "2099-03-25T13:30:00.000Z",
	"roomName": "/example-room”,
	"roomUrl": "https://example.whereby.com/example-room",
	"meetingId": "1234",
	"dialIn": {
		"code": "1234567890",
		"phoneNumbers": [
			{
				"countryCode": "US",
				"phoneNumber": "111-867-5309"
			}
		]
	},
	"roomPreferences": {
		"dialIn": true
	}
}

```

### Getting details of the dial-in access codes

To obtain the Dial-in details and access codes for a specific meeting, use the `meetingId` and send a [GET request](/reference/whereby-rest-api-reference/meetings#get-meetings) with `?fields=dialIn` as a query param. The details are provided in a text response in JSON format, and include:

* List of Dial-in phone numbers from different countries that participants can call to join the meeting
* Dial-in access code

The above request will work for both a specific `meetingId`, or all active meetings. The response will be an array of meetings, and the meetings will have the Dial-in details but only if they were created with Dial-in enabled.

### Creating callable links

The phone number and room code can be combined and presented as a link on your website or HTML email, allowing users to 'click' the link and dial into the room without having to manually enter the code.

To do so, create an [anchor](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) element with the `href` set to `"tel:<phone number>,<room code>"` like so:

`<a href="tel:111-867-5309,1234567890">Click here</a>`

{% hint style="info" %}
The comma separating the phone number from the room code above causes the phone to wait for an answer before entering the code.
{% endhint %}

Here's how that renders on this website: [Click here](tel:111-867-5309,1234567890)

## Additional information

### Using webhooks

Webhook events can be used to track Dial-in participants. When a dialed-in participant joins or leaves the meeting, Whereby sends a [webhook](https://docs.whereby.com/meeting-content-and-quality/insights-suite-and-api/webhooks#transcription-data-properties) event with details:

* Participant’s phone number
* Participant’s date and time of joining
* Participant’s date and time of leaving the room

## Known limitations

1. The Dial-in feature currently provides voice messages to participants in **English only**.
2. The Dial-in feature is **not compatible** with our [Breakout Groups](https://docs.whereby.com/whereby-101/customizing-rooms/breakout-groups-with-embedded) feature.


# File sharing

File sharing allows meeting participants to exchange small files with each other, during the session, through the chat.

## Summary

File sharing is a feature of Whereby's chat and allows all participants in a video session to attach media files (images, documents, audio, and video) of up to 15 MB. Files are available for download throughout the session, making it easier to collaborate and share resources in real-time.

{% hint style="warning" %}
Files are available for download for the duration of the session *only*. All files are encrypted and securely stored in Whereby-managed cloud storage, and are **automatically deleted** within 1 minute from the end of the session. They are not backed up and cannot be retrieved after the session.
{% endhint %}

## How does it work?

When file sharing is enabled, any session participant can attach files from their computer, using a file picker or drag and drop into the chat. Each file is presented in the chat window as an individual message and all session participants can download them. Hosts are able to delete any file shared, removing any unnecessary or incorrect files to keep the session organized.

### Supported file types

The following file types can be uploaded:

* **Images**: JPEG, PNG, GIF, WEBP
* **Documents**: PDF, DOCX, TXT, RTF, CSV, XLSX
* **Audio**: MP3, WAV
* **Video**: MP4, MOV, MKV, WEBM

### Maximum file size

An individual file cannot exceed 15MB, which is sufficient for most documents and media while maintaining optimal session performance.

## Setup

By default, file sharing is enabled globally for your account and will be available in all sessions where chat is enabled. You can change the availability of file sharing globally or per room.

### Global configuration

Go to the "**Configure" → "Features"** section of your Dashboard to disable or enable file sharing for all of your sessions.

{% hint style="success" %}
Chat *must be* enabled for file sharing to work. You can enable chat for all rooms on the Dashboard or per room.
{% endhint %}

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/8OTZYArvbxtDBK26J1BA/file%20share.png" alt=""><figcaption><p>Global configuration of file sharing</p></figcaption></figure>

### Per room configuration

You can override global configuration for individual rooms via the API during a [room creation](/reference/whereby-rest-api-reference/meetings#post-meetings) request or with an [attribute or parameter](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes) of `fileSharing=<on|off>`.

## Additional Information

### HIPAA compliance

File sharing is considered to be [HIPAA compliant](/telehealth-industry-solutions/hipaa-compliant-setup), as files are securely stored and only available to the participants for the duration of the session.

All files are permanently deleted within 1 minute from the end of the session or from the moment when there is only 1 participant left in the room.

## Known Limitations

1. Files can only be attached when there are at least two participants in the session, ensuring that the sharing feature is used for its intended collaborative purpose.
2. File sharing is available in both room modes - P2P rooms called 'normal' and SFU rooms called 'group'. However, please note that in both room modes, the files being shared are temporarily stored in Whereby-managed cloud storage. [Learn more about P2P and SFU video sessions.](https://whereby.com/blog/p2p-vs-sfu-video-calls-which-is-best/)


# Live Captions

Live Captions (or closed captions) provide AI-powered, real-time text representation of spoken content during events within a meeting room, such as presentations, meetings, or videos.

## Summary

{% hint style="success" %}
Live Captions are currently in Open Beta.
{% endhint %}

{% hint style="info" %}
Live captions is a supplementary feature of our paid Whereby Embedded plans. The price will depend on your **Embedded plan** type and the **language** chosen.

**Primary languages\*:**

* **Build (monthly)** plan: $0.0065 per unmuted participant minute.
* **Enterprise (annual)** plan:
  * $0.0055 per unmuted participant minute (for pre-purchased minutes).\*\*
  * $0.0065 per unmuted participant minute (for over usage).

**Secondary languages\***:

* Both plan types: $0.024 per unmuted participant minute.

**\*** Currently, our primary languages include: English, Spanish, Italian, French, Portuguese, and German. All other languages are secondary languages at this time.\
\*\* To pre-purchase minutes, please reach out to your CSM.
{% endhint %}

{% hint style="info" %}
*What is an unmuted participant minute?* This is calculated using the number of participants who are unmuted during a call. For example, a 60 minute meeting containing 2 people who are unmuted for the whole meeting would use 120 unmuted participant minutes. Alternatively, a 60 minute meeting with 3 participants, where only 2 participants were unmuted and the third participant was muted for the whole meeting, would also use 120 unmuted participant minutes. From the moment a participant is unmuted, this usage counts towards the number of unmuted participant minutes, even if they do not actively talk or engage on the call.
{% endhint %}

## How does it work?

Live Captions, or closed captions, automatically generate real-time text on the screen of a meeting room during the meeting itself. These open captions usually focus on key spoken content and may not include every single word, like filler words.

Primarily used for real-time accessibility, Live Captions help participants follow along as the meeting progresses without needing to listen to the audio.

## Setup <a href="#setup" id="setup"></a>

You can enable and configure Live Captions globally for your account, or individually for each room.

### Global configuration <a href="#global-configuration" id="global-configuration"></a>

When you enable Live Captions globally through the Dashboard, these settings become the default for all rooms and sessions. Enabling Live Captions globally will result in all meetings being captioned. You can override these global settings by specifying the caption on a per room basis.

If you want to use Live Captions for all of your meetings, you can enable it globally for your account. Go to “**Configure**” → “**Transcription**” section of your Dashboard and scroll down to the "**Live Captions**" section. Then, toggle the Live Captions feature on:

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/1WCVyAcMBsYdB9KTHw1p/image.png" alt=""><figcaption></figcaption></figure>

To disable Live Captions, you can use the same toggle to them toggle off. Now there will be no closed captioning in your meetings on a global level.

### Per room configuration <a href="#per-room-configuration" id="per-room-configuration"></a>

If you want to use Live Captions for some of your meetings, or if you need a different configuration for some of them, you can configure Live Captions individually for the room. Room parameters will override the global Live Captions settings.

{% hint style="warning" %}
The default language set on your organization’s dashboard can be overridden on a room level. This could result in the price charged for your use of live captions/session transcriptions being impacted. Please refer to the price for different languages at the top of the page for further details.
{% endhint %}

To do so, create the room with [POST /meetings](/reference/whereby-rest-api-reference/meetings#post-meetings) request and specify the live caption configuration. It's a sub-property of the `liveTranscription` object.

For example, if you want a meeting with just live captions, and not live transcriptions, you can specify the `liveCaptions` option in the `liveTranscription` property, but set the `startTrigger` to `none`.

```json
    "liveTranscription": {
        "startTrigger": "none",
        "liveCaptions": true
    }
```

## Additional Information

### Supported languages

Live Captions generate real-time speech to text in the specified language. You need to declare the language used by your session participants in advance - in the [global configuration](#global-configuration) or [per room](#per-room-configuration).

<details>

<summary>Live caption supported languages</summary>

* Catalan (ca)
* Chinese (Mandarin, Simplified) (zh)
* Chinese (Mandarin, Traditional) (zh-TW)
* Czech (cs)
* Danish (da)
* Dutch (nl)
* English (en)
* Finnish (fi)
* French (fr)
* German (de)
* German - Switzerland (de-CH)
* Greek (el)
* Hindi (hi)
* Indonesian (id)
* Italian (it)
* Japanese (ja)
* Korean (ko)
* Latvian (lv)
* Malay (ms)
* Norwegian (no)
* Polish (pl)
* Portuguese (pt)
* Brazilian Portuguese (pt-BR)
* Romanian (ro)
* Russian (ru)
* Slovak (sk)
* Spanish (es)
* Swedish (sv)
* Thai (th)
* Turkish (tr)
* Ukrainian (uk)
* Vietnamese (vi)

</details>

### HIPAA compliance

Live Captions is designed to protect ePHI (Electronic protected health information) and supports compliance with the HIPAA Security Rule.

## Known limitations

1. Currently, the language spoken cannot be auto-detected. For example, if the meeting is configured for English but French is spoken in the meeting, the language output will likely be incoherent. In this case, you will still be charged per unmuted participant minute for the configured language.
2. We don't show data related to Live Captions in the Insights Dashboard.
3. Live Captions are not available in the Whereby iOS app.


# Live Streaming via RTMP

Our Live Streaming feature allows for you to share your meeting feed to an external service, like YouTube or Twitch via RTMP.

{% hint style="info" %}
Live Streaming is a complementary feature of our paid Whereby Embedded plans. You can review the pricing and options [on our site](https://whereby.com/information/embedded/pricing/).
{% endhint %}

{% hint style="danger" %}
Live Streaming is not HIPAA-compliant. Make sure you don't include any live streaming configuration when you create rooms.
{% endhint %}

## Setup

Create a meeting with live streaming set up for others to use, such as a teacher or an event organizer. The live stream is fixed and cannot be changed inside the room afterward. Follow along with our video streaming SDK to get this started for your use case.

{% embed url="<https://www.youtube.com/watch?v=wAEwDL6JMMg>" %}
How to set up live streaming in Whereby Embedded
{% endembed %}

### Create a live streaming meeting with the API

When creating a meeting [via our API](/reference/whereby-rest-api-reference/meetings), you can pass your platforms `RTMP URL` and include the `stream key` separated by a forward slash. Then, specify how you'd like the live stream to begin: "**Automatic**", "**Manual**", or "**Prompt**" by including an in room message to the host.

You'll have these same options when creating a meeting [via our dashboard](/whereby-product-features/using-the-rest-api/using-create-a-room).

### Obtaining live streaming info

{% tabs %}
{% tab title="YouTube" %}
{% hint style="info" %}
If you haven't live streamed before, in order to access your stream key on YouTube, you must go through the initial stream setup, which includes a 24 hour account processing period.
{% endhint %}

Your stream key and URL can be located under the "Stream Settings" tab once you've completed the initial setup. Google has documentation on this topic in their article "[Manage live stream settings](https://support.google.com/youtube/answer/9854503)".

![](https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/NDlK4GZnfezfkWU73J9T/YouTube%20Settings.png)
{% endtab %}

{% tab title="Twitch" %}
You can obtain a stream key from the "Stream" section of the Twitch creator dashboard. For more information, you can visit Twitch's [Support Center](https://help.twitch.tv/s/article/creator-dashboard).

1. Log into your Twitch account
2. Click on your profile icon in the top right and navigate to "Creator Dashboard"
3. On the left side of the screen select **Settings->Stream**
4. The stream key is located at the very top of the page

![](https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/yEdWTtXOuX1YJqUFamDf/Twitch%20Settings.png)

You can enter your stream key as part of the [broadcast URL](https://dev.twitch.tv/docs/video-broadcast). Twitch provides additional insight on choosing a broadcast URL in their [support documentation](https://help.twitch.tv/s/article/guide-to-broadcast-health-and-using-twitch-inspector?language=en_US#HowtoChooseaTwitchIngestServer).
{% endtab %}

{% tab title="Facebook" %}
For in depth instructions on how to go live via Facebook, we recommend reviewing their support article "[How do I go live on Facebook](https://www.facebook.com/help/587160588142067)".

You'll get started by [creating a live stream](https://www.facebook.com/live/create), create a key, then copy and paste the server URL and key into Whereby.

![](https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/oEuQ0x82qYWKu3UY1xgk/Facebook%20Settings.png)
{% endtab %}

{% tab title="Vimeo" %}
Going live on Vimeo does require a paid Vimeo Premium or Vimeo Enterprise membership. You can view their plans and pricing on [their website](https://vimeo.zendesk.com/hc/en-us/articles/115012811168#h_60c83788-04d4-4353-8a3a-cd0d0bb8b6bc).

Vimeo provides an in depth guide on creating a live event and setting up RTMP connections in their support document "[Create and go live to an event](https://vimeo.zendesk.com/hc/en-us/articles/115012811168#h_60c83788-04d4-4353-8a3a-cd0d0bb8b6bc)". During the process, they provide a link and stream key that you can copy and use in Whereby.

![](https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/I89xBrlKmf7DscPFwJ3w/Vimeo%20settings.png)
{% endtab %}
{% endtabs %}

## Use cases

* Hosting webinars that exceed the maximum amount of participants and [Viewers](/whereby-product-features/user-roles-and-privileges#viewers).
* Alternative solution to Google's WebRTC for Android.
* Embed realtime video chat


# Quality Insights

The Insights suite is available from the Embedded dashboard, and is the easiest way to access your usage data at a glance. You can also access insights data through the Whereby REST API.

You can quickly get a clear understanding of what's happening over time and see the big picture, or get a more granular view for data points like:

* 📈 How many Participant, Recording and Live Streaming minutes have been used
* 👨‍💻 The number of sessions/meetings happening over time
* 👥 How many participants have joined video calls
* :woman\_technologist:Each participant's call quality experience

![Visit the "Insights" section of your Whereby Embedded account to access these reports.](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FaSHUsm2gEV1I67eVYgwd%2FInsights%20Dashboard.png?alt=media\&token=34b5ab68-156f-4cae-a5f3-61643f67d229)

To access the Insights suite, log in to your Whereby Embedded account and visit the "Insights" section.

You can also query the Insights suite data through the [Whereby REST API](/reference/whereby-rest-api-reference), which allows you to programmatically use it for things like billing, operations, or even to create a dashboard of your own.

{% hint style="info" %}
Insights can take 10-15 minutes to update accordingly on the dashboard and via the GET endpoints
{% endhint %}


# Real-time troubleshooting

Enhance users’ experience when issues arise with real-time monitoring and troubleshooting tools. These tools are free to use and by default switched on for all embedded customers.

## Summary

Video meetings depend on various factors. Some of them are within users' control - but only if they are aware of them. Typical root causes of audio and video issues include:

* Poor or unstable internet connection
* High CPU usage due to intensive software processes, running several applications at once, having numerous open browser tabs, or even aging device hardware

## How does it work?

To help users deal with these issues, we provide a suite of real-time troubleshooting tools featuring:

* [Meeting diagnostics](#meeting-diagnostics)
* [Detection of poor network conditions](#detection-of-poor-network-conditions)
* Actionable tips for smoother meetings
* Mode to conserve bandwidth and optimize audio quality by disabling videos

These tools allows participants and hosts to troubleshoot connection issues during calls, aiming to reduce your team’s support tickets and ensure high-quality experiences.

***

### **Meeting diagnostics**

{% hint style="info" %}
**CPU usage monitoring** is available exclusively for Chrome on desktop.
{% endhint %}

Users can easily access meeting diagnostics and check:

* Overall performance
* Audio transmission
* Video transmission
* CPU usage (exclusive to Chrome on desktop)

<div align="center"><figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/Mm2crOEYeQM5QMWOnGKz/image.png" alt="" width="255"><figcaption><p>Outlined in red is a new button that provides access to the Meeting diagnostics tools. Clicking this button opens the side panel.</p></figcaption></figure></div>

### Detection of poor network conditions

1. In case of poor network conditions, users see a notification and a red indicator appears:<br>

   <figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/LtNkhSbLV2kAx7MfjFpw/toptoolbar.png" alt="" width="285"><figcaption></figcaption></figure>
2. Users can expand the panel to access more details and see actionable tips on how to improve the connection:<br>

   <figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/zpohcPbXpADV3e4PSMWh/image.png" alt="" width="563"><figcaption><p>Meeting diagnostics - example of poor connection.<br></p></figcaption></figure>
3. Meeting participants with poor network conditions will appear with an indicator on their video tile. This helps other participants understand why the affected participant's audio or video quality is lower.<br>

   <figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/syZy7Y0ivBhNNg1bANja/image.png" alt="" width="375"><figcaption><p>A red indicator is visible next to the name of any participant experiencing connection issues.</p></figcaption></figure>

## Setup

If you already have the Whereby top toolbar enabled, you don’t have to do anything else to configure this, as it will be on by default.

* If you currently hide the Whereby top toolbar by using the URL parameter `topToolbar=off`, please remove this parameter.
* If you currently hide the Whereby top toolbar by using the URL parameter `minimal`, please add a `callQualityMonitoring=on` parameter to the URL.

## **Is it possible to opt-out?**

Yes, it’s possible to opt-out and remove this tool from your experience. We’ve built it to make both yours and your users' experience smoother but understand some of our customers may want to control access to this.

If you are using Whereby and want to opt-out of the meeting diagnostics tool, please supply `callQualityMonitoring=off` to the URL when embedding.


# Using the Insights dashboard

{% hint style="info" %}
To be HIPAA compliant while using Insights, personal participant information needs to be removed. To do so, navigate to your Configuration settings, choose the Features tab, and scroll down to Privacy Features to enable the privacy toggle.
{% endhint %}

## Rooms and sessions

On the **Rooms** page, you can see a list of all the rooms that currently exist and have been created in your account. They are listed by most to least recently used. You can easily filter the list by searching a room name.

You can also access details of all the **sessions** that have happened within a specific room by clicking on the room name. A session starts once there are two or more people in a call.

## Participants

Within a session, you can find the **Session details**. The default view is an **Overview** of the participants that attended the session. A single timeline is created for each participant. Any time your user reconnects to the room, the reconnection displays as a new "segment" within the participant's timeline.

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FfsDxPNfn7f61flfYmUFc%2FSession%20Details.png?alt=media&amp;token=d9e37d02-6481-45e6-9bd4-d6e573d9fa7d" alt=""><figcaption></figcaption></figure>

### Display name

The display name of the participant is the name they enter the call with. Your users can either enter this name themselves, or you can pass in for them using the [displayName parameter](https://docs.whereby.com/customizing-rooms/using-url-parameters#displayname-less-than-name-greater-than).

Some customers choose to use generic names, such as `Doctor` or `Patient` for added anonymity. If you would like for names not to appear in your Insights, you can configure this in your account settings by going to "**Configure**" > "**Features**", then scrolling down to the **Privacy features** section and toggling on '**Remove participant display names**'.

Display names will then appear as Participant 1, Participant 2, etc. Participants who leave their name blank when joining a session will appear as Guest 1, Guest 2, etc.

{% hint style="success" %}

#### Participant Call Ratings

Whereby has a call ratings feature in **beta** that you can ask us to turn on for your account.

If you have this feature turned on, each participant will be asked at the end of their call to rate the call quality, and you can track these ratings in a dashboard we will provide to you. Contact Whereby to get this feature enabled.
{% endhint %}

### Browser and operating system

You can use this information to determine if there were any compatibility issues, since not all devices or browsers fully support WebRTC.

Check out our list of [supported browsers and devices](/end-user/end-user-support-guides/supported-browsers-and-devices)

## Reading the charts

{% hint style="success" %}
All dates and times in the Insights UI and API are in UTC.

We capture values for each chart every 2 seconds. We believe this frequency helps capture the spontaneous nature of call issues.
{% endhint %}

### Activity

The **Activity** view provides an events timeline of the participants' camera and microphone. You can use this information to diagnose video or audio issues that your users report.

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FSOJqBZxzuBat3YTvpVLX%2FSession%20Insights%20-%20Activity.png?alt=media&amp;token=2afb2dc6-73cd-40a8-9f2f-c490e198e2f9" alt=""><figcaption></figcaption></figure>

### Connection

The **Connection** view provides an overview of the data being transferred over the course of the session, as well as the connection quality.

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FzNTeHGnPAJE9CjloNEGy%2FSession%20Details%20-%20Connection.png?alt=media&amp;token=093140ad-6aa9-4a44-9d92-fbbb9824b085" alt=""><figcaption></figcaption></figure>

#### Sending & receiving

We've separated packet loss and bitrate out into separate charts for sending and receiving. Each participant is both sending data in the form of audio and video to others on the call and receiving audio and video data in return. Further details can be seen when clicking the toggle next to **Sending** or **Receiving**.

{% tabs %}
{% tab title="Packet Loss" %}

#### Packet loss

Packet loss is a great indicator if a user had poor network. It is a measure of how many data packets sent over a network are lost in transit. Packets are small chunks of data that are used to transmit information over a network.

Packet loss can have a significant impact on the quality of video calls. When packets are lost, the video can become choppy or pixelated. In some cases, the video call may even drop altogether.

Packet loss can occur for a variety of reasons, including:

* **Network congestion:** When there is too much traffic on a network, it can cause packets to be dropped.
* **Hardware failure:** A faulty network device, such as a router or switch, can cause packets to be lost.
* **Interference:** Electromagnetic interference from other devices, such as microwaves or cell phones, can also cause packet loss.

#### How to interpret packet loss values

The amount of packet loss is measured in percentage. For example, 1% packet loss means that 1 out of every 100 packets were lost. 0% packet loss is ideal for video calls, but some amount of packet loss between 0% - 2.5% is tolerable and expected.

{% hint style="info" %}
We consider 3% packet loss to be our threshold for quality. Any value at or exceeding 3% for a sustained period of time means that the participant likely experienced reduced call quality.\
\
Very short periods (2 to 4s) of high packet loss are normal and expected. They will show up on the charts as sharp spikes. It is unlikely the participant noticed a dip in video quality during this short period.
{% endhint %}
{% endtab %}

{% tab title="Bitrate" %}

#### Bitrate

Bitrate is a measure of the amount of data that is transmitted over a network per unit of time. In the context of video calls, bitrate refers to the amount of data that is used to transmit audio and video.

In general, a higher bitrate will result in a better quality video call. However, a higher bitrate also requires more bandwidth. If your user's internet connection does not have enough bandwidth, they may experience choppy or pixelated video.

#### How to interpret bitrate values

We measure bitrate in bits per second (bps), and a "good" value can vary depending on whether participants in the call had turned on HD video, if the call was in `normal` or `group` mode, how many participants joined the call, and whether someone was screensharing.

Generally, we expect to see at least 500kbps sending bitrate if the participant has their video turned on. If the bitrate is below this value and their video was on, they may have sent blurry or pixelated video, choppy audio, or dropped frames. Our first suspicion would be that the participant has a slow internet connection or a poor quality webcam.

If the participant is using HD video, we expect to see 1 - 1.5Mbps send bitrate.
{% endtab %}
{% endtabs %}

#### **Group and normal rooms**

We calculate the sum of all of the streams for *bitrate sending*, and we display the max packet loss for any stream in *packet loss sending*. This is important to be aware of if you are using `"roomMode": "normal"` rooms.

If you use `normal` rooms, each participant on the call is sending a video stream to every other participant. This means if you have 4 participants in a `normal` room, each participant is sending 3 video streams. Then the *bitrate sending* chart will be calculated as the sum of those 3 streams and *packet loss sending* chart will display the stream with the maximum packet loss during the call.

Every room created with `"roomMode": "group"` is using our selective forwarding unit (SFU) mesh for data transfer. This means that every participant is sending only one single video stream to our SFU which then forwards the stream on to every other participant. This is one of [many reasons](https://docs.whereby.com/monitoring-usage/insights-suite-and-api/improving-call-quality#use-group-rooms) why we recommend using `"roomMode": "group"` for better call quality.

## Known limitations

When sessions exceed 30 participants or 3 hours duration, the system will not fetch participant activity and connection data. In these cases, support teams will see an explicit message directing them to retrieve the full data via API instead. This approach prevents performance issues that would arise from loading all participant details in very large sessions.

## Running into issues?

If you are having difficulty troubleshooting or have questions about the content of the insights data provided, please feel free to reach out to our Support team at <embedded@whereby.com>. Diagnosing call quality issues is not the most straightforward endeavor, and we are happy to get your feedback so we can improve these features.

We also have some information and recommendations in our document about [improving call quality](/whereby-product-features/insights-suite-and-api/improving-call-quality).


# Session Ratings

Session Ratings allow you to understand the quality of your sessions through quantitative and qualitative feedback from your participants. This is visually represented within your Insights Dashboard.

{% hint style="success" %}
Session Ratings is currently in Open Beta.
{% endhint %}

{% hint style="info" %}
Session Ratings is a supplementary feature of our paid Whereby Embedded plans.
{% endhint %}

## How does it work? <a href="#how-does-it-work" id="how-does-it-work"></a>

After a session ends, participants can give feedback in three simple steps:

1. Give the call a quality rating from 1 to 5 stars
2. If they gave a low rating, they can select what problems they experienced
3. If they gave a low rating, they can add more details in a comment box (this option is turned off by default)

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FqtcnjBgiKMv0ErKyylvr%2Fin-room.jpg?alt=media&amp;token=2e964566-5d91-44f8-bdb1-74a237c6011d" alt=""><figcaption></figcaption></figure>

You can see all of this feedback in your Whereby Insights dashboard, where you'll find aggregated ratings and can also deep-dive into specific sessions.

## **Setup**

Session Ratings is turned off by default. To enable Session Ratings across all sessions, navigate to the “**Configure**” → “**Features**” section of your Dashboard:

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FaT19fCCSu6X7HCDD0q3x%2FInsights%20Settings.png?alt=media&amp;token=ceeefead-f5f2-44ac-84e7-56cb6e4f9b5c" alt=""><figcaption></figcaption></figure>

Once enabled, an additional tick box allows for more qualitative feedback from low scoring users.

## **Known limitations** <a href="#known-limitations" id="known-limitations"></a>

1. It is currently not possible to enable the feature on a per room basis.
2. The default setup is HIPAA compliant, but if customers decide on using the freeform text field, they could store personal identifiable information. We have no way of redacting this from the freeform.


# Improving call quality

## How to improve call quality

#### **Use `group` rooms**

When [creating rooms](/reference/whereby-rest-api-reference/meetings), we recommend creating rooms that use our selective forwarding unit (SFU) mesh for data transfer instead of peer-to-peer rooms. This is done by setting `"roomMode": "group"` instead of `"normal"` on room creation.

* Our SFU rooms are generally less intensive on network usage, especially when there are more than 2 people in a call or when cloud recording/live streaming are being used.
* The mesh can make changes on the fly to participants' calls in order to manage the bandwidth usage of different resources and prioritize audio transmission. For example, if a participant decreases the size of their browser window during a call, the SFU will adjust the resolution of the videos they are receiving in order to optimize the quality of the call.
* Your calls will benefit from the continuous improvements we make to our SFU mesh.

#### **Turn on our device and connectivity test**

Turning on the [pre-call ceremony](https://docs.whereby.com/customizing-rooms/using-url-parameters#precallceremony-less-than-on-or-off-greater-than) will conduct a live device and network connectivity test for the participant before they join the call.

Read more about this feature in our [release notes](https://whereby.launchnotes.io/announcements/pre-call-device-connectivity-tests).

#### **Turn on low data mode**

Turning on [low data mode](https://docs.whereby.com/customizing-rooms/using-url-parameters#lowdata-less-than-on-or-off-greater-than) will set the participant's video resolution lower by default. This means there is less data to send and receive, which is helpful with poor network conditions.

With [pre-call ceremony](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes#precallceremony-less-than-on-or-off-greater-than) enabled, we surface an option for the participant to toggle this mode on themselves before they join the call.

## **Recommended troubleshooting steps for end users**

* Disable any ad-blockers, VPN, or privacy extensions. Occasionally browser extensions can interfere with how video calls load, which can manifest as video, audio, or room joining issues.
* Close any unnecessary applications when on the video call. This will free up resources on the computer and improve the quality of the video call.
* Ensure the browser is up to date. Outdated software may have bugs that can cause packet loss and other problems.
* Move closer to the Wifi router or use a wired connection if one is available, as it is less prone to interference than wireless networks.
* Try joining the call with video turned off.

Our support team has also provided some additional suggestions in our [Troubleshooting guide](/end-user/end-user-support-guides/end-user-documentation).


# Tracking room events with Webhooks

With Webhooks you can set up user-defined callbacks triggered by meeting events. These are a great way to programmatically keep track of some of the events and actions happening around your meetings.

## Configuration

Webhooks are managed from the "Configure" section of your account, so they need to be set up by an admin in your organization.

![Visit the "Configure" section of your Whereby Embedded account dashboard and scroll down to find the Webhooks setup.](https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/PdLXQJ4NhrqCfbBtQWCc/webhooks-dashboard.png)

At the moment the following event types are supported:

* `room.client.joined` - this is sent when a user joins the meeting room
* `room.client.left` - this is sent when a user leaves the meeting room (this could be via the leave button or by closing the browser tab)
* `room.client.knocked`- this is sent when a visitor knocks the meeting room from the waiting room
* `room.client.knockCancelled`- this is sent when a visitor cancels their knock from the waiting room (this could be via the cancel button or a result of network issues)
* `room.session.started`: Sent when a room session starts, which is when there are at least 2 users in a room.
* `room.session.ended`: Sent when a room session ends. Currently, a session will end when the number of participants has been less than 2 for some time. This heuristic could change in the future to better determine that a session has ended.
* `transcription.started`: Sent when a transcription has started.
* `transcription.finished`: Sent when a transcription has finished processing.
* `transcription.failed`: Sent when a transcription has failed to process.
* `recording.finished`: Sent when a cloud recording has finished and the recording has uploaded successfully.
* `assistant.requested`: Sent when a host invites a Whereby Assistant into their room. See the [Whereby Assistants documentation](/reference/assistant-sdk-reference) for more information.

## Event objects

Events are delivered to their corresponding webhook endpoint in JSON format, as the body of an HTTP request. The table below describes their top-level attributes.

| Property     | Description                                                                                                                                                            |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`         | String that uniquely identifies the event.                                                                                                                             |
| `apiVersion` | The Whereby API version used to populate data. Refer to the details on [Versioning](/reference/whereby-rest-api-reference#versioning) for how webhook data may change. |
| `createdAt`  | ISO representation of the creation date of the event.                                                                                                                  |
| `type`       | The event’s type identifier, e.g. `room.client.joined`                                                                                                                 |
| `data`       | Object containing information associated with the event.                                                                                                               |

## In-Room Data properties

Please note that in-room webhook events are sent for interactions that happen between the creation of the room and an hour after the `endDate` of a room. Also consider that a particular event can be sent more than once, and that you could receive events in non-chronological order.

Properties in `data` that are common to all in-room webhook events:

| Property    | Description                                                                                                 |
| ----------- | ----------------------------------------------------------------------------------------------------------- |
| `meetingId` | The identifier of the meeting that the user has joined/left or where the session has started/ended.         |
| `roomName`  | The string that identifies the room assigned to the meeting. It’s the last path parameter of the `roomUrl`. |
| `subdomain` | The string that identifies your organization.                                                               |

Additional properties in `data` for `room.client.joined` , `room.client.left room.client.knocked` and `room.client.knockCancelled`:

<table><thead><tr><th width="374">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>displayName</code></td><td>The visible name displayed to others in the meeting.</td></tr><tr><td><code>roomSessionId</code></td><td>The <code>roomSessionId</code> for the meeting.</td></tr><tr><td><code>participantId</code></td><td>The current user's <code>participantId</code>. Can be used for insights data.</td></tr><tr><td><a href="/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes#metadata-less-than-string-greater-than"><code>metadata</code></a></td><td>String that matches the "<a href="/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes#metadata-less-than-string-greater-than">metadata</a>" query parameter passed to the room URL.</td></tr><tr><td><a href="/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes#externalid-less-than-id-greater-than"><code>externalId</code></a></td><td>String that matches the "<a href="/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes#externalid-less-than-id-greater-than">externalId</a>" query parameter passed to the room URL.</td></tr></tbody></table>

Additional properties in data for just `room.client.joined` and `room.client.left`:

| Property               | Description                                                                                                                                                                 |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `roleName`             | The client’s role depending on what URL they use to access the meeting.                                                                                                     |
| `numClients`           | Number of clients connected to the meeting after the event.                                                                                                                 |
| `numClientsByRoleName` | Number of clients connected to the meeting after the event, grouped by the `roleName`.                                                                                      |
| `isDialIn`             | `true`when a client has called into the room from a telephone with our [dial-in](https://docs.whereby.com/whereby-101/customizing-rooms/dial-in) feature, `false`otherwise. |

The property `roleName` will have one of the following values:

* `owner`: A user with an admin account in your Embedded organization.
* `member`: A user with an account in your Embedded organization.
* `host`: A user joined using the `hostRoomUrl`.
* `visitor`: A user joined using the regular `roomUrl`.
* `granted_visitor`: The `roleName` that is assigned to a Participant after they have knocked and been let in by a Host.
* `viewer`: A user joined using the `viewerRoomUrl`.
* `granted_viewer`: The `roleName` that is assigned to a Participant if they are queued before a Host joins.
* `recorder`: A cloud recording instance has started or stopped.
* `streamer`: A streaming instance has started or stopped.
* `captioner`: The meeting has been captioned or transcribed.

An example of a webhook event object:

{% tabs %}
{% tab title="JSON" %}

```json
{
  "id": "d7c4df48b85318352b47d2df45872bf9be87595af379e2a8ad8f1ad28b2a482e",
  "apiVersion": "1.0",
  "createdAt": "2021-01-21T16:29:59.681Z",
  "type": "room.client.joined",
  "data": {
    "roleName": "host",
    "displayName": "Joe Bloggs",
    "meetingId": "134",
    "roomName": "/af0b7b66-c738-4981-887a-ad416754f32d",
    "subdomain": "JoeBloggsInc"
    "numClients": 8,
    "numClientsByRoleName": {
      "host": 1,
      "visitor": 7
    },
    "metadata": "<custom-metadata>",
    "externalId": "<custom-id>"
  }
}
```

{% endtab %}
{% endtabs %}

## Transcription Data properties

Properties in `data` that are common to all transcription webhook events:

| Property          | Description                                                                                                                                                                                                                                        |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `roomName`        | The string that identifies the room assigned to the meeting. It’s the last path parameter of the `roomUrl`.                                                                                                                                        |
| `roomSessionId`   | The `roomSessionId` for the meeting.                                                                                                                                                                                                               |
| `transcriptionId` | The identifier of the transcription that has finished processing or failed to process.                                                                                                                                                             |
| `type`            | The type of transcription, `LIVE_TRANSCRIPTION` for Session Transcription or `RECORDING_TRANSCRIPTION` for recording based transcription                                                                                                           |
| `status`          | The status of the transcription. Starts in `in_progress` and transitions to `ready` once the transcript has been successfully written to storage. If any errors occurred in the processing of the transcription then this will be set to `failed`. |

Additional properties in data for just `transcription.finished`:

| Property            | Description                                                                                                                                                                         |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `filename`          | The file name and extension of the transcript.                                                                                                                                      |
| `storageType`       | The storage type of the transcription, `WHEREBY_HOSTED` for transcript files that are stored with Whereby or `SELF_HOSTED` for transcript files that were written to other storage. |
| `durationInSeconds` | The total billable time used for the transcription in seconds.                                                                                                                      |
| `recordingId`       | The identifier of the recording that the transcription is associated with. Only set if `type` is `RECORDING_TRANSCRIPTION`.                                                         |

Additional properties in data for just `transcription.failed`:

| Property | Description                                                               |
| -------- | ------------------------------------------------------------------------- |
| `error`  | The error message that describes why the transcription failed to process. |

## Cloud Recording Data properties

Properties in `data` for the `recording.finished` webhook event:

| Property      | Description                                                            |
| ------------- | ---------------------------------------------------------------------- |
| `filename`    | The file name and extension of the recording.                          |
| `recordingId` | The identifier of the recording.                                       |
| `roomName`    | The string that identifies the room assigned to the meeting.           |
| `status`      | The final status of the recording. It can be only `completed` for now. |

## Validating events

To prevent from [man-in-the-middle attacks ↗](https://en.wikipedia.org/wiki/Man-in-the-middle_attack) , webhook requests to your endpoint contain a signature in the `Whereby-Signature` header. This string is generated with a unique secret that only you can view when creating or editing a webhook in the Embedded dashboard. Only Whereby and you have access to this secret, and no third party can send forged events to your endpoint. On top of that the header also includes a timestamp to help you prevent replay attacks. The header is composed of a timestamp and the signature itself, for example:

{% tabs %}
{% tab title="Text" %}

```
Whereby-Signature:
t=1606227791,v1=94a23dc9d73e8e6abdf9d4095aee954697e9317e9649e742361b35707edd45a3

```

{% endtab %}
{% endtabs %}

To verify an event’s signature, follow these steps:

1. Extract the timestamp and signature by splitting the string on `,` then removing both `t=` and `v1=` from the resulting strings.
2. Prepare the `signedPayload` string by concatenating the timestamp (as a string), the character `.` and the JSON event object (the request body).
3. Calculate the HMAC: It is the SHA256 hash of `signedPayload`, using the endpoint’s signing secret (the one you get when creating the webhook) as the key.
4. Compare the signature from the header to the one you just generated. To protect yourself from timing attacks consider using a constant-time equality function instead of the default equality operator of the language you’re using. Finally, to prevent replay attacks, compare the header’s timestamp with the current one and decide if the elapsed time is within your allowed threshold.

An example of a webhook event validation:

{% tabs %}
{% tab title="Node" %}

```javascript
import crypto from "crypto";

const WEBHOOK_SECRET = "<WEBHOOK_SECRET>";
const MAX_ELAPSED_TIME = 1000 * 60; // 1 minutes in milliseconds

function isWebhookEventValid({ body, headers }) {
  const wbSignature = headers["whereby-signature"];
  const matches = wbSignature.matchAll(/t=(.*),v1=(.*)/gm);

  let timestamp, signature;
  for (const match of matches) {
    timestamp = match[1];
    signature = match[2];
  }

  const current = new Date();
  const diffTime = current - parseInt(timestamp * 1000, 10);

  const signedPayload = timestamp + "." + JSON.stringify(body);

  const sha256Hasher = crypto.createHmac("sha256", WEBHOOK_SECRET);
  const hash = sha256Hasher.update(signedPayload);
  const hashStr = hash.digest("hex");

  return (
    crypto.timingSafeEqual(
      Buffer.from(hashStr, "utf-8"),
      Buffer.from(signature, "utf-8")
    ) && diffTime < Whereby.MAX_ELAPSED_TIME
  );
}
```

{% endtab %}
{% endtabs %}

## Failed delivery

Any `5xx` response to the webhook delivery request will trigger a retry, for a total of 2 retries. A short exponential backoff will be used. We also have a 5 seconds timeout on webhook requests, if the response takes longer than that the same retry mechanism will be used.


# Recording

Recording allows for you or your hosts to capture a recording of a meeting as it appears within the Whereby room. We offer options for recording locally in the browser or using a cloud-based solution.

### Cloud Recording

Cloud recording allows you to record your meetings and store those files in a cloud storage bucket. You can choose to store the recording files in Whereby-provided storage or in external storage owned and managed by you and your organization. This can be set in your call recording setting.

Currently, we only support Amazon S3 as the external storage for cloud recordings. You can review their plans and pricing on the [AWS site](https://aws.amazon.com/s3/pricing/).

[Read more](/whereby-product-features/recording-with-embedded/cloud-recording)

### Local Recording

As the name implies, Local Recording is handled completely locally in the host's browser and browser cache. This feature wasn't designed for an embedded use case so there are some quirks to using and implementing it into your service.

[Read more](/whereby-product-features/recording-with-embedded/local-recording)


# Cloud Recording

Cloud recording is a feature of our paid Embedded plans and allows you to record meetings that are saved to a storage bucket accessible by you.

{% hint style="warning" %}
We recommend a strict access policy on your S3 bucket, if you require HIPAA compliance. Key rotation will provide additional security, but also could impact operations, like receiving a permissions error when trying to record/transcribe.
{% endhint %}

## Summary

Cloud recording is a feature of our paid Embedded plans, which allows you to record meetings that are saved to a storage bucket accessible by you.

{% hint style="info" %}
Cloud recording is a supplementary feature of our paid Whereby Embedded plans. You can review the pricing and options [on our site](https://whereby.com/information/embedded/pricing/).
{% endhint %}

{% hint style="warning" %}
To be HIPAA compliant while using cloud recording, you need to store the recordings in an S3 storage managed by your organization.
{% endhint %}

## Storage options

We offer two storage options for our cloud recording feature:

### Whereby-provided Storage

By choosing Whereby-provided storage for recordings, you can can take full advantage of the flexibility of cloud recording without the need to configure and maintain your own Amazon S3 bucket for media storage.

Whereby would not delete your media files automatically, so we recommend that you periodically delete the obsolete recordings from Whereby storage or download them to the storage of your choice.

You can delete or download the recordings either through the "Recordings" page in Whereby customer portal or using our [Recordings API](https://docs.whereby.com/whereby-rest-api-reference#recordings).

#### Pricing

Depending on your plan, you will have some Whereby-provided storage quota available for free. For example, Whereby Build customers have 30 GB days of storage included in their plan. They can store 1 GB of recordings for 30 days, 2 GB of recordings for 15 days or 30 GB of recordings for 1 day each month for free, at no additional cost.

There is an additional storage fee applied to recordings saved in Whereby-provided storage above the free storage quota available in your plan. You can check the current price of Whereby-provided storage as well as available free storage quota on [Whereby's pricing page](https://whereby.com/information/embedded/pricing) or in the "Subscription" section of your customer portal.

### Self-Hosted Storage <a href="#self-hosted-cloud-recording-storage" id="self-hosted-cloud-recording-storage"></a>

When storing recordings and transcriptions in your own S3 bucket, you’ll need to configure how Whereby authenticates with your storage.

{% content-ref url="/pages/gkomBrOGCJubl1u8hNZs" %}
[Secure Authentication for S3 Storage](/whereby-product-features/secure-authentication-for-s3-storage)
{% endcontent-ref %}

## Setup

You can access recording settings and options from the “**Configure**” → “**Recording**” section of your Dashboard. You can also specify recording preferences via the API during a [room creation](/reference/whereby-rest-api-reference/meetings) request.

{% hint style="info" %}
When configuring cloud recording options via the Dashboard, it will apply these as default settings for all rooms created. However, you can override the defaults by specifying different preferences within the POST requests used to create meetings.
{% endhint %}

![](https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/KpYnfpHfTmO6xGQEf0CB/Screenshot%202023-06-26%20at%2013.17.15.png)

### Recording trigger

After setting up the appropriate information, select how you would like to trigger your recording in rooms.

* **Auto-start (1 person)**\
  Recordings will start when the first person joins and end when the last person leaves
* **Auto-start (2 people)**\
  Recordings will start when 2 people join a room and end when the last person leaves
* **Prompt host**\
  Display a prompt to the host to manually start recording
* **Manual**\
  Host will manually start by clicking "Record" in the toolbar

### Recording format

You can choose the format in which you want to save the recordings. Currently, you can select either <mark style="color:blue;">`.mkv`</mark> or <mark style="color:blue;">`.mp4`</mark> file formats.

Recording quality is set to 720p, however, individual video feeds may appear in lower quality depending on their network connection, device, and preferences.

![](https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/nJp2xbK1lNlhafVbFpaf/Recording%20format%202.png)

{% hint style="info" %}
File names will be automatically set to <mark style="color:red;">`[room name]-[start time in ISO format].mkv`</mark> and is the time when the recording started.
{% endhint %}

## Additional information

### Managing recording activity

With our `recording.finished` [webhook event](https://docs.whereby.com/monitoring-usage/webhooks#cloud-recording-data-properties), you can be aware of when a recording has finished *and* successfully uploaded to your AWS or Whereby-hosted storage. More importantly, you can know the filename to programmatically use or manage that recording for your platform needs.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/QtBdhPgbQ7XKgOh2FDMz/recording-finished-webhook.png" alt=""><figcaption></figcaption></figure>

You can use our [webhook events](/whereby-product-features/insights-suite-and-api/webhooks) to track when a recording has started and stopped. The roleName will be set to `recorder` and will use the `room.client.joined` and `room.client.left` events accordingly.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/d0JXdCVHP7A6TA3W4hCh/recorder%20webhook.png" alt=""><figcaption></figcaption></figure>

In addition to tracking recordings, we offer [commands](/reference/using-the-whereby-embed-element#sending-commands) to start and stop recordings at your leisure via our SDK's Web Component.

### Downloading from Whereby-provided storage

If you choose to save your cloud recordings in Whereby-provided storage, you can delete or download them manually through your Whereby Dashboard or using our [Recordings API](https://docs.whereby.com/whereby-rest-api-reference#recordings).

You can access all recordings saved in the Whereby-provided storage from the “Recordings” page of your Dashboard.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/M53M91jnXzBzSkbVtFm5/Screenshot%202023-06-27%20at%2013.09.27.png" alt=""><figcaption></figcaption></figure>

## Known limitations

1. Cloud recording does not support our [Breakout Groups](/whereby-product-features/breakout-groups-with-embedded) feature. When using Breakout Groups, the recorder will remain in the main room and will not capture any of the meeting content from individual groups.
2. Using Whereby-provided storage is not HIPAA-compliant at this time. You'll need to store the recordings in an S3 storage managed by your organization.


# Local Recording

Local Recording is handled completely locally in the host's browser and browser cache.

{% hint style="warning" %}
We recommend that this isn't used in a production environment without significant internal testing. Recordings are only created and stored locally. Whereby cannot recover any lost or corrupted recordings.
{% endhint %}

{% hint style="info" %}
If using in a telehealth setting, it is the responsibility of the person that initiated the recording and saved it locally to adhere to HIPAA requirements. Be sure to assess internally if this is something that can be accept per your HIPAA compliant policies. Whereby cannot control what happens to a local recording.
{% endhint %}

## Setup

With the Recording feature you'll need to ensure that several different conditions are met so your room hosts are able to see and use the feature.

1. You're generating and the host is using a [`hostUrl`](/whereby-product-features/user-roles-and-privileges)
   * Only a room host will be able to Record in the room so you need to provide this type of link to the host.
   * When generating this be sure to note that a `hostUrl` is only valid between the meeting creation and [`endDate`](/whereby-product-features/using-the-rest-api#enddate-and-deleting-rooms) that you set during your request. These times are in UTC and not your local time zone, unless a timezone was specified in the request.
2. You've enabled Local Recording from the “Configure” → “Recording” section of your dashboard, **AND** you are using `?recording=on` in your room URLs.\
   \
   Or, you've set the recording type to <mark style="color:blue;">`local`</mark> during the meeting creation [API request](/whereby-product-features/using-the-rest-api#creating-rooms).

## Additional Information

{% tabs %}
{% tab title="Best Practices" %}

* Local Recording is only available in Chrome or Chromium browsers on a desktop or laptop. It is not available on mobile devices.
* When recording a meeting while using the [YouTube integration](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes#roomintegrations), any audio from the YouTube video will not be captured in the recording. If you need to capture audio from the video you're viewing in the local recording, we recommend [sharing your screen](/whereby-product-features/screen-sharing#screen-sharing-with-audio) with audio.
* Whereby recordings are stored locally in your browser until they are downloaded onto your device. We recommend clearing your browser's site data, cookies, and cache prior to making a recording, to help ensure that your browser does not run out of space.
* Files are initially downloaded as .webm files, which can be used in many platforms like Slack, YouTube, Chrome, and more. However you can use free programs like [VLC](https://www.videolan.org/vlc/index.html) or [Handbrake](https://handbrake.fr/) to convert them to a file format you prefer
  {% endtab %}

{% tab title="Troubleshooting" %}
**Record button not appearing:**

1. Verify you're accessing the meeting with a hostUrl
2. If you've generated the roomUrl via the dashboard, you must include the parameter of `&recording=on`

**Unable to download recordings**

1. Recordings are stored locally in your browser cache, so they will only be available on the device and browser that they were originally recorded on
2. In rare cases, Chrome extensions can interfere with the download process. Try temporarily disabling them and then attempt the download again
3. In some cases, if your browser ran out of storage while creating the recording, the resulted file in unable to be completed and not able to be downloaded. Prior to your next recording, try clearing your cache, cookies, and site data
   {% endtab %}
   {% endtabs %}

## Known Limitations

* We recommend that this isn't used in a production environment without significant internal testing. Recordings are only created and stored locally. Whereby cannot recover any lost or corrupted recordings.
* Only available in Chrome or Chromium browsers on a desktop or laptop


# Screen Sharing Setup & Usage

Screen sharing is a great way to share content to other hosts/participants in the room.

To keep an optimal level of performance in the room, screen sharing will broadcast from 1-5 FPS (frames per second) by default, and up to 1080p based on network and CPU restraints.

Depending on the browser being used, there will be different options for what can be shared.

{% hint style="danger" %}
Screen sharing on Mobile (both phone and tablet) devices is not currently available.
{% endhint %}

## Setup and Management

As the platform holder, there are few options you have for managing the available screen sharing feature.

* Enabling screen sharing for all rooms via a [dashboard preference](/whereby-product-features/dashboard-preferences)
* Enabling screen sharing on a per room/user basis with a [URL parameter](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes#screenshare-less-than-on-or-off-greater-than)
* Listening for the [screen sharing event](/reference/using-the-whereby-embed-element#listening-to-events) with our Web Component to facilitate in app messages or notifications
* Using the [browser method](/reference/using-the-whereby-embed-element#sending-commands) for stopping/starting screen sharing

## Browser sharing options

{% tabs %}
{% tab title="Chrome/Chromium" %}
You can share an image of your entire screen. If you have multiple monitors, you can also select which one you'd like to show.

If you select the "Window" section, you can select a specific application like Word or Chrome that you want to share.

lastly, you can use the Chrome Tab option if you only want to share one tab from your Browser.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/UUljiwHn0JUJGXlHfi0u/Screenshot%202023-08-11%20at%203.25.24%20PM.png" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Firefox" %}
Firefox allows for the sharing of an entire screen, or of an app window. Options are not divided into sections.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/YU58oq7UAVJn4NRznxbZ/Screenshot%202023-08-11%20at%203.32.26%20PM.png" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Safari" %}
Safari allows for the sharing of an entire screen, or of an app window. When selecting the "Share Window" option, you'll hover your mouse over and click the window you'd like to share.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/xt8tJeQnwRci3W0UpnuL/Screenshot%202023-08-11%20at%203.36.32%20PM.png" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

## Screen sharing additional features

### Screen sharing with audio

Sharing computer audio is possible while screen sharing and using Chrome or Chromium browsers.

Depending on the sharing option selected and the operating system, a checkbox that says "Share Audio" will be present that you can check to share audio.

{% hint style="success" %}
**Tip:** Many audio and video files (*eg mp3, mp4, webm*) can be opened into Chrome for viewing and playback. Simply drag and drop the local files into a new tab, and share tab audio as previously mentioned
{% endhint %}

{% tabs %}
{% tab title="macOS" %}
**macOS**

On macOS, users are only able to share a specific Chrome tab. Sharing audio for the entire computer or a specific application window isn't possible at this time due to browser/operating system permissions.On Windows machines, you'll have the option to share audio from any Chrome tab, and you can also share the audio for your Entire Screen.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/Y632lkR4KJ1AVfvDMc63/file-KljwIMe85O.png" alt="" width="375"><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Windows" %}
On Windows machines, users have the option to share audio from any Chrome tab or share the audio for the Entire Screen.

{% hint style="danger" %}
Sharing the audio of the entire screen that contains a Whereby room will cause an echo effect. To prevent this issue from happening, try sharing the audio of a Chrome tab or a separate monitor instead.
{% endhint %}

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/G0hGRrId2kQqfeWpJT6v/file-KljwIMe85O%20(1).png" alt="" width="375"><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

### Picture in Picture

{% hint style="warning" %}
Due to a bug in Safari for macOS, we've temporarily disabled our Picture in Picture feature for versions 17.x
{% endhint %}

Allowing the use of "[Picture in Picture](https://docs.whereby.com/customizing-rooms/using-url-parameters#pipbutton-off)" can be helpful for users that want to screen share content and still be able to view others within the room.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/VZnxNb7iaxqzg8FeDjWu/file-I2HcA3GVNZ.png" alt="" width="480"><figcaption></figcaption></figure>

This activates a pop-out of the currently active videos within the meeting room.

Users can also set picture-in-picture to automatically launch when they're switching between tabs. We have a guide here with the possible automatic options: [Picture in Picture (PiP) — Automatically](https://whereby.frontkb.com/en/articles/4507650#automatically)

### Annotating Screen share

Users can extend the capability of screen sharing by installing extensions in Chrome or Chromium browsers. Tools like "[Draw on page](https://chrome.google.com/webstore/detail/draw-on-page/ngmfehckdahhmlbabjemcepfhgnoddlo?utm_source=ext_sidebar\&hl=en-US)" or "[Paint](https://chrome.google.com/webstore/detail/paint/ejllkedmklophclpgonojjkaliafeilj)" work well to highlight and indicate content in your browser while screen sharing.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/XUNEANO5JBD2EOgj32Ov/Screenshot%202023-08-14%20at%202.29.27%20PM.png" alt="" width="563"><figcaption></figcaption></figure>

## Troubleshooting Screen Sharing

#### "Could not start screen share"

If you are seeing the above error message, it could mean a few things. Either the request was canceled or your browser doesn't have permission to access screen sharing.

{% hint style="info" %}
**Windows Permissions**: At the moment Windows doesn't have any system-level permissions for screen access. if you're running into problems or getting an error, double-check your browser settings.

**Chrome and Chromium**: At the moment Chrome doesn't have any specific settings related to screen access.
{% endhint %}

{% tabs %}
{% tab title="macOS permissions" %}
In the more recent versions of macOS, Apple has introduced system-level permissions for applications like your browser for accessing screen sharing.

If you've recently updated or upgraded your device and can't screen share anymore, you'll need to update the preferences by doing the following:

1. Open up **System Settings** on your Mac
2. Click on the "**Privacy & Security**" section
3. Scroll to the "**Screen & System Audio Recording**" section, and ensure that your browser is toggled on
4. Restart your browser

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/5CYVmpSoZLKv56hOOMvd/Screen%20share%20permissions.png" alt="" width="563"><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Safari Permissions" %}
In some cases you may have accidentally blocked screen sharing for the site at a browser level. In Safari you can fix that with the following:

1. In your menu bar, select **Safari->Settings**
2. Select the "**Websites**" option
3. Scroll down to the "**Screen Sharing**" section
4. Find your website and verify it is set to "**Ask**"

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/3QLMdSVJk62FtHH5qKwQ/safari%20screen%20share%20permissions.png" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="FireFox Permissions" %}
When using screen sharing in Firefox, you'll see a pop up that asks if you'd like to allow Whereby (or your site) to access your screen

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/dGkF1c89jt3pzl5j8UtX/Firefox%20screen%20share.png" alt="" width="375"><figcaption></figcaption></figure>

If you accidentally selected "Always block", Firefox won't show this prompt again. In this case, you'll need to manually reset the permissions for screen access by doing the following:

1. Click on the "Site information" area, just to the left of the website address
2. Locate the "Share the Screen" item in the list, and select the "**X**" next to Blocked

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/YJrYsm0amZl1fMDSt1xC/Firefox%20screen%20share%202.png" alt="" width="375"><figcaption></figcaption></figure>

3. Refresh the tab
   {% endtab %}
   {% endtabs %}

#### "Screen share is hard to read"

If you're having trouble reading smaller text on a screen share, try making the window or content that is being shared smaller. That might mean instead of sharing the entire screen, share a browser window/tab that has been resized slightly. Or, if you have a large monitor try to not use an app window or browser tab that is stretched to the full size of the monitor.


# Secure Authentication for S3 Storage

Use OpenId Connect for secure S3 storage of your recordings and transcriptions.

## Overview

{% hint style="info" %}
If you're using **Whereby-hosted** storage, you can skip this guide. This only applies to **Self-hosted** cloud recordings and session transcriptions.
{% endhint %}

When storing cloud recordings and session transcriptions in S3, the system must authenticate with your S3 bucket to upload and manage objects securely.

We support two authentication methods:

1. Access Key authentication
2. OIDC (OpenID Connect) authentication

Both methods allow access to the same S3 functionality, but they differ in how credentials are managed and how they are configured.

This documentation explains:

* What each authentication type is and how it works
* When to use each method
* How to configure both Access Key and OIDC authentication

## At a glance

* Access Key authentication uses long-lived AWS credentials (access key ID and secret access key).
* OIDC authentication uses short-lived credentials by assuming an IAM role via an OpenID Connect identity provider.

For most production environments, **OIDC authentication is recommended.**

{% hint style="warning" %}
Currently, we only support OIDC authentication with **AWS,** with hopes to expand this to other providers in the future.
{% endhint %}

## See Also

* [Understanding Authentication Types](/whereby-product-features/secure-authentication-for-s3-storage/understanding-authentication-types)
* [Configure Access Key Authentication](/whereby-product-features/secure-authentication-for-s3-storage/configure-access-key-authentication)
* [Configure OIDC Authentication](/whereby-product-features/secure-authentication-for-s3-storage/configure-oidc-authentication)


# Understanding Authentication Types

## Access Key authentication

### Overview

Access Key authentication uses long-lived AWS credentials: an **access key ID** and a **secret access key**. These credentials belong to an IAM user or role in your AWS account and are used directly to authenticate requests to S3.

### How it works

1. You create an IAM user or role in AWS.
2. That identity is granted permissions to access the target S3 bucket (for example, `s3:PutObject`, `s3:GetObject`).
3. You generate an access key ID and secret access key.
4. These credentials are stored in your configuration and used whenever recordings or transcriptions are uploaded.

### When to use Access Key auth

Access Key authentication is a good fit when:

* You want a **simple and familiar setup**
* You are working in environments where OIDC is not available
* You already manage IAM users and access keys
* You are integrating with existing infrastructure that relies on static credentials

### Considerations

* Access keys are **long-lived secrets** and must be stored securely
* Keys must be **rotated manually** to reduce security risk
* If a key is compromised, it must be revoked and replaced

## OIDC (OpenID Connect) authentication

### Overview

OIDC authentication allows the system to assume an AWS IAM role using **short-lived credentials**, without storing long-lived secrets. Authentication is based on trust between AWS and an OIDC identity provider.

### How it works

1. You configure an OIDC identity provider in AWS.
2. You create an IAM role that trusts that identity provider.
3. The role is granted permissions to access the S3 bucket.
4. When access to S3 is needed, the system exchanges its OIDC identity for **temporary AWS credentials** by assuming the role.
5. These short-lived credentials are used to upload recordings and transcriptions.

### When to use OIDC auth

OIDC authentication is recommended when:

* You want **improved security** with no long-lived secrets
* You are running in cloud or containerized environments
* You want **automatic credential rotation**
* You follow modern, least-privilege security practices

### Considerations

* Initial setup is more complex than access keys
* Requires AWS IAM role and OIDC provider configuration
* Not all environments support OIDC out of the box


# Configure Access Key Authentication

## Setup and information in S3

{% hint style="warning" %}
This feature requires the use of Amazon S3 storage. You can review their plans and pricing on the [AWS site](https://aws.amazon.com/s3/pricing/). Amazon also offers some [free tier](https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank\&all-free-tier.sort-order=asc\&awsf.Free%20Tier%20Types=*all\&awsf.Free%20Tier%20Categories=*all) options to explore. Note that if you're creating an AWS account from scratch it can sometimes take up to 24 hours.
{% endhint %}

{% embed url="<https://youtu.be/iLRCdQNK7FY>" %}
How to setup Amazon S3 bucket for Cloud Recording storage
{% endembed %}

If you choose to use your own storage, there are a few pieces of information to gather from your S3 instance to create and connect your bucket with Whereby. We'll outline each one briefly below and how to locate the information.

{% tabs %}
{% tab title="Creating a Bucket" %}
Creating an S3 bucket can be done from the [Amazon S3 console](https://console.aws.amazon.com/console/home) page. If S3 isn't presented as an option you can search for it within the services search at the top of the page.

![](https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/1xEXBQj45axFDcBZ7Ey3/S3%20bucket.png)

For in depth instructions about bucket naming conventions and settings, please follow the Amazon support guide "[Create your first S3 bucket](https://docs.aws.amazon.com/AmazonS3/latest/userguide/creating-bucket.html)".
{% endtab %}

{% tab title="S3 info for Whereby" %}
**Host:**\
This is also known as your Bucket name. No URL is required, you can simply copy and paste your bucket name found in your S3 console.

![](https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/oUB2y9yjeYwQWo9e7cp1/Bucket%20name.png)

**Access Key ID & Access Secret:**\
You can locate or create your Access Key and Access secret in the "Identity and Access Management" (IAM) section of your console.

{% hint style="info" %}
It's recommended and considered best practice to create IAM users with the appropriate permissions for your AWS Access Keys. Sharing the credentials of a Root user can allow unrestricted access to all resources in your AWS account, including billing information.\
\
For more information, check out Amazon's support article:\
[Best practices for managing AWS access keys](https://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html#root-password)
{% endhint %}

![Where to create Access Keys](https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/sfwSit5R0kZkzzLEttKC/access%20key%20s3.png)

**Key & secret rotation:**

If you wish to rotate the access key at regular intervals, Whereby supports setting new keys on the organization level using our admin UI, or on a per room level using our [REST API](/reference/whereby-rest-api-reference).

Please ensure, however, that any recording started before updating the key is allowed to finish before invalidating the old key. The following steps should ensure continuous operation:\
\
(One day before invalidation of old key)

1. Create a new access key & secret with identical permissions to the existing one
2. Update cloud recording settings in the admin UI with the new key / update code which uses our REST api to include new key
3. Wait until all existing recordings have completed (max recording duration is 24 hours)
4. Delete / invalidate old key
   {% endtab %}
   {% endtabs %}


# Configure OIDC Authentication

If you choose S3 storage with OIDC authentication, there are a few things you’ll need to set up in AWS before configuring your storage in Whereby.

At a high level, this involves:

* Creating an S3 bucket to store recordings and transcriptions
* Creating an IAM role that Whereby can assume using OIDC
* Granting that role permission to access your S3 bucket

## Creating a Bucket

Creating an S3 bucket can be done from the [Amazon S3 console](https://console.aws.amazon.com/console/home) page. If S3 isn't presented as an option you can search for it within the services search at the top of the page.

![](https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/1xEXBQj45axFDcBZ7Ey3/S3%20bucket.png)

For in depth instructions about bucket naming conventions and settings, please follow the Amazon support guide "[Create your first S3 bucket](https://docs.aws.amazon.com/AmazonS3/latest/userguide/creating-bucket.html)".

**Host:**\
This is also known as your Bucket name. No URL is required, you can simply copy and paste your bucket name found in your S3 console.

![](https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/oUB2y9yjeYwQWo9e7cp1/Bucket%20name.png)

## Creating an OIDC Identity Provider in IAM

You’ll need an IAM OpenID Connect provider that matches your OIDC issuer.

1. Go to IAM.
2. In the left sidebar, select Identity providers.
3. Select Add provider (or Create provider).
4. For Provider type, choose OpenID Connect.
5. Enter the following details:
   * Provider URL: **`https://cognito-idp.eu-west-1.amazonaws.com/eu-west-1_tMvcyDdW4`**
   * Audience: **`427ijsob8u270j7sbil5rbnjj1`**<br>

     <figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fsj7FBX3X1v9qnVEu2DCi%2Fimage.png?alt=media&amp;token=6b9b1278-d22b-4ce4-ba79-f8f11e6ad18f" alt=""><figcaption></figcaption></figure>
6. Follow the prompts to create the provider.

{% hint style="info" %}
For more in depth information on creating an OIDC identity provider, see this AWS support guide: [Create an OpenID Connect (OIDC) identity provider in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc.html)
{% endhint %}

## Creating an IAM Role

Next you create an IAM role with a trust policy for your OIDC provider, and permissions to your S3 bucket.

1. In IAM, go to Roles.
2. Select Create role.
3. Under Trusted entity type, choose Web identity.

   <figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FnKIAxnNxEUGJ31LfejID%2Fimage.png?alt=media&amp;token=7317078e-27ad-4e7b-b038-ae7bacbd0f9f" alt=""><figcaption></figcaption></figure>
4. Configure:
   1. *Identity provide*r: select the OIDC provider you created
   2. *Audience*: select/enter the audience used above
5. Attach permissions (you can do this either by selecting an existing policy or creating a new one). You'll need the following:
   1. `s3:PutObject`,
   2. `s3:GetObject,`
   3. `s3:ListBucket`
6. Select **Next**.
7. Enter:
   1. Role name: e.g. `WherebyS3StorageRole`
8. Select Create role - and copy this Role ARN from the summary page for later.

For more in depth information on how to create an IAM role for OIDC authentication, see this AWS support: [Create a role for OpenID Connect federation (console)](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_oidc.html)

## Configure your storage in Whereby

The final step is to input these values into your Whereby dashboard:

1. Visit your organization dashboard
2. Navigate to the Configure section for either Recordings or Transcriptions
3. Select "Self-hosted cloud recording", and change "Connection Method" to **role-based.**

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FVHl0JaCo1XKlza7wB8fu%2Fimage.png?alt=media&amp;token=2fc0670d-fbdf-4ed4-b664-5816ffddbb3a" alt=""><figcaption></figcaption></figure>

4. Enter your bucket name (from step 1) and your Role ARN (from step 3)
5. From here, you can test your connection and then save these credentials to be used during your next Whereby meeting!

## Restrict the role to Whereby's OIDC Sub ID

Once you have added your configuration to the dashboard, we can provide you with the\
exact `sub` value used in our OIDC token for your organization. You can update the IAM role trust policy **to allow only this subject** to assume the role. *This security measure prevents the confused deputy scenario (read* [*here*](https://docs.aws.amazon.com/IAM/latest/UserGuide/confused-deputy.html#mitigate-confused-deputy) *for more details).*

1. Get the `sub` value from your Whereby dashboard
   1. Copy the exact `sub` string we provide for your organization (hidden behind the Show Sub ID button).

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FTcNmYpJXW7cWwwZeydcJ%2Fimage.png?alt=media&amp;token=0b5d28ec-34cf-4e1d-bfd5-e80613ec42a7" alt=""><figcaption></figcaption></figure>

2. Open the IAM role
   1. In the AWS Console, go to IAM
   2. In the left sidebar, click Roles
   3. Search for and select the role you created for Whereby
3. Edit the trust policy
   1. Go to the Trust relationships tab
   2. Click Edit trust policy
4. Add the `sub` condition
   1. In the JSON editor, find the statement with:
   2. Under `"Condition"`, extend the `StringEquals` condition for the subject claim:

```json
"Condition": {
  "StringEquals": {
    "<your-oidc-provider-host>:aud": "<your-audience>",
    "<your-oidc-provider-host>:sub": "<whereby-sub-value>"
  }
}
```


# Tracking Customer Usage

Use the Whereby Insights API for custom tracking

{% embed url="<https://youtu.be/HKr836Exm1o>" %}

## Getting Started

Whereby has a number of options you can use to track and report on the usage of your video meetings. The Insights Suite and API are a great starting point, but with a few simple changes to your meeting links you can enhance this data to enable segmentation by customer, or even by user.

{% hint style="info" %}
You can use either of the options below individually, but you can also implement both for maximum flexibility!
{% endhint %}

### roomNamePrefix

The roomNamePrefix option allows you to track usage on a per-room basis. This prepends a string of your choosing to the roomName, which allows for sorting based on that prefix when you're reporting on usage.

{% code overflow="wrap" %}

```json
// Example Request
{
  "roomNamePrefix": "test-prefix-",
  "endDate": "2099-06-13T19:22:05.168Z",
}

//Example Reponse
{
    "startDate": "2099-06-13T19:22:05.168Z",
    "endDate": "2099-06-27T19:22:04.807Z",
    "roomName": "/test-prefix-87e0497f-40e0-47f1-9a27-fb72fdbc1fda",
    "roomUrl": "https://yoursubdomain.whereby.com/test-prefix-87e0497f-40e0-47f1-9a27-fb72fdbc1fda",
    "meetingId": "87385993"
}
```

{% endcode %}

With this option you'll need to have some mechanism for detecting which of your customers is requesting the room, and then programmatically set the roomNamePrefix based on that result.

For example if you have a function that logged in users can use to generate a meeting, you could assign the roomNamePrefix based on the company they work for.

### Attributes / URL Parameters

{% hint style="info" %}
[Attributes](/reference/using-the-whereby-embed-element#attributes-of-the-component) are available on our Web Component, and are generally what we recommend for implementing Whereby's pre-built experience. If you're using an iframe though you can also opt for URL Parameters.
{% endhint %}

Attributes and URL Parameters allow you to report on usage a specific user, or a grouping of users. Specifically, `externalId` and `metadata` are included in our webhook and insights data.

{% code overflow="wrap" %}

```html
Attributes Example

<whereby-embed room="https://subdomain.whereby.com/your_room" displayName="John Smith" metadata="some string" externalid="1234" />

```

{% endcode %}

{% code overflow="wrap" %}

```html
URL Parameters Example

<iframe
  src="https://yoursubdomain.whereby.com/test-prefix-87e0497f-40e0-47f1-9a27-fb72fdbc1fda?metadata=some_string&externalId=1234"
  allow="camera; microphone; fullscreen; display-capture; autoplay; compute-pressure"
></iframe>
```

{% endcode %}

In both of the above cases you could simply pass in the user's ID on your own platform as the value, which would make relating data between your back-end and Whereby very straightforward.

## Report on Tracked Data

### Insights Dashboard

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/n0rIPY77Yqau1RsAQOKH/Screenshot%202024-06-13%20at%2010.26.16%20AM.png" alt=""><figcaption></figcaption></figure>

The Insights Dashboard is great for quickly referencing insights data or getting a general overview of your usage. Simply log in to your Whereby account, and select **Insights** **>** **Rooms**.

From here we can search for a specific roomNamePrefix to see a list of rooms that contain that prefix. The PM used column shows the number of Participant Minutes that have been used in that meeting, and the Sessions column shows how many sessions (individual meetings) have taken place in that room.

#### Session and Participant Details

Click on a room name to see a list of sessions that have taken place in that room. From there click on the relevant session to see all of the details.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/2sMYczr7GZtjmAQajp76/Screenshot%202024-06-13%20at%2010.32.20%20AM.png" alt=""><figcaption></figcaption></figure>

On the Session details page you can click on a Participant ID to see detailed information on that participant, including the externalId via the events section. You can also view quality related stats for that participant like any bandwidth, CPU issues, or packet loss. This can be a useful tool for troubleshooting if a participant reports issues during a specific meeting.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/7lb1QMdnvhjPag1bf0Fz/Screenshot%202024-06-13%20at%2010.34.24%20AM.png" alt=""><figcaption></figcaption></figure>

### Insights API

The Insights API includes all of the same information that you can access from the Dashboard, but it also allows for automating the retrieval and further processing of that data.

With this method you'll need to have some experience querying APIs, but any method you normally use for API requests will be supported! If you don't have a lot of technical experience you can also opt for a tool like [Postman](/further-resources/using-postman), and Whereby has set up a collection of pre-formatted requests that you can use to quickly get started!

For a complete overview of using the Insights API, check out our [REST API Reference](/reference/whereby-rest-api-reference).

### Web Component / Webhook Events

[Web Component](/reference/using-the-whereby-embed-element) and/or [Webhook](/whereby-product-features/insights-suite-and-api/webhooks) Events offer access to real-time event data, which can be helpful for tracking individual users. For example if you need to verify that your hosts/guests are arriving to meetings on-time, these events will give you real-time reports on join and leave times for the room!

These events include the `metadata` and `externalId` values that are passed in as Attributes or URL parameters. You'll also be able to capture the roomName with either method, since this is included on the Web Component and Webhooks have a roomName value in their payload!

Once you're capturing data, you can do your on processing on it, or even import the values into your own insights platform for even more powerful insights.


# Transcribing

Transcribing allows you to get a video to text transcript of what was said in your meeting rooms. You can get a transcript directly from the session, or from processing a recording.

{% hint style="info" %}
Transcription is a supplementary feature of our paid Whereby Embedded plans. You can review the pricing and options [on our site](https://whereby.com/information/embedded/pricing/).
{% endhint %}

Session transcripts can be used as a standalone resource (eg. for compliance purposes) or sent to an external service for post processing (eg. to derive key topics or create a session summary). You can create transcripts directly from the session (without the need to record it), or you can transcribe any session recording saved in [Whereby-provided storage](/whereby-product-features/recording-with-embedded/cloud-recording#whereby-provided-storage). Transcripts are saved as text files accessible through the customer portal or via [the API](/reference/whereby-rest-api-reference).

### Session Transcription

Session Transcription allows you to produce a transcript directly from the live session, without the need to record it. Full transcript is available right after the session is finished.

[Read more](/whereby-product-features/transcribing/session-transcription)

### Recording Transcription

Recording Transcription allows you to get a transcript of any recording that was saved in Whereby-provided storage. It is useful if you want to transcribe sessions recorded in the past.

[Read more](/whereby-product-features/transcribing/recording-transcriptions)


# Session Transcription

Session Transcription allows you to produce a transcript directly from the live session, without the need to record it. Full transcript is available right after the session is finished.

## Summary

{% hint style="success" %}
Session Transcriptions is currently in Open Beta.
{% endhint %}

{% hint style="info" %}
Session Transcriptions is a supplementary feature of our paid Whereby Embedded plans. The price will depend on your **Embedded plan** type and the **language** chosen.

**Primary languages\*:**

* **Build (monthly)** plan: $0.0065 per unmuted participant minute.
* **Enterprise (annual)** plan:
  * $0.0055 per unmuted participant minute (for pre-purchased minutes).\*\*
  * $0.0065 per unmuted participant minute (for over usage).

**Secondary languages\***:

* Both plan types: $0.024 per unmuted participant minute.

**\*** Currently, our primary languages include: English, Spanish, Italian, French, Portuguese, and German. All other languages are secondary languages at this time.\
\*\* To pre-purchase minutes, please reach out to your CSM.
{% endhint %}

{% hint style="info" %}
*What is an unmuted participant minute?* This is calculated using the number of participants who are unmuted during a call. For example, a 60 minute meeting containing 2 people who are unmuted for the whole meeting would use 120 unmuted participant minutes. Alternatively, a 60 minute meeting with 3 participants, where only 2 participants were unmuted and the third participant was muted for the whole meeting, would also use 120 unmuted participant minutes. From the moment a participant is unmuted, this usage counts towards the number of unmuted participant minutes, even if they do not actively talk or engage on the call.
{% endhint %}

## How does it work?

Session transcripts are created by live streaming Whereby session audio in real time. After the session is finished, they are saved as text files accessible from the dashboard or via [the API](/reference/whereby-rest-api-reference). You can use the transcripts as a standalone resource (eg. for compliance purposes) or send to an external service for post processing (eg. to derive key topics or create a session summary).

### Storage options

We offer two storage options for the Session Transcription feature.

#### Whereby-provided storage

By choosing Whereby-provided storage for Session Transcriptions, you can can take full advantage of Whereby's Session Transcriptions without the need to configure and maintain your own Amazon S3 bucket for transcription storage.

You can view, delete or download these transcriptions either through the "Transcriptions" page in Whereby customer portal or using our [Transcriptions API](/reference/whereby-rest-api-reference/transcriptions).

#### Your Amazon S3 bucket

You may also choose to store Session Transcriptions in an Amazon S3 bucket owned and managed by you. This is more technical to set up, but may suit your business needs better if you already own and manage Amazon S3 storage. Check out our [Authentication for S3 Storage](/whereby-product-features/secure-authentication-for-s3-storage) section for more details on how to configure your self-hosted session transcriptions.

{% hint style="success" %}
Session Transcriptions is designed to protect ePHI (Electronic protected health information) and supports compliance with the HIPAA Security Rule. To remain HIPAA compliant while using Session Transcriptions, you need to store the transcriptions in an S3 storage managed by your organization.
{% endhint %}

{% hint style="warning" %}
We recommend a strict access policy on your S3 bucket, if you require HIPAA compliance. Key rotation will provide additional security, but also could impact operations, like receiving a permissions error when trying to record/transcribe.
{% endhint %}

## Setup

You can enable and configure Session Transcription globally for your account, or individually for each room. All transcripts can be downloaded manually through the Dashboard, or programmatically with API requests.

### Global configuration

{% hint style="info" %}
When you enable Session Transcription globally through the Dashboard, these settings become the default for all rooms and sessions. Enabling Session Transcription globally will result in all sessions being transcribed, including sessions in rooms created previously. You can override these global settings by specifying the transcription on a [per room](#per-room-configuration) basis
{% endhint %}

If you want to use Session Transcription for all of your sessions, you can enable it globally for your account. Go to “**Configure**” → “**Transcription**” section of your Dashboard and choose either "Whereby-hosted session transcriptions" or "Self-hosted session transcriptions" options. Then, choose the main language of your sessions and the trigger.

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FKR1K7mTcCtijbYB28mD5%2Fimage.png?alt=media&amp;token=5b843430-78da-426e-8045-51386e04d8fd" alt=""><figcaption></figcaption></figure>

To set up your own self-hosted storage option for Session Transcription, you will need AWS S3 credentials. Please refer to the guide provided for self-hosted recordings [here](/whereby-product-features/recording-with-embedded/cloud-recording#setup-and-information-in-s3) for further information on obtaining these credentials from AWS directly.

You can choose between the following transcription triggers:

* **Manual**\
  The host will start and stop the transcription manually.
* **Auto-start (1 person)**\
  Transcription will start when the first person joins and end when the last person leaves.
* **Auto-start (2 people)**\
  Transcription will start when 2 people join a room and end when the last person leaves.

### Per room configuration

If you want to use Session Transcription for some of your sessions, or if you need a different configuration for some of the sessions, you can configure Session Transcription individually for the room. Room parameters will override the global Session Transcription settings.

To do so, create the room with [POST /meetings](/reference/whereby-rest-api-reference/meetings#post-meetings) request and specify the transcription options of your choice:

```json
"liveTranscription": { 
    "language": "en", 
    "startTrigger": "automatic",
    "destination": {
        "provider": "whereby"
    }
},
```

In the `"destination.provider"` option, you can choose between `"whereby"` and `"s3"`. Please refer to the [POST /meetings](/reference/whereby-rest-api-reference/meetings#post-meetings) API reference docs for further `"destination"` configuration options.

For the `"startTrigger"` option, you can choose between `"manual"`, `"automatic"`, or `"automatic-2nd-participant"` triggers.

{% hint style="info" %}
It is not possible to combine multiple transcription triggers. If you choose one of the automatic triggers, the host will not be able to stop the transcription during the session.
{% endhint %}

When the session is transcribed, the participants see a notification circle in the top-left meeting status bar:

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/AiAQ2r6MUGbm7IMYzdY2/image.png" alt=""><figcaption><p>Red circle in the top-left panel indicates session transcription in progress.</p></figcaption></figure>

For the `"language"` option please refer to the [list of supported languages](#supported-languages).

## Additional information

### Supported languages

Session Transcription generates a transcript in the specified language. You need to declare the language used by your session participants in advance - in the [global configuration](#global-configuration) or [per room](#per-room-configuration) with the POST /meetings request. After the room is created, you cannot change the language of the Session Transcription.

<details>

<summary>Session Transcription supported languages</summary>

* Catalan (ca)
* Chinese (Mandarin, Simplified) (zh)
* Chinese (Mandarin, Traditional) (zh-TW)
* Czech (cs)
* Danish (da)
* Dutch (nl)
* English (en)
* Finnish (fi)
* French (fr)
* German (de)
* Greek (el)
* Hindi (hi)
* Indonesian (id)
* Italian (it)
* Japanese (ja)
* Korean (ko)
* Latvian (lv)
* Malay (ms)
* Norwegian (no)
* Polish (pl)
* Portuguese (pt)
* Brazilian Portuguese (pt-BR)
* Romanian (ro)
* Russian (ru)
* Slovak (sk)
* Spanish (es)
* Swedish (sv)
* Thai (th)
* Ukrainian (uk)
* Vietnamese (vi)

</details>

### Download and delete transcripts

{% hint style="warning" %}
This section only applies when you have chosen **Whereby-provided storage** in your transcription setup. There are no webhooks for S3 storage currently.
{% endhint %}

Transcripts are saved in Whereby-provided storage and are available for download soon after the session is finished.

Download the transcript manually from the "**Configure**" **>** "**Transcriptions**" section of your Dashboard.

{% hint style="success" %}
Transcripts are downloaded as .`md` files. If you want to convert to a different file type, like .`pdf`, we recommend using a third-party tool, such as [Documentize](https://products.documentize.app/md-to-pdf).
{% endhint %}

You can automate your transcription process programmatically with a combination of [API requests](/reference/whereby-rest-api-reference) and webhook events:

1. When a transcript is ready, Whereby sends a `transcription.finished` [webhook](/whereby-product-features/insights-suite-and-api/webhooks) event. Hook onto that event to fetch the `transcriptionId` of the session that you want to transcribe.
2. Using the `transcriptionId`, send a [GET request](/reference/whereby-rest-api-reference/meetings) to retrieve the download link of the transcription file. Transcripts are downloaded as `.md` files.
3. All transcripts will be stored in the Whereby-provided storage until you delete them. If you want to minimize the time when your sessions' content is stored in the Whereby-provided storage, you can delete the transcript with a [DELETE request](/reference/whereby-rest-api-reference/meetings#delete-meetings-meetingid).

## Known limitations

1. Session Transcriptions **are not compatible with** [**Breakout Groups**](/whereby-product-features/breakout-groups-with-embedded) **feature**. When using Breakout Groups, the transcript will cover the conversation from the main room, but the audio from individual groups will not be transcribed.
2. Session Transcription is available for sessions up to 12 hours long.
3. Currently, the language spoken cannot be auto-detected. For example, if the meeting is configured for English but French is spoken in the meeting, the language output will likely be incoherent. In this case, you will still be charged per unmuted participant minute for the configured language.


# Recording Transcription

Recording Transcription allows you to get a transcript of any session recording stored in Whereby-provided storage

{% hint style="info" %}
Recording Transcription is a supplementary feature of our paid Whereby Embedded plans. You can review the pricing and options [on our site](https://whereby.com/information/embedded/pricing/).
{% endhint %}

## Summary

Recording Transcription is available by default for all session recordings stored in Whereby-provided storage, and there is no need to enable or configure this feature. Recording transcripts are derived from recordings and saved as text files accessible through the Dashboard or via the API. They can be used as a standalone resource (eg. for compliance purposes) or sent to an external service for post processing (eg. to derive key topics or create a session summary).

## Setup

To produce a transcript from a recording of a Whereby session, you need to follow these steps:

1. Create a Whereby room with cloud recording enabled and configured to use Whereby-provided storage.
2. Record the session.
3. Trigger the transcription for the recording.

## How does it work?

You can use Recording Transcription manually through the Dashboard, or programmatically with the combination of API requests and webhook events.

### Manual Transcriptions

In order to use Recording Transcription, you need to first configure meeting recordings to use cloud recording with Whereby-provided storage. Go to the “**Configure**” → “**Recording**” section of your Dashboard and choose the "Whereby-hosted cloud recording" option with the trigger and recording format of your choice. [Learn more about recording options](/whereby-product-features/recording-with-embedded/cloud-recording).

{% hint style="info" %}
When configuring cloud recording options via the Dashboard, they will be applied as default settings for all rooms and meetings. However, you can override the defaults by specifying different preferences in the POST requests used to create meetings.
{% endhint %}

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FYLGXLfIHlR2sckjWvjzT%2Fimage.png?alt=media&amp;token=49ee3b13-0a61-4618-953d-aca6fdae4627" alt=""><figcaption></figcaption></figure>

When the sessions get recorded, you can access all recordings saved in the Whereby-provided storage from the “**Recordings**” page of your Dashboard. Find the session that you want to transcribe and choose the "**Start transcription**" option from the Actions column.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/batSjYPcdtLhPEbbVTuM/Screenshot%202023-09-28%20at%2014.00.31.png" alt=""><figcaption><p>Start the transcription for selected recording of a Whereby session</p></figcaption></figure>

The transcription process may take some time, especially for recordings longer than 30 minutes. Once the transcript is ready, you can download it. The transcript is downloaded as an .md file.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/xLSfSk4UpHPqf0MzPJpp/Screenshot%202023-09-28%20at%2014.06.48.png" alt=""><figcaption><p>Download the transcript from the session recording</p></figcaption></figure>

You can also download or delete transcriptions that have been already created from the “**Recordings**” page of your Dashboard.

### Programmatic Recording Transcriptions

If you want to automate the process of transcribing recorded Whereby sessions, you can do so with a combination of API requests and webhook events.

#### Configure session recording

First, make sure that meetings are configured to use cloud recording with Whereby-provided storage:

* If you want to use cloud recording with Whereby-provided storage **globally for all rooms**, go to the “**Configure**” → “**Recording**” section of your Dashboard and choose the "Whereby-hosted cloud recording" option with the trigger and recording format of your choice.
* If you prefer to set the **recording type for each room or meeting individually**, create the meeting with a [POST /meetings](/reference/whereby-rest-api-reference/meetings#post-meetings) request using the following parameters for recording (with the `"startTrigger"` and `"fileFormat"` of your choice):

```json
"recording": {
    "type": "cloud",
    "destination": {
      "provider": "whereby",
      "fileFormat": "mp4"
    },
    "startTrigger": "none"
   },       
```

#### Record and transcribe the session

Depending on the type of recording trigger specified for the meeting, it will be recorded automatically, or the host will need to start the recording manually.

When the recording is completed, Whereby sends a `recording.finished` [webhook](/whereby-product-features/insights-suite-and-api/webhooks) event. Hook onto that event to fetch the `recordingId` of the session that you want to transcribe.

Then, send a [POST /transcriptions](/reference/whereby-rest-api-reference/transcriptions#post-transcriptions-bulk-delete) request with the `recordingId` to start the transcription job.

The transcription process may take some time, especially for recordings longer than 30 minutes. Once the transcript is ready, Whereby sends a `transcription.finished` [webhook](/whereby-product-features/insights-suite-and-api/webhooks) event. Hook onto that event to fetch the `transcriptionId` of the session that you want to transcribe.

Send a [GET /transcriptions/{transcriptionId}/access-link](/reference/whereby-rest-api-reference/transcriptions#get-transcriptions-transcriptionid-access-link) request to get the download link of the transcription file. Transcripts are downloaded as .md files.

#### Delete the recording and transcription files

Both the recording and the transcript of the session will be stored in the Whereby-provided storage until you delete them. If you want to optimize the cost or minimize the time when your sessions' content is stored in the Whereby-provided storage, you can delete the assets with 2 API requests:

* [DELETE /recordings/{recordingId}](/reference/whereby-rest-api-reference/recordings#delete-recordings-recordingid)
* [DELETE /transcriptions/{transcriptionId}](/reference/whereby-rest-api-reference/transcriptions#delete-transcriptions-transcriptionid)

## Supported Languages

Recording Transcriptions feature automatically identifies the dominant language spoken in the session and creates a transcript in this language. The following languages are supported: Chinese, Dutch, English, French, German, Hindi, Indonesian, Italian, Japanese, Korean, Portuguese, Russian, Spanish, Swedish, Turkish, Ukrainian.

## Known limitations

1. Recording Transcriptions are only available for session recordings stored in Whereby-provided storage. If you store session recordings in your own Amazon S3 bucket, it will be not possible to trigger transcriptions for these recordings.
2. Since recording transcripts are derived from recordings saved in Whereby-provided storage, this feature is not considered to be HIPAA compliant. Avoid using recording transcription in order to maintain HIPAA compliance of your Whereby sessions. [Learn more about Whereby HIPAA compliant setup](/telehealth-industry-solutions/hipaa-compliant-setup).
3. Recording Transcriptions sometimes fail for recordings of sessions longer than 45 minutes, so it is recommended to use this feature for shorter sessions. We will not charge you for failed transcriptions.


# User roles & meeting permissions

Whereby allows your participants to join a video meeting without creating accounts or logins. If you want some users to have altered privileges in the meeting, you can use different URL types

### Hosts

{% embed url="<https://www.youtube.com/watch?v=RicAdlE93cc>" %}

Users joining via the hostRoomURL become meeting hosts and have the following features available:

* Lock and unlock the room.
* Enter locked rooms without knocking.
* Respond and allow access to participants that are knocking.
* Remove, mute, and spotlight meeting participants.
* Remove chat messages and files shared by any participant.
* Start and stop [recordings](/whereby-product-features/recording-with-embedded), if available.
* Start and stop [breakout groups](/whereby-product-features/breakout-groups-with-embedded), if available.

{% hint style="info" %}
Host privileges are valid immediately on room creation and are disabled one hour after the `endDate`.
{% endhint %}

A hostRoomURL is only available if the `hostRoomURL` is included in the `fields` parameter when [creating a meeting via the API](/whereby-product-features/using-the-rest-api#creating-rooms).

**Example request body:**

```json
{
    "endDate": "2099-03-25T13:30:00.000Z",
    "fields": ["hostRoomUrl"]
}
```

**Response:**

```json
{
    "meetingId": "1234",
    "startDate": "2022-03-09T13:50:00.000Z",
    "endDate": "2099-03-25T13:30:00.000Z",
    "roomUrl": "https://example.whereby.com/room",
    "hostRoomUrl": "https://example.whereby.com/room?roomKey=eFhcG...i00ZG"
}
```

Now that you have both a `roomUrl` and a `hostRoomUrl`, you can ensure that both your guests and hosts get the right privileges by using the corresponding URL when [embedding rooms](/getting-started/overview-of-whereby-embedded) in your own webpage or app.

### Participants

Users joining via the standard `roomUrl` will have a more typical meeting experience. They will only have access to the features you've set via [URL parameters](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes) or the [dashboard](/whereby-product-features/dashboard-preferences), and they will need to knock to gain entry to locked rooms.

A `roomUrl` will be included with any POST [meeting creation](/whereby-product-features/using-the-rest-api#creating-rooms) requests.

**Example request body:**

```javascript
{ 
    "endDate": "2099-03-25T13:30:00.000Z", 
}
```

#### Response:

```javascript
{
    "meetingId": "1234",
    "startDate": "2022-03-09T13:50:00.000Z",
    "endDate": "2099-03-25T13:30:00.000Z",
    "roomUrl": "https://example.whereby.com/room",
}
```

### Viewers

In Viewer Mode, participants joining as Viewers have their camera and microphone access disabled. Viewers can gain access to locked rooms without knocking and can only interact with Hosts and Participants by using the Chat, if you've enabled that in the room.

This is a 1.0 feature and might change in the future.

{% hint style="success" %}
Meetings created in "[group](/whereby-product-features/using-the-rest-api#creating-rooms)" mode can support up to 200 hosts or participants. Viewer mode can support an additional 400 viewers for a total of 600 viewers, hosts, and participants.
{% endhint %}

{% hint style="warning" %}
Using Viewer Mode for meetings created in "normal" mode (2-4 people) may present technical issues. Viewer Mode is intended to be used in "group" meetings instead.
{% endhint %}

**Example request body:**

```json
{
    "endDate": "2099-03-25T13:30:00.000Z",
    "templateType": "viewerMode"
}
```

**Response:**

```json
{
    "meetingId": "1234",
    "startDate": "2022-03-09T13:50:00.000Z",
    "endDate": "2099-03-25T13:30:00.000Z",
    "roomUrl": "https://example.whereby.com/room",
    "hostRoomUrl": "https://example.whereby.com/room?roomKey=eFhcG...i00ZG"
    "viewerRoomUrl": "https://example.whereby.com/room?roomKey=eFhcG...VTQIE"
}
```

Explore more in the [API reference](/reference/whereby-rest-api-reference).


# Waiting Rooms

Waiting rooms are a great way for your hosts to manage meeting access with ease.

Participants "knock" at the virtual door and hosts can allow entry, decline, or even send messages to communicate a delay.

## Setup

You can create a waiting room experience for your participants by making sure the room is created as locked during the API request. You do this by setting the `isLocked` property to **true**:

{% hint style="warning" %}
Make sure to include a hostRoomUrl in the request. Users provided with a hostRoomUrl will have the ability to join a locked room, as well as accept and reject participants knocking at the room.
{% endhint %}

<pre class="language-json" data-overflow="wrap"><code class="lang-json"><strong>// Example Request
</strong><strong>{
</strong>  "isLocked": true,
  "roomNamePrefix": "waiting-room-example-",
  "roomNamePattern": "uuid",
  "roomMode": "group",
  "endDate": "2024-07-05T18:10:34.695Z",
  "fields": [
    "hostRoomUrl"
  ]
}
</code></pre>

{% code overflow="wrap" %}

```json
// Example Response
{
  "startDate": "2024-06-21T18:10:35.056Z",
  "endDate": "2024-07-05T18:10:34.695Z",
  "roomName": "/waiting-room-example-546f6c91-74b2-4597-b32a-6aeefa9ed90f",
  "roomUrl": "https://subdomain.whereby.com/waiting-room-example-546f6c91-74b2-4597-b32a-6aeefa9ed90f",
  "meetingId": "87673375",
  "hostRoomUrl": "https://subdomain.whereby.com/waiting-room-example-546f6c91-74b2-4597-b32a-6aeefa9ed90f?roomKey=eyJhbGciOiJIU..."
}
```

{% endcode %}

### Managing the waiting room experience

After you've created a locked room, there are a variety of ways you can customize the experience:

1. Choose the device review options that hosts and participants experience during the pre-call phase. We offer standard device reviews or full device and connectivity tests. These options can be managed globally via [the dashboard](https://docs.whereby.com/whereby-101/customizing-rooms/dashboard-preferences#pre-call-review) or various [URL parameters](https://docs.whereby.com/whereby-101/customizing-rooms/using-url-parameters#precallceremonycanskip-on)\
   \
   ![](https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/77Yf3iqp6DqInQz6KGFu/precall-screenshot.png)<img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/Q5Y7oixRjGybKVvi2dxm/precall-screenshot2.png" alt="" data-size="original">
2. Add a unique background image for the waiting room precall flow with our [API endpoint](/reference/whereby-rest-api-reference/rooms#put-rooms-roomname-theme-room-knock-page-background)

## Additional Information

### End User Experience

When a participant knocks at a locked room, hosts receive a notification in the room. They can they choose to "Put on hold" and include a message, "Let in", or "Reject":

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/AgFhsJD4qUOziqAhorUS/host-knock.png" alt="" width="375"><figcaption><p>Host controls seen in the "People" tab</p></figcaption></figure>

Users are then notified from the host, or let into the room accordingly:

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/GAf4BqmuuuC3oLsfYGTy/participant-knock.png" alt="" width="375"><figcaption></figcaption></figure>

## Known Limitations

* Due to privacy and security considerations, we have removed the ability for hosts to see the video feed of the guest who knocked in the Waiting Room.


# Global room customizations

Some preferences can be enabled or disabled globally in the customer portal and therefore apply to all rooms and sessions.

The feature preferences can be found under "**Configure**” **→** “**Features**”. Any adjustments made here will be applied to all of your rooms, unless overridden by specific [URL parameters](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes) added to the meeting URL, or as query parameters in the API request when creating the meeting.

## Pre-call features

![Overview of what is available in the Pre-call features section](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fb9OFowsmGPxw4EiNXbrB%2Fprecallfeatures.png?alt=media\&token=56195337-872b-4dd7-9c54-e1bcd6846482)

#### Display login/signup buttons

We provide a way for your users to log into their Whereby account (if they have one) or sign up for a Whereby account. Disabling these buttons is helpful in the case where you are embedding Whereby onto your own platform and want your own sign up and login options.

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FmDEJAjesDO7Rbz1HrFbP%2Fwithoutloginsignup.png?alt=media&amp;token=97a0ea37-06bd-4d02-9728-438bcd02a86a" alt=""><figcaption><p>When this setting is disabled, no login or signup buttons appear</p></figcaption></figure>

#### Ask guests for name

You can prompt guests to enter their name before joining a room. When the guest knocks on a locked room, the host will be able to see their name. The name will also be visible to all other participants upon entering. Disabling this feature will bypass the step to enter a name when opening a meeting link and will instead display in the room as **Guest**. This is helpful if you wish for all guests to be anonymized, or if you want to manually set the participant's name with the URL parameter `displayName=<name>`

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fku0HVAbOjOZnHEyLiUkQ%2Fwithloginsignup.png?alt=media&amp;token=520de076-a237-4567-86ed-2b7e86e30abd" alt=""><figcaption><p>What it looks like when you enable this setting</p></figcaption></figure>

#### Pre-call review

We provide waiting room options for your users to verify their device permissions and even test their internet connection in preparation for a call. By enabling pre-call review, you can specify if you'd like a simpler, single-page standard review.

Or, a dedicated test for each device including camera, microphone, and speakers, as well as a connectivity test. This can also be enabled for specific rooms with the [?precallCeremony parameter](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes#precallceremony-less-than-on-or-off-greater-than).

{% hint style="info" %}
The device and connectivity tests are a subset of the pre-call review feature. Pre-call review must be enabled in order for the `?precallCeremony` parameter or dashboard toggle to work.
{% endhint %}

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/jO6dcbg8IhEIfWfRroDp/precall-test.png" alt="" width="375"><figcaption></figcaption></figure>

#### Help me fix this

You can add a custom link that appears when users accidentally block their permissions. This can be managed for all meetings via the dashboard, or set for individual meetings via our [URL parameter](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes#precallpermissionhelplink-less-than-url-greater-than). If you need help building some support documentation we have some [End User Troubleshooting](/end-user/end-user-support-guides/end-user-documentation) information that may prove helpful!

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/1lffUXGdrF7zFvDeprbl/helpmefixthis.png" alt="" width="563"><figcaption></figcaption></figure>

## Room Features

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FwyvdwZIx3yMwKTH8IK8T%2FRoomfeatures.png?alt=media&amp;token=53ec69b0-1f23-4642-8370-25205c563707" alt=""><figcaption></figcaption></figure>

#### Invite panel

We provide an invitation panel that allows a user to copy and share the room link easily. This is visible when only one person is in the room. Having this enabled could be particularly helpful for ad hoc meetings, or inviting someone last minute. If meeting access needs to be limited or private, you may consider disabling this feature.

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fr9foY5JBFYH7Tdukpnx0%2Finvitepanel.png?alt=media&amp;token=6b42a948-96ce-4423-a21c-f9ed13ce31d7" alt="" width="563"><figcaption></figcaption></figure>

#### Screenshare

[Screen sharing](/whereby-product-features/screen-sharing) is a great way to share content to other hosts/participants in the room. Depending on the browser being used, there will be different options for what can be shared. You can enable (or disable) this globally across all rooms, or you can disable it on a per room link basis, like if you don't want participants to be able to screen share. This can be accomplished with the URL parameter `screenshare=off`

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FyagJsk87LcihTu40NJJB%2Fimage.png?alt=media&amp;token=70f0fe6f-917a-46d5-ae83-8ad570ee6597" alt="" width="295"><figcaption></figcaption></figure>

Within this configuration, you also have the option to show or hide the "Can you see my screen?" notification that appears to all other participants. You may decide you don't need this prompt if your use case requires high-frequency screen shares.&#x20;

#### Highlight speaker

This feature detects and visually emphasizes the person currently speaking during video calls. This is disabled by default but can be enabled globally. This is great for larger group-sessions, where identifying who’s talking might be difficult. Alternatively, the URL parameter `highlightActiveSpeaker=<on|off>` toggles the feature at a room level.

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FSFHZ0ABRjbQ2MW4tsMYO%2Fhighlightspeaker.png?alt=media&amp;token=830fbbf0-173c-48d8-961c-d1410127885c" alt=""><figcaption></figcaption></figure>

#### Chat

We allow users to send and receive messages within the meeting room. If this is disabled, then no written communication is available to meeting participants. This could be helpful in classroom settings or in a large webinar event.

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FYASrm2Q5bUJc32AWTRpS%2FChattoolbar.png?alt=media&amp;token=c8281a8f-c182-4e7b-8588-51a616c9d3dd" alt=""><figcaption></figcaption></figure>

Within the chat feature, we provide a way for [**file sharing**](/whereby-product-features/file-sharing), which allows all participants in a video session to attach media files (images, documents, audio, and video). You can override global configuration for individual rooms via the API during a [room creation](https://docs.whereby.com/reference/whereby-rest-api-reference#create-meeting) request or with an [attribute or parameter](/reference/using-the-whereby-embed-element) of `fileSharing=<on|off>`.

{% hint style="info" %}
Chat must be enabled for file sharing to work. You can enable chat for all rooms on the dashboard or per room.
{% endhint %}

We also provide a way for the **chat to be downloadable**. Chat downloads allow users to save chat conversations, both during and after a session. You can choose to make this available to everyone, or only for the hosts. This is useful to have enabled for many use cases, like healthcare providers sharing treatment plans with patients. This is disabled by default but can be enabled globally. The URL parameter `chatDownload=<on|off>` toggles the feature at a room level.

{% hint style="danger" %}
To be HIPAA compliant, '**Make chat downloadable**' should be toggled **off**, and you should not use the URL parameters to turn on chat export.
{% endhint %}

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FjPRAk0RA8Qmukv7HyoLx%2Fdownload_chat_2x.webp?alt=media&amp;token=70fdb67f-1617-4588-9ebe-fc9d7c7adf00" alt="" width="563"><figcaption></figcaption></figure>

#### Reactions

We provide a way for guests to express their reactions to in-meeting happenings through the use of emojis. We also have a hand raise feature included to manage interruptions. In the global configuration, we allow for you to customize if you want the reactions feature to be condensed into one button with the Chat button, or to have it show as a separate button.<br>

When you include reactions with chat, they can be accessed by hovering over the Chat button. Some users want reactions separate so they can hide the Chat button — they don't want a chat function in their meetings, but they do want participants to feel engaged. We also provide an option to show a separate button for reactions.

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FfGMwLsV36bUkrxVT1Xw5%2Freactionsfeature.png?alt=media&amp;token=5b564732-130a-41c8-9960-67cf0e424889" alt="" width="563"><figcaption><p>When you hover over the Chat button, reactions are displayed</p></figcaption></figure>


# Privacy Configurations

Depending on your use case, you may want to enable some privacy configurations for your Whereby account.

## Privacy features

**Privacy features** can be found in your dashboard, then navigating to "**Configure**"> "**Features**". At the bottom of this section, you will see the following:

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fs8I83ltrQfuDEC1av3u6%2FPrivacyfeatures.png?alt=media&amp;token=71842ee9-5ffd-477e-9432-2ea70ee25055" alt=""><figcaption></figcaption></figure>

#### Remove display names

For maximum privacy, we allow users to remove display names in every area of the product. This includes the Insights Dashboard, in API responses, and webhooks. When enabled, the display name appears as `[[redacted]]`. This is perfect for those using Whereby in a telehealth capacity.

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FAoU5rT21SUrLy2SQk8Sa%2FPrivacyInsights.png?alt=media&amp;token=8ef6526e-ee48-42f1-8a31-7d37c7149d8c" alt=""><figcaption></figcaption></figure>

#### Whereby Privacy Policy

You can choose to remove the mention of Whereby's privacy policy during the pre-call portion. By checking the box, you confirm that you have provided our policy by other means. You'll find our policy here:

{% embed url="<https://whereby.com/information/tos/privacy-policy>" %}


# Building secure telehealth applications: implementation guide

This guide walks you through implementing essential features for your telehealth platform using Whereby's video API and SDK.

Whether you're building a new telehealth application or enhancing an existing platform, this guide covers the critical components needed to deliver secure, accessible, and user-friendly video consultations.

{% hint style="success" %}
**Did you know?** Healthcare organizations lose an estimated 40% of potential patients due to technical barriers during video consultations. Poor video quality, accessibility issues, and complex user flows directly impact patient satisfaction scores, provider efficiency, and ultimately, clinical outcomes.
{% endhint %}

The guide focuses on the four most important components identified across successful telehealth implementations: reliable video infrastructure, accessibility compliance, user experience optimization, and integration capabilities that support clinical workflows.

### Prerequisites

Before implementing the features covered in this guide, ensure you have:

* A Whereby Embedded account with API access
* Basic knowledge of JavaScript/React development
* Understanding of HIPAA compliance requirements for healthcare applications
* Familiarity with web accessibility standards (WCAG 2.1 Level AA)
* Development environment set up with Node.js and npm/yarn

**Required Setup:**

* Node.js 14+ installed
* A text editor or IDE
* Web browser for testing
* HTTPS-enabled development environment (required for video features)

### Getting Started

This guide assumes that you’ve already created a Whereby embedded account and a meeting room to join with your web app. If you’ve not already taken these steps, you can do so by following the [Whereby Embedded initial setup guide](/getting-started/overview-of-whereby-embedded/initial-setup).

### Implementing Core Telehealth Features

#### Accessibility-First Design Implementation

Improving accessibility in telehealth design enhances usability for all users. Telehealth platforms must be inclusive of patients with disabilities, and Whereby is WCAG 2.1 Level AA compliant. This section highlights the implementation of WCAG 2.1 Level AA compliance features to boost universal usability.

**Core Accessibility Features:**

1. **Enable** [**live captions**](/whereby-product-features/live-captions) **and** [**transcriptions**](/whereby-product-features/transcribing):\
   \
   If you want to use Live Captions or Transcriptions for *all* of your meetings, you can enable it globally for your account. Go to “Configure” → “Transcription” section of your Dashboard and enable accordingly.\
   \
   You can enable these on a per-room basis by making a [POST /meetings](/reference/whereby-rest-api-reference/meetings#post-meetings) request. Here is an example for enabling Live Captions:<br>

   ```
   "liveTranscription": {
       "startTrigger": "none",
       "liveCaptions": true
   }
   ```
2. **Implement keyboard navigation**:\
   \
   Keyboard shortcuts can be enabled (or disabled) within the settings of a Whereby room. Enter the room, click the Settings cogwheel icon, navigate to the Advanced settings tab, and toggle on. Users can also disable our single-key shortcuts if they prefer, as these might interfere with other shortcuts users have set.\
   \
   You can find our list of keyboard shortcuts in our [Accessibility guide](/further-resources/faq-and-troubleshooting/accessibility).
3. **Configure highlight speaker features**:\
   \
   The highlight active speaker feature is especially helpful for users who rely on visual cues. It visually identifies who’s speaking, making it easier to follow conversations.

```javascript
<whereby-embed
  room="YOUR-ROOM-URL"
  highlightActiveSpeaker="on"
</whereby-embed>
```

{% hint style="warning" %}
**Implementation Note:** Accessibility features should be enabled by default rather than opt-in to ensure inclusive healthcare delivery.
{% endhint %}

#### Advanced UI/UX Customization for Clinical Workflows

By default, Whereby is built with patient engagement in mind because we want our partners to experience ease when it comes to managing their clients’ virtual care.

{% hint style="success" %}
**Did you know?** The design of your telehealth interface directly impacts clinical effectiveness and patient trust. Studies show that patients form trust judgments about healthcare providers within the first 30 seconds of a video consultation, with interface design playing a crucial role.
{% endhint %}

Effective telehealth interfaces require careful attention to visual hierarchy and user experience that supports clinical decision-making rather than hindering it.

**Customizing Video Layouts:**

1. **Implement minimalist clinical interface**:

```javascript
<whereby-embed
  room="YOUR-ROOM-URL"
  minimal="on"
  chat="on"
  leaveButton="on"
  screenshare="on"
  people="off"
  pipButton="off"
  settingsButton="off">
</whereby-embed>
```

2. **Configure video fatigue reduction**:

```javascript
<whereby-embed
  room="YOUR-ROOM-URL"
  autoHideSelfView="on"
  cameraEffect="blur">
</whereby-embed>
```

#### Waiting Room and Patient Flow Management

With Whereby's virtual Waiting Room feature, you can mirror the experience of traditional medical office waiting rooms.

**Setting Up Virtual Waiting Rooms:**

1. **Configure waiting room**:\
   You can create a waiting room experience for your participants by making sure the room is created as **locked** during the API request. You do this by setting the `isLocked` property to **true**:

```javascript
// Example Request
{
  "isLocked": true,
  "roomNamePrefix": "waiting-room-example-",
  "roomNamePattern": "uuid",
  "roomMode": "group",
  "endDate": "2024-07-05T18:10:34.695Z",
  "fields": [
    "hostRoomUrl"
  ]
}
```

```
// Example Response
{
  "startDate": "2024-06-21T18:10:35.056Z",
  "endDate": "2024-07-05T18:10:34.695Z",
  "roomName": "/waiting-room-example-546f6c91-74b2-4597-b32a-6aeefa9ed90f",
  "roomUrl": "https://subdomain.whereby.com/waiting-room-example-546f6c91-74b2-4597-b32a-6aeefa9ed90f",
  "meetingId": "87673375",
  "hostRoomUrl": "https://subdomain.whereby.com/waiting-room-example-546f6c91-74b2-4597-b32a-6aeefa9ed90f?roomKey=eyJhbGciOiJIU..."
}
```

{% hint style="warning" %}
Make sure to include a hostRoomUrl in the request. Users provided with a hostRoomUrl will have the ability to join a locked room, as well as accept and reject participants knocking at the room.
{% endhint %}

2. **Set the Waiting Room background**:\
   Make an API request to: [https://api.whereby.dev/v1/rooms/{roomName}/theme/room-knock-page-background](https://api.whereby.dev/v1/rooms/%7BroomName%7D/theme/room-knock-page-background)

```javascript
const response = await fetch('https://api.whereby.dev/v1/rooms/{roomName}/theme/room-knock-page-background', {
    method: 'PUT',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "palette": "default",
      "theme": "default"
    })
});

const data = await response.json();
```

3. **Add meeting timers for clinical efficiency**:

```javascript
<whereby-embed
  room="YOUR-ROOM-URL"
  timer="on"
</whereby-embed>
```

4. **Utilize our webhooks to create a queuing system.**\
   See more here: [Tracking room events with Webhooks](/whereby-product-features/insights-suite-and-api/webhooks)

### Recording and Transcription

Clinical documentation is a critical but time-consuming aspect of healthcare delivery. Manual transcription of telehealth consultations is not only labor-intensive but also prone to errors that can impact patient care continuity and regulatory compliance. Healthcare organizations implementing automated clinical documentation see an improvement in provider satisfaction and significant reduction in after-hours administrative work.<br>

1. **Set up Cloud Recording**:\
   To ensure that recording is enabled, refer to the [Whereby REST API documentation](https://docs.whereby.com/reference/whereby-rest-api-reference) to specify your desired `recording.type` equal to `cloud`. If you choose `cloud` recording type, we recommend that you setup your Amazon S3 account and configure the `provider` equal to `s3` as the recordings destination for the meeting room.
2. **Set up Session Transcriptions:**\
   Create the room with [POST /meetings](https://docs.whereby.com/reference/whereby-rest-api-reference/meetings) request and specify the transcription options of your choice. In the `"destination.provider"` option, we recommend that you choose `"s3"`. Please refer to the [POST /meetings](https://docs.whereby.com/reference/whereby-rest-api-reference/meetings) API reference docs for further `"destination"` configuration options.
3. **Handle recording consent and privacy**:\
   We recommend that the person who is starting the recording (i.e the host) to get consent from all participants before starting a recording. This can be a simple verbal consent upon the meeting starting.

### Security and Compliance Implementation

#### HIPAA Compliance Configuration

Ensure your telehealth platform meets healthcare privacy and security requirements while maintaining optimal user experience. HIPAA compliance isn't optional; it's a fundamental requirement that affects every aspect of your telehealth platform's design and operation. Security features also become competitive advantages when marketing to enterprise healthcare clients.

1. **Configure secure rooms:**
   1. In the API request set `isLocked: true`
   2. Set the [room name](https://docs.whereby.com/whereby-101/faq-and-troubleshooting/hipaa-compliant-setup#room-names) pattern in the API request `roomNamePattern = uuid`
   3. Disable [RTMP live streaming](https://docs.whereby.com/whereby-101/faq-and-troubleshooting/hipaa-compliant-setup#features-you-cannot-use-with-a-hipaa-compliant-setup) and room integrations by including the following in your POST creation requests:

      ```
          "roomPreferences": {
            "streaming": false,
            "roomIntegrations": false
        }
      ```
2. **Encryption**:\
   There is no action required to enable encryption in transit as it is already enabled and available for all customers, regardless of whether they are using the Whereby Embedded HIPAA compliant package or not.
3. **Audit information**:\
   Whereby Embedded customers may require to audit their suppliers based on their internal policies but also to showcase that they have ensured they are using HIPAA compliant products and services.<br>

   To support the HIPAA compliance of our customers, we will gladly provide our ISO27001 certificate and our HIPAA compliance checklist, which documents how Whereby complies with specific HIPAA rules . For further information, [reach out to your Whereby contact](https://whereby.com/information/contact-sales/).
4. **More HIPAA-compliancy:**\
   We have a more in-depth guide on having a HIPAA compliant setup in the next guide, [HIPAA compliant setup](/telehealth-industry-solutions/hipaa-compliant-setup).

### Performance Optimization for Healthcare

Healthcare delivery requires consistent performance across diverse network conditions and geographic locations, ensuring that critical medical consultations aren't compromised by technical limitations. We have several features to ensure quality connections.

1. **Optimize for low-bandwidth scenarios**:\
   Whereby has an **audio-only mode** so users can join sessions with their videos turned off to help minimize bandwidth usage during poor network conditions. This way, the appointment can still be facilitated.
2. **Implement connection monitoring**:\
   Turning on the pre-call ceremony will conduct a live device and network connectivity test for the participant before they join the call.\
   \
   For example, the following component would ensure users see the pre-call review step and see the pre-call device and connectivity test:<br>

   ```
   <whereby-embed 
       room="https://subdomain.whereby.com/your_room?roomKey=3fe345a"
       precallReview=on
       precallCeremony=on
   />
   ```

   \
   To better understand issues *during* ongoing calls, we also have an in-call diagnostics feature. With this, you get a panel that provides a detailed overview of every participant’s meeting quality during sessions.\
   \
   To use this feature, you can use the following component:\
   `callQualityMonitoring=on`
3. **Global mesh network utilization**:\
   Whereby has a global mesh network that connects users to their closest servers to ensure reliable connections, even in low-bandwidth scenarios. This is done by setting `"roomMode": "group"` instead of `"normal"` on room creation.

### See Also

* [Whereby Embedded API Reference](/reference/whereby-rest-api-reference) - Complete API documentation
* [React Hooks SDK Guide](/reference/react-hooks-reference) - Advanced React implementations
* [HIPAA Compliance Documentation](/telehealth-industry-solutions/hipaa-compliant-setup) - Healthcare-specific compliance features
* [Accessibility Features Reference](/further-resources/faq-and-troubleshooting/accessibility) - Complete accessibility implementation guide
* [Session Transcriptions](/whereby-product-features/transcribing/session-transcription) - Guide to our Session Transcriptions feature
* [Telehealth Tutorial App](https://github.com/whereby/sdk/tree/main/apps/telehealth-tutorial-app) - Example app that demonstrates how to use the Whereby browser SDK to create a telehealth application


# HIPAA compliant setup

A HIPAA compliant setup comes at no additional cost for customers on an annual plan. This page describes how to set up HIPAA compliant video calls.

{% hint style="success" %}
Our HIPAA compliant setup information was updated in May 2023 to include rooms of all sizes (*including our "group" roomMode*), as well as [cloud recording](#hipaa-compliant-recording).
{% endhint %}

{% hint style="warning" %}
Any feature that uses **Whereby-provided storage** is not considered to be HIPAA-compliant. For example, to be HIPAA-compliant with Cloud Recordings, you must store them using an S3 storage bucket.
{% endhint %}

## Pricing and packaging

Whereby’s HIPAA-compliant on-demand capability is included at no additional cost for customers on our Enterprise plan. Build Plan customers can access this feature through a paid add-on. For any questions about pricing options or enabling the HIPAA add-on, reach out to your Whereby contact or [contact sales](https://whereby.com/information/contact-sales).

## HIPAA compliance prerequisites

The following information describes what it means to use the HIPAA compliant video conferencing capabilities of Whereby. Follow the steps below to get started:

1. Review all the information on this page to gain an understanding of our HIPAA capabilities and how can they be used.
2. Sign our [Business Associate Agreement](#business-associate-agreement) by [reaching out to your Whereby contact](https://whereby.com/information/contact-sales/).
3. Follow the instructions to [create HIPAA compliant rooms](#creating-hipaa-compliant-rooms).

![](https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/EK0wdVJBdGPOaxr5WTVY/hipaa-compliant.jpg)

#### Business Associate Agreement

Whereby has prepared and will sign a standard Business Associate Agreement that is adequate for all of our HIPAA-compliant customers. Should there be a need to sign a different BAA than what we offer, we are also open to having our legal counsel review it internally and proceed with it provided there are no issues.

To ensure a Business Associate Agreement is signed, [reach out to your Whereby contact](https://whereby.com/information/contact-sales/) and they will provide the ready to be signed agreement.

## Creating HIPAA compliant rooms

Follow the steps below to verify you've created rooms that are HIPAA compliant. Additional information for some points is linked for further clarification.

1. In the API request set `isLocked: true`
2. Set the [room name](#room-names) pattern in the API request `roomNamePattern = uuid`
3. Disable [RTMP live streaming](#features-you-cannot-use-with-a-hipaa-compliant-setup) and room integrations by including the following in your POST creation requests:

   ```
       "roomPreferences": {
         "streaming": false,
         "roomIntegrations": false
     }
   ```
4. Consult our team for any additional security preferences or parameters

{% hint style="success" %}
**Note:** As of May 2023, all room sizes on Whereby are HIPAA compliant. You no longer need to specify "normal" mode to remain compliant.
{% endhint %}

### HIPAA Compliant Recording

The recording capability means that the meeting, including audio, video and screen-share content will be captured and saved depending on the options chosen.

{% hint style="success" %}
**Update:** Whereby is proud to now offer HIPAA compliant [cloud recording](/whereby-product-features/recording-with-embedded/cloud-recording), in addition to our previously available HIPAA compliant [local recording](/whereby-product-features/recording-with-embedded/local-recording). To remain HIPAA compliant while using cloud recording, you need to store the recordings in an S3 storage managed by your organization.
{% endhint %}

The reason our recording options are considered compliant is that Whereby does not, in any way store the recordings.

To ensure that recording is enabled, refer to the [Whereby REST API documentation](/reference/whereby-rest-api-reference) to specify your desired `recording.type` equal to `local` or `cloud`. If you choose `cloud` recording type, make sure to setup your Amazon S3 account and configure the `provider` equal to `s3` as the recordings destination for the meeting room.

<details>

<summary>Cloud Recording</summary>

Cloud recording is considered HIPAA compliant as long as the recording files are saved to a customer owned and controlled S3 storage buckets.

Please note that key rotation will provide additional security, but also could impact operations, like receiving a permissions error when trying to record/transcribe.\
\
Instead, we request that you create a bucket with a specific and strict [bucket policy](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-policies.html) to ensure compliance:

```
{
	"Version": "2012-10-17",
	"Statement": [
		{
			"Sid": "AllowListAndPutRecordings",
			"Effect": "Allow",
			"Principal": {
				"AWS": "arn:aws:iam::<aws_account_id>:user/<aws_user>"
			},
			"Action": [
				"s3:ListBucket",
				"s3:PutObject"
			],
			"Resource": [
				"arn:aws:s3:::<recording_bucket>",
				"arn:aws:s3:::<recording_bucket>/*"
			]
		}
	]
}
```

</details>

<details>

<summary>Local Recording</summary>

It is the responsibility of the person that initiated the recording and saved it locally to adhere to HIPAA requirements. Be sure to assess internally if this is something that can be accept per your HIPAA compliant policies.

Whereby cannot control what happens to a local recording.

[Local recording setup and instruction](/whereby-product-features/recording-with-embedded/local-recording#enabling-local-recording)

</details>

The use of recording is not required and if preferred can be disabled entirely. Please refer to the [Whereby REST API documentation](/reference/whereby-rest-api-reference) and use `recording.type = none`

### Room names

For our HIPAA compliant customers, we recommend the use of random names to avoid accidental usage of [PHI ](https://www.hhs.gov/hipaa/for-professionals/privacy/laws-regulations/index.html)(protected health information) or PII (personal identifiable information). This also ensures there is no pattern in place that can be used to identify the purpose of a meeting.

To do this, refer to the [Whereby REST API documentation](/reference/whereby-rest-api-reference) and use `roomNamePattern = uuid`

### Display name

The client device communicates the display name when it joins the room and then there is a custom `send_client_metadata` event which is broadcast to all the participants in the room by the Signal server.

To ensure HIPAA compliance, the display name can simply be used as is.

For an added measure of pseudo-anonymization or as a way of more easily integrating Whereby Embedded with your own app, the display name for a participant can be preset. This can be useful in several scenarios:

* **Scenario 1:** if you want to use various identifiers for a user rather than the actual name, e.g. instead of `Jane Doe`, it will be `participant 1` , thus adding a pseudo-anonymization measure to fit in with your current setup.
* **Scenario 2:** if you want a seamless integration with your user handling flow, where e.g. one user is logged into your web app and you would like to pick up their `userId` or `userName` and have it as the display name in Whereby.

To do either of the above, you can refer to the "[Using URL parameters](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes)" section of the Whereby Developer documentation and use the URL parameter `?displayName=`

### Enable privacy toggle

Enable privacy settings globally across all rooms created on your account to remove the display name from all areas of Whereby, not just in the meeting room. This can be found in the [Privacy Features](/whereby-product-features/dashboard-preferences#privacy-features) section of your dashboard.

## Additional information

### In-room chat text

The Whereby Embedded chat is HIPAA compliant, as long as you have '**Make chat downloadable**' toggled off in your Configuration settings and do not use the URL parameters to turn on chat export. With these settings turned off, information is not stored and is only available for the participants for the duration of the call.

Customers can choose to either rely on the Whereby chat knowing that the information will not be stored nor accessible after the call OR they can build their own elsewhere in their platform.

There is no need to do anything to enable the HIPAA compliant in-room chat as it is already enabled and available for all customers, regardless of using the Whereby Embedded HIPAA compliant package or not.

### File sharing

[Sharing files through Whereby chat ](#file-sharing)is considered to be HIPAA compliant, as files are securely stored and only available to the participants for the duration of the session. All files are permanently deleted within 1 minute from the end of the session or from the moment when there is only 1 participant left in the room. They are not backed up and cannot be retrieved after the session.

There is no need to do anything to enable the HIPAA compliant file sharing as it is already enabled and available for all customers, regardless of using the Whereby Embedded HIPAA compliant package or not.

### Session Transcriptions

[Session Transcriptions](/whereby-product-features/transcribing/session-transcription) is designed to protect ePHI (Electronic protected health information) and supports compliance with the HIPAA Security Rule. To remain HIPAA compliant while using Session Transcriptions, you need to store the transcriptions in an S3 storage bucket with a strict access policy managed by your organization.

### Live Captions

[Live Captions](/whereby-product-features/live-captions) is designed to protect ePHI (Electronic protected health information) and supports compliance with the HIPAA Security Rule.

### Encryption in transit

There is no action required to enable encryption in transit as it is already enabled and available for all customers, regardless of whether they are using the Whereby Embedded HIPAA compliant package or not. This is by default and through enforcement of our infrastructure's encryption capabilities. This can be seen from our [A+ grading on SSL Labs](https://www.ssllabs.com/ssltest/analyze.html?d=whereby.com\&latest).

### Audit information

As a covered entities, Whereby Embedded customers may require to audit their suppliers based on their internal policies but also to showcase that they have ensured they are using HIPAA compliant products and services.

To support the HIPAA compliance of our customers, we will gladly provide our ISO27001 certificate and our HIPAA compliance checklist, which documents how Whereby complies with specific HIPAA rules. We perform an annual audit through a third-party consultant. For further information, [reach out to your Whereby contact](https://whereby.com/information/contact-sales/).

### Features you cannot use with a HIPAA compliant setup

Whereby Embedded can be used in a HIPAA compliant setup by our customers, however, this comes with limitations that need to be in place to have adequate security and compliance with the requirements of the law.

* **Live Streaming** - Whereby meetings cannot be live streamed (using RTMP), and we also do not envision scenarios where a private, health-related discussion will need to be live streamed. Make sure you don't include any live streaming config when you create rooms.
* **Integrations** - We have integrations built with Miro and YouTube that can be used in Whereby meeting rooms. Because these providers are not HIPAA compliant, you must make sure to disable integrations with [roomIntegrations=off](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes#roomintegrations) unless you're using another parameter that hides them like ?minimal.
* **Any feature that uses Whereby-provided storage** - For example, Cloud Recording using Whereby-provided storage is not considered to be HIPAA-compliant. To be HIPAA-compliant, you must store your cloud recordings using an S3 storage bucket.

Return to [creating HIPAA compliant rooms](#creating-hipaa-compliant-rooms)


# Case Study: Using Whereby's Browser SDK with React Hooks to Build a Telehealth App

In this tutorial you will build a fully functional video-conferencing app using the Whereby browser SDK with React hooks.

### What are you building?

In this tutorial you will build a fully functional video-conferencing app using the Whereby browser SDK with [React hooks](/reference/react-hooks-reference). This sample app will connect two participants in a video chat with custom UI, which is the most common scenario in telehealth video solutions. The app will allow the participants to control their camera and microphone, share their screen and send chat messages.

Here is a preview of what you will achieve:

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/MsxoQfGcL8Y8bp9txQ7E/image.png" alt=""><figcaption><p>Screenshot of the final app</p></figcaption></figure>

The finished code for this tutorial lives on [GitHub](https://github.com/whereby/sdk/tree/main/apps/telehealth-tutorial-app), in Whereby's SDK monorepo. We'll build it up step by step below.

## Setup for the tutorial

#### Create a Whereby room

You will need a Whereby Embedded account with a Whereby room to follow this tutorial. [Sign up for a free Embedded account here](https://whereby.com/org/signup/embedded?signupFlowPlanType=embedded_free) or login to your existing account. Then create the room using a wizard available on the homepage of your Customer Portal or with the API request. [Learn more how to programmatically create a Whereby room](https://docs.whereby.com/creating-and-deleting-rooms).

For this tutorial **make sure that your room is unlocked**, so that we don't have to spend time on the knock/waiting-room flow.

Copy the participant link to the room. In its most basic form, the room link has the following structure:

```
https://[subdomain].whereby.com/e5a4b3c2-8d1a-9f0e-7c6b-2d8f4e6a9db7
```

This will be your room URL, which you will need to later paste into the code.

#### Get the starter code

Clone the `whereby/sdk` repository and open the `apps/telehealth-tutorial-app` package - this is the starter project we'll build on throughout this tutorial:

```bash
git clone https://github.com/whereby/sdk.git
cd sdk/apps/telehealth-tutorial-app
```

Install dependencies and start the dev server:

```bash
npm install
npm run dev
```

(or `yarn install` / `yarn dev`, if you prefer Yarn.)

The starter project does not include any code from the Whereby browser SDK - it's a React and TypeScript example project, but it has the SDK already installed as visible in the `package.json` file. We also added some CSS classes in the `App.css` file and an `IconButton` component. These will be used throughout the tutorial. These have been added so we can focus on the functionality of the SDK instead of styling. Take some time to look around and get familiar with the starter code before proceeding with the tutorial.

The `App.tsx` file is the main component in our project and is where we will be building our app. Let's clear it out and start from scratch:

```tsx
import "./App.css";

export default function App() {
  return <div className="App"></div>;
}
```

## Overview <a href="#overview" id="overview"></a>

Now that you are set up, let's see how the Whereby browser SDK works.

### Wrapping the app in `WherebyProvider`

Before we can use the SDK's hooks, our app needs to be wrapped in a `WherebyProvider`. This gives the hooks access to the underlying Whereby client - without it, you'll get an error telling you the client hasn't been initialized.

Open `index.tsx` and wrap `<App />`:

```tsx
import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import App from "./App";
import { WherebyProvider } from "@whereby.com/browser-sdk/react";

const root = ReactDOM.createRoot(
  document.getElementById("root") as HTMLElement,
);
root.render(
  <React.StrictMode>
    <WherebyProvider>
      <App />
    </WherebyProvider>
  </React.StrictMode>,
);
```

You only need to do this once - everything else in this tutorial happens inside `App.tsx`.

### Connecting to the room

The first natural step is to connect to the room. When we connect to a room using the browser SDK, it is essentially the same as connecting to a standard Whereby room via a direct URL. Therefore, it is possible to run a session where some participants join the room from an app using the SDK client, while others use the regular Whereby room URL directly in the browser or embedded in another platform.

The browser SDK exposes a `useRoomConnection` React hook to connect to any Whereby room, and a `VideoView` component to render video streams. Let's import both:

```tsx
import "./App.css";
import { useRoomConnection, VideoView } from "@whereby.com/browser-sdk/react";

export default function App() {
  //...
}
```

The `useRoomConnection` hook accepts two parameters: a Whereby room URL and a set of media constraints.

For the Whereby room URL you need to provide the link to the unlocked Whereby room that you created initially. Declare it as a constant named `ROOM_URL`.

You can then use the `localMediaOptions` parameter to control access to the camera and microphone of the meeting participant. Here, you can set the `video` and `audio` properties to `true` to allow the app access to both devices:

```tsx
import "./App.css";
import { useRoomConnection, VideoView } from "@whereby.com/browser-sdk/react";

// Put your room URL here.
const ROOM_URL = "";

export default function App() {
  const roomConnection = useRoomConnection(ROOM_URL, {
    localMediaOptions: {
      audio: true,
      video: true,
    },
  });

  return <div className="App"></div>;
}
```

Try saving the file. Your browser should prompt you to allow camera and microphone access:

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/zfZoL82KMhN1exqAKzp3/sandbox-devices.webp" alt=""><figcaption></figcaption></figure>

Click "Allow" - but note that granting media permissions doesn't put you in the room yet. Calling `useRoomConnection` prepares the connection; actually joining is a separate, explicit step, which we'll add next.

### Handling connection status

The hook's `state` object exposes a `connectionStatus` field that tells you where you are in the connection lifecycle. Its possible values are:

| Status                 | Meaning                                                                  |
| ---------------------- | ------------------------------------------------------------------------ |
| `initializing`         | The connection is being set up.                                          |
| `connecting` / `ready` | Ready to join - this is when you'll typically show a "Join room" button. |
| `knocking`             | You've asked to join a locked room and are waiting for the host.         |
| `knock_rejected`       | The host declined your knock.                                            |
| `room_locked`          | The room is locked; you'll need to knock before joining.                 |
| `connected`            | You're in the room.                                                      |
| `left` / `kicked`      | You've left, or been removed from, the room.                             |

Let's destructure `state` and `actions`, and branch on `connectionStatus`:

```tsx
export default function App() {
  const roomConnection = useRoomConnection(ROOM_URL, {
    localMediaOptions: {
      audio: true,
      video: true,
    },
  });

  const { state, actions } = roomConnection;
  const { joinRoom, knock } = actions;

  if (
    state.connectionStatus === "connecting" ||
    state.connectionStatus === "ready"
  ) {
    return <button onClick={() => joinRoom()}>Join room</button>;
  }

  if (
    state.connectionStatus === "left" ||
    state.connectionStatus === "kicked"
  ) {
    return (
      <button onClick={() => joinRoom()}>
        Re-join {state.connectionStatus} room
      </button>
    );
  }

  if (state.connectionStatus === "knocking") {
    return <p>Knocking...</p>;
  }

  if (state.connectionStatus === "knock_rejected") {
    return <p>You have been rejected access</p>;
  }

  // room_locked and connected are handled below

  return <div className="App"></div>;
}
```

{% hint style="info" %}
**About locked rooms**

Since your room is unlocked, you can safely skip the `room_locked` case - you'll go straight to `connected` after clicking "Join room". But in case you want to handle locked rooms too, here's what that looks like:

```tsx
const WaitingArea = ({ knock }: { knock: () => void }) => {
  return (
    <div>
      <h1>Room locked</h1>
      <p>Waiting for host to let you in</p>
      <button onClick={knock}>Knock</button>
    </div>
  );
};

// ...inside App():
if (state.connectionStatus === "room_locked") {
  return <WaitingArea knock={knock} />;
}
```

{% endhint %}

Click "Join room", and you're connected! You can verify this by opening the room URL in a different tab - you should see a "Guest" user, which is the participant joining from the SDK.

From here on, everything we build (video cells, chat, controls) goes inside the `return` for the `connected` state.

### Rendering your own video cell

Once we are connected to the room, we can begin rendering the video UI. A logical first step is to render our own video cell. The `useRoomConnection` hook's `state` object gives us access to our own video stream through the `localParticipant` object, as well as a list of remote participants in the `remoteParticipants` array - plus other room state such as screenshare and chat.

A full list of available actions and state can be [found in our docs](https://github.com/whereby/docs/tree/main/reference/react-hooks-reference/api-reference/useroomconnection.md).

Let's use `VideoView` (imported earlier, alongside `useRoomConnection`) together with `localParticipant` to render our own video:

```tsx
//...

export default function App() {
  //...

  const { state } = roomConnection;
  const { localParticipant } = state;

  return (
    <div className="App">
      <VideoView stream={localParticipant.stream} />
    </div>
  );
}
```

If you run this code, you'll get the following error:

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/gG4gu6cOoxocoSEqmBKA/type-error.webp" alt=""><figcaption></figcaption></figure>

This happens because we are trying to access the `stream` property of the `localParticipant` before it is mounted. To resolve this, you can use conditional rendering of the `VideoView`, depending on the availability of `localParticipant.stream`. We should also mute the local audio, otherwise we will hear ourselves in the audio feedback loop. Let's also add the `mirror` prop, so your own camera feed behaves like a mirror, which feels more natural for a self-view:

```tsx
//...

export default function App() {
  //...

  const { state } = roomConnection;
  const { localParticipant } = state;

  return (
    <div className="App">
      {localParticipant?.stream ? (
        <VideoView mirror muted stream={localParticipant.stream} />
      ) : null}
    </div>
  );
}
```

Now, you should be able to see your own video stream in your app. However, the video currently takes up the entire screen. To fix this, let's add some CSS.

In the project, there are already CSS classes available for use. First, we will add a wrapper `<div />` around the video view with a class named `left-section`. This wrapper will allow us to add more elements later and divide up the screen. Additionally, we will add another `<div />` around the video with a class called `self-view-wrapper`:

```tsx
//...

export default function App() {
  //...

  const { state } = roomConnection;
  const { localParticipant } = state;

  return (
    <div className="App">
      <div className="left-section">
        {localParticipant?.stream ? (
          <div className="self-view-wrapper">
            <VideoView mirror muted stream={localParticipant.stream} />
          </div>
        ) : null}
      </div>
    </div>
  );
}
```

Now your video cell appears as an oval in the bottom left corner. Well done!

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/EZzG25KYCVahG8pnoJX9/telehealth-localview.webp" alt=""><figcaption></figcaption></figure>

### Rendering the remote participant(s)

It's cool that we can see our own video, but we can't have a meeting by ourselves. Let's render the videos of other participant(s) in the video call.

As mentioned before, we can access the remote participants through the `remoteParticipants` array on the `state` object. This array provides a list of all participants in the call (excluding ourselves) and allows us to access their display names and media streams, among other things.

The initial step is to render a video cell for each participant:

```tsx
//...

export default function App() {
  //...

  const { state } = roomConnection;
  const { localParticipant, remoteParticipants } = state;

  return (
    <div className="App">
      <div className="left-section">
        {localParticipant?.stream ? (
          <div className="self-view-wrapper">
            <VideoView mirror muted stream={localParticipant.stream} />
          </div>
        ) : null}
      </div>

      {remoteParticipants.map((participant) => (
        <VideoView stream={participant.stream} />
      ))}
    </div>
  );
}
```

You can now see all the other participants in the room! Join the room from a separate browser, and you will see yourself twice - one small circle in the bottom left corner (The SDK self-view), and one big video. The big video represents the remote participant. If there are more people in the call, they will be displayed side-by-side.

As this tutorial is focused on a one-on-one telehealth meeting, we are only interested in **one** remote participant. Therefore, we will modify our code to only render the first participant.

{% hint style="warning" %}
The following process is **not** recommended for a real app, as there may still be other participants connected to the room and they will be hidden with this implementation.

However, for the purpose of this tutorial, we will assume that there will only ever be two participants in the meeting.
{% endhint %}

Let's update our code to only render one participant and add some classes. We will place the remote participant in a `<div />` that will have a class named `video-stage` and the `<VideoView />` will be wrapped in another `<div />` with a class named `remote-view-wrapper`:

```tsx
//...

export default function App() {
  //...

  const { state } = roomConnection;
  const { localParticipant, remoteParticipants } = state;

  return (
    <div className="App">
      <div className="left-section">
        {localParticipant?.stream ? (
          <div className="self-view-wrapper">
            <VideoView mirror muted stream={localParticipant.stream} />
          </div>
        ) : null}
      </div>

      <div className="video-stage">
        {remoteParticipants[0]?.stream ? (
          <div className="remote-view-wrapper">
            <VideoView stream={remoteParticipants[0].stream} />
          </div>
        ) : null}
      </div>
    </div>
  );
}
```

Great! Now, the remote participant is visible in the center of the screen within an oval video cell.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/Ctgk3MkrvQcBg8a6z6Up/telehealth2-local&amp;remote.png" alt=""><figcaption></figcaption></figure>

### Adding the display name

To identify the participants during a conversation, we can add a label on the remote participant's video cell displaying their name, using the `displayName` property that's already available on each entry in `remoteParticipants`.

For the local participant, there is no need to have a display name, so we can simply use the string "You". We will add a `<p />` tag with a class of `self-name`:

```tsx
//...

export default function App() {
  //...

  const { state } = roomConnection;
  const { localParticipant, remoteParticipants } = state;

  return (
    <div className="App">
      <div className="left-section">
        {localParticipant?.stream ? (
          <div className="self-view-wrapper">
            <VideoView mirror muted stream={localParticipant.stream} />
            <p className="self-name">You</p>
          </div>
        ) : null}
      </div>
      //...
    </div>
  );
}
```

For the remote participant, we will add a `<p />` tag with the class `remote-name`, and read the name straight off `remoteParticipants[0].displayName` (falling back to "Guest" if it's blank):

```tsx
//...

export default function App() {
  //...

  const { state } = roomConnection;
  const { localParticipant, remoteParticipants } = state;

  return (
    <div className="App">
      //...
      <div className="video-stage">
        {remoteParticipants[0]?.stream ? (
          <div className="remote-view-wrapper">
            <VideoView stream={remoteParticipants[0].stream} />
            <p className="remote-name">
              {remoteParticipants[0].displayName || "Guest"}
            </p>
          </div>
        ) : null}
      </div>
    </div>
  );
}
```

Now we can see the name of the participants in the call!

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/VJG8SboFBzK6cRkcz2nd/telehealth3-displayname.png" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
We'll also want to look participants up by `id` later, when we build the chat feature - chat messages only carry a `senderId`, not a name. Let's add a small helper for that now:

```tsx
function getDisplayName(id: string) {
  return remoteParticipants.find((p) => p.id === id)?.displayName || "Guest";
}
```

{% endhint %}

### Adding in-room actions

Let's add some in-room actions. First, we'll add buttons to control the camera and microphone. To simplify the styling (and to keep this tutorial as short as possible!), we have already included a component called `<IconButton />` that can render the buttons. It has 3 variants: `camera | microphone | share`. Let's begin with the camera.

The SDK provides a function called `toggleCamera` which accepts a single parameter `enabled: boolean`. We can use this function to control the state of our camera. To display a different button variant depending on whether the camera is enabled or disabled, we will use React's `useState` function to store this information in our local component's state:

```tsx
//...

export default function App() {
  const [isCameraActive, setIsCameraActive] = React.useState(true);

  //...

  return (
    //...
  );
}
```

We set the default value to `true` because we join the room with the camera turned on by default. With this local state, we can now make use of the `toggleCamera` function on the `roomConnection`'s `actions` object:

```tsx
//...

export default function App() {
  const [isCameraActive, setIsCameraActive] = React.useState(true);

  //...
  const { state, actions } = roomConnection;
  const { localParticipant, remoteParticipants } = state;
  const { toggleCamera } = actions;

  return (
    //...
  );
}
```

Let's render the button. As mentioned earlier, we will use the `<IconButton />` component. In this case, we'll set the `variant` prop to `camera`. The `<IconButton />` component also has a property called `isActive`, which is a boolean value that determines whether to show the "on" or "off" version of the button. We can pass our newly created `isCameraActive` variable to this prop.

The last prop is the `onClick` handler. Here, we need to do two things: change the value of our `isCameraActive` state variable to the opposite of its current value, and call the `toggleCamera` function to actually turn the camera on or off.

To style this section, we'll add two divs. The first div will have a class name of `control-wrapper` and will act as the outer wrapper. The second div, with the class name `buttons`, will hold our buttons. We'll place this code **after** the video stage (the remote video container):

```tsx
//...
import IconButton from "./IconButton";

//...

export default function App() {
  //...

  const { state, actions } = roomConnection;
  const { localParticipant, remoteParticipants } = state;
  const { toggleCamera } = actions;

  return (
    <div className="App">
      //...
      <div className="control-wrapper">
        <div className="buttons">
          <IconButton
            variant="camera"
            isActive={isCameraActive}
            onClick={() => {
              setIsCameraActive((prev) => !prev);
              toggleCamera();
            }}
          >
            Cam
          </IconButton>
        </div>
      </div>
    </div>
  );
}
```

Follow the same pattern for the microphone:

```tsx
//...

export default function App() {
  const [isCameraActive, setIsCameraActive] = React.useState(true);
  const [isMicrophoneActive, setIsMicrophoneActive] = React.useState(true);
  //...

  const { state, actions } = roomConnection;
  const { localParticipant, remoteParticipants } = state;
  const { toggleCamera, toggleMicrophone } = actions;

  return (
    <div className="App">
      //...
      <div className="control-wrapper">
        <div className="buttons">
          <IconButton
            variant="camera"
            isActive={isCameraActive}
            onClick={() => {
              setIsCameraActive((prev) => !prev);
              toggleCamera();
            }}
          >
            Cam
          </IconButton>
          <IconButton
            variant="microphone"
            isActive={isMicrophoneActive}
            onClick={() => {
              setIsMicrophoneActive((prev) => !prev);
              toggleMicrophone();
            }}
          >
            Mic
          </IconButton>
        </div>
      </div>
    </div>
  );
}
```

We now have two functional action buttons! Cool.

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/qnmjoHpOsUb8U8FBsTco/telehealth4-cam&amp;micbtn.webp" alt=""><figcaption></figcaption></figure>

### Screen sharing

We can now extend the functionality of the app with the ability to share the screen.

#### Remote screenshare

In this step we will display the screen shared by the remote participant.

The SDK exposes the `screenshares` array within the `state` object of the `useRoomConnection` hook. This array includes the screenshare stream of both the local and remote participant. They can be distinguished using the `isLocal: boolean` prop. First, we need to destructure the `screenshares` prop from the `state` object. Then, render the first screenshare in the array, similar to how we did it for the remote participant video.

Wrap the `VideoView` component in a `<div />` element with a class name of `screenshare-view-wrapper`:

```tsx
//...

export default function App() {
  //...

  const { state, actions } = roomConnection;
  const { localParticipant, remoteParticipants, screenshares } = state;
  const { toggleCamera, toggleMicrophone } = actions;
  //...

  return (
    <div className="App">
      //...
      <div className="video-stage">
        //...
        {screenshares[0]?.stream ? (
          <div className="screenshare-view-wrapper">
            <VideoView stream={screenshares[0].stream} />
          </div>
        ) : null}
      </div>
      //...
    </div>
  );
}
```

To test the screen sharing functionality, open the room URL in a new browser tab, start a screenshare and return to your app. Currently, the screenshare appears directly below the remote participant's video. Our goal is to replace the remote video with the screenshare and move the remote video to the top-right corner of the shared screen. We have added CSS classes to achieve this, but we need to apply them conditionally.

Here is how we modify the rendering of the remote video view: if there are any active screenshares (`screenshares.length > 0`), add the class `remote-view-small` to the wrapper div. If there are no active screenshares, keep the existing `remote-view-wrapper` class.

Similarly, for the remote display name add the class `screenshare-remote-name` if there are any active screenshares, and keep the `remote-name` class if there are none.

```tsx
//...

export default function App() {
  //...

  const { state, actions } = roomConnection;
  const { localParticipant, remoteParticipants, screenshares } = state;
  const { toggleCamera, toggleMicrophone } = actions;
  //...

  return (
    <div className="App">
      //...
      <div className="video-stage">
        {remoteParticipants[0]?.stream ? (
          <div
            className={
              !screenshares.length ? "remote-view-wrapper" : "remote-view-small"
            }
          >
            <VideoView stream={remoteParticipants[0].stream} />
            <p
              className={
                !screenshares.length ? "remote-name" : "screenshare-remote-name"
              }
            >
              {remoteParticipants[0].displayName || "Guest"}
            </p>
          </div>
        ) : null}
      </div>
      //...
    </div>
  );
}
```

As a result, the screen shared by the remote participant is centered and their video cell appears in the top-right corner:

<figure><img src="https://content.gitbook.com/content/LH2UIJDLc2EElQvYUxWX/blobs/GzFL1eGHQLS0tbgWRhY9/telehealth5-screenshare.webp" alt=""><figcaption></figcaption></figure>

#### Local screenshare

In this step we will enable local screen sharing from our app. The SDK provides two actions for this: `startScreenshare` and `stopScreenshare`. The implementation for local screen sharing will be very similar to the camera and microphone actions. We will keep track of the screenshare state by using the `useState` local component, with a default value of `false`. We will also destructure the `startScreenshare` and `stopScreenshare` actions from the `actions` object, and then add an `IconButton` with a variant of `share`.

```tsx
//...

export default function App() {
  const [isCameraActive, setIsCameraActive] = React.useState(true);
  const [isMicrophoneActive, setIsMicrophoneActive] = React.useState(true);
  const [isLocalScreenshareActive, setIsLocalScreenshareActive] =
    React.useState(false);

  const { state, actions } = roomConnection;
  const { localParticipant, remoteParticipants, screenshares } = state;
  const { toggleCamera, toggleMicrophone, startScreenshare, stopScreenshare } =
    actions;

  return (
    <div className="App">
      //...
      <div className="control-wrapper">
        <div className="buttons">
          //...
          <IconButton
            variant="share"
            isActive={isLocalScreenshareActive}
            onClick={() => {
              if (isLocalScreenshareActive) {
                stopScreenshare();
              } else {
                startScreenshare();
              }
              setIsLocalScreenshareActive((prev) => !prev);
            }}
          >
            {isLocalScreenshareActive ? "Stop" : "Share"}
          </IconButton>
        </div>
      </div>
    </div>
  );
}
```

As a result we have a new action button, and we can start and stop sharing the screen from our app.

### Chat

The last functionality that we will add to the app is the ability to exchange messages through a chat.

#### Receiving chat messages

In the first step we will display the incoming messages in the app.

Similarly to other updates that take place in the room, the SDK exposes an array of chat messages within the `state` object. To begin, let's destructure this array and loop through the messages at the start of the `left-section` that we created earlier. Additionally, we will wrap all the messages with a `<div />` element using the `chat-wrapper` class.

We can use the `getDisplayName` helper from earlier to retrieve the display name of the participant who sent the chat message. Each chat object includes a `senderId` field, which represents the participant's id:

```tsx
//...

export default function App() {
  //...

  const { state, actions } = roomConnection;
  const { localParticipant, remoteParticipants, screenshares, chatMessages } =
    state;
  const { toggleCamera, toggleMicrophone, startScreenshare, stopScreenshare } =
    actions;

  function getDisplayName(id: string) {
    return remoteParticipants.find((p) => p.id === id)?.displayName || "Guest";
  }

  return (
    <div className="App">
      <div className="left-section">
        <div className="chat-wrapper">
          {chatMessages.map((message) => (
            <>
              <p className="chat-message">{message.text}</p>
              <p className="chat-message-name">
                {getDisplayName(message.senderId)}
              </p>
            </>
          ))}
        </div>
        //...
      </div>
      //...
    </div>
  );
}
```

Now we can see incoming chat messages. To test it, open the room URL in a new browser tab, and type some messages as the remote participant.

As the chat grows, it's a nice touch to automatically scroll to the newest message. Let's add a ref just after the last message, and scroll it into view whenever `chatMessages` changes:

```tsx
//...

export default function App() {
  //...
  const chatMessageBottomRef = React.useRef<HTMLDivElement>(null);

  const { state, actions } = roomConnection;
  const { localParticipant, remoteParticipants, screenshares, chatMessages } =
    state;
  const { toggleCamera, toggleMicrophone, startScreenshare, stopScreenshare } =
    actions;

  function getDisplayName(id: string) {
    return remoteParticipants.find((p) => p.id === id)?.displayName || "Guest";
  }

  function scrollToBottom() {
    chatMessageBottomRef.current?.scrollIntoView({ behavior: "smooth" });
  }

  React.useEffect(() => {
    scrollToBottom();
  }, [chatMessages]);

  return (
    <div className="App">
      <div className="left-section">
        <div className="chat-wrapper">
          {chatMessages.map((message) => (
            <>
              <p className="chat-message">{message.text}</p>
              <p className="chat-message-name">
                {getDisplayName(message.senderId)}
              </p>
            </>
          ))}
          <div ref={chatMessageBottomRef} />
        </div>
        //...
      </div>
      //...
    </div>
  );
}
```

#### Sending chat messages

To enable sending chat messages from our app, let's add an input field. The SDK provides an action called `sendChatMessage`, which takes a string as its only parameter. We will use this action to send chat messages to the room. To implement this, let's create a form and render it after the local participant in our HTML markup. We also need to keep track of the input value, so let's create a new local state called `text`:

```tsx
//...

export default function App() {
  //...
  const [text, setText] = React.useState("");

  const { state, actions } = roomConnection;
  const { localParticipant, remoteParticipants, screenshares, chatMessages } =
    state;
  const {
    toggleCamera,
    toggleMicrophone,
    startScreenshare,
    stopScreenshare,
    sendChatMessage,
  } = actions;

  return (
    <div className="App">
      <div className="left-section">
        //...
        <form
          className={"input-wrapper"}
          onSubmit={(e) => {
            e.preventDefault();
            sendChatMessage(text);
            setText("");
          }}
        >
          <input
            value={text}
            onChange={(e) => setText(e.target.value)}
            type="text"
            placeholder="Type here..."
          />
          <button type="submit">Send message</button>
        </form>
      </div>
      //...
    </div>
  );
}
```

This enables us to send chat messages. However, you might notice a bug: whenever we type in the input field, the whole component re-renders, causing a flash on the video feeds. This happens because all the state is contained within the same component, causing it to re-render whenever a value changes. We can fix that easily by extracting the chat input into a separate component. Let's create a new file called `ChatInput.tsx` and move the code there:

```tsx
// ChatInput.tsx
import * as React from "react";

interface Props {
  sendChatMessage: (text: string) => void;
}

function ChatInput({ sendChatMessage }: Props) {
  const [text, setText] = React.useState("");

  return (
    <form
      className="input-wrapper"
      onSubmit={(e) => {
        e.preventDefault();
        sendChatMessage(text);
        setText("");
      }}
    >
      <input
        value={text}
        placeholder="Type here..."
        onChange={(e) => setText(e.target.value)}
      />
      <button type="submit">Send message</button>
    </form>
  );
}

export default ChatInput;
```

Now we can import this component into our app, and pass the `sendChatMessage` function as a prop. Remove all the code that we just added to `App.tsx`, and replace it with this:

```tsx
//...
import ChatInput from "./ChatInput";

export default function App() {
  //...

  const { state, actions } = roomConnection;
  const { localParticipant, remoteParticipants, screenshares, chatMessages } =
    state;
  const {
    toggleCamera,
    toggleMicrophone,
    startScreenshare,
    stopScreenshare,
    sendChatMessage,
  } = actions;

  return (
    <div className="App">
      <div className="left-section">
        //...
        <ChatInput sendChatMessage={sendChatMessage} />
      </div>
      //...
    </div>
  );
}
```

Well done! We can now type chat messages without triggering re-renders. However, there are still re-renders whenever a new chat message is received or when the camera and microphone are turned on or off. These issues can be fixed using the same approach above.

### Conclusion

Congrats! You have created a fully custom video app that:

* Connects to a Whereby room
* Acquires media permissions
* Renders the local video stream
* Renders the remote participant's video stream
* Renders screenshares
* Allows users to toggle their camera and microphone on and off
* Allows users to share their screen
* Shows chat messages as they are received
* Allows users to send chat messages to other participants in the room

Great job! We hope this tutorial has given you a better understanding of how the React hooks in Whereby browser SDK work, and that you will continue to build with it.

The final code can be viewed on [GitHub](https://github.com/whereby/sdk/tree/main/apps/telehealth-tutorial-app).

### Next steps

If you would like to continue working on this app, a good next step would be to separate things into components. This will help eliminate the re-rendering problems that we discussed.

For example, you can create a `<Controls />` component to handle the buttons. This way, the app won't re-render when any of the buttons are clicked. Similarly, you can create a separate component for the chat, so that the app doesn't re-render whenever a new chat message comes in.

Lastly, it would be a good exercise to handle multiple remote participants or multiple screenshares.


# REST API Reference

### Versioning

As our API continues to evolve it will be versioned to ensure backward compatibility for our users. Breaking changes will come under new major versions, while non-breaking changes may be added to existing versions and change more frequently.

#### Breaking changes:

* Removal of endpoints
* Removing response data
* Changes in request / response format
* Changes to authentication mechanism

#### Non-breaking changes:

* Adding new endpoints
* Adding to response data
* New parameters

### Rate Limiting (throttling)

Our API uses a **point-based rate limiting system** to fairly allocate resources across different types of requests.

Each API request consumes between **1 and 10 points**, depending on its complexity. Point usage is based on factors such as the amount of data processed, the number of resources involved, and whether additional computation or advanced features are required.

*Enterprise* [plans](https://whereby.com/information/embedded/pricing/) have 1000 points in total per minute, and *Build* plans have 100. The limits are global and are shared across all your API keys. Talk to us if you need higher limits. Once this limit is exceeded, further requests will be rejected with a `429 Too Many Requests` response until the limit resets.

#### Typical point usage

Point usage depends on **request complexity**, not just whether a request is a read or a write.

* **Low-complexity requests** (for example, simple reads of a single resource): *1 point*
* **Moderate-complexity requests** (such as writes or reads involving multiple resources): *3 points*
* **High-complexity requests** (such as complex reads, aggregations, or batch operations): *5–10 points*

Read-only requests are not guaranteed to be low-cost; some heavy read operations may consume the maximum number of points depending on the amount of data processed and computation required.

#### Rate limit enforcement

When a rate limit is exceeded, the API returns a `429 Too Many Requests` response. Requests will continue to be rejected until sufficient points are available again.

To protect platform stability and ensure fair usage, we may temporarily adjust rate limits or point budgets in response to abusive behavior or unexpected traffic patterns. If your application consistently reaches its rate limit, please contact us to discuss higher limits or alternative approaches.

You may read the `Retry-After` (seconds) or `X-RateLimit-Reset` (date) response headers in order to know when you can restart your requests. In addition, the `X-RateLimit-Limit` header includes the total number of points for your organization, and the `X-RateLimit-Remaining` header displays the remaining available points.

## Authentication

### BearerAuth

The bearer token will be provided upon request and it is up to the client to keep it secret. Every API call needs to contain this token in order to authenticate and authorize the client.

| **Security Scheme Type**      | HTTP   |
| ----------------------------- | ------ |
| **HTTP Authorization Scheme** | bearer |

### Endpoints

* [/meetings](/reference/whereby-rest-api-reference/meetings)
* [/insights](/reference/whereby-rest-api-reference/insights)
* [/recordings](/reference/whereby-rest-api-reference/recordings)
* [/transcriptions](/reference/whereby-rest-api-reference/transcriptions)
* [/rooms](/reference/whereby-rest-api-reference/rooms)


# /meetings

Creates a transient room that is available between creation and an hour after the given `endDate`. After this time the room will be automatically deleted. The URL to this room is present in the response.

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/meetings" method="post" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/meetings" method="get" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/meetings/{meetingId}" method="get" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/meetings/{meetingId}" method="delete" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}


# /insights

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/insights/rooms" method="get" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/insights/room-sessions" method="get" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/insights/participants" method="get" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/insights/participant" method="get" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}


# /recordings

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/recordings" method="get" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/recordings/{recordingId}" method="get" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/recordings/{recordingId}/access-link" method="get" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/recordings/bulk-delete" method="post" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/recordings/{recordingId}" method="delete" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}


# /transcriptions

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/transcriptions" method="post" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/transcriptions" method="get" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/transcriptions/{transcriptionId}" method="get" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/transcriptions/{transcriptionId}/access-link" method="get" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/transcriptions/bulk-delete" method="post" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/transcriptions/{transcriptionId}" method="delete" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}


# /rooms

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/rooms/{roomName}/theme/logo" method="put" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/rooms/{roomName}/theme/tokens" method="put" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/rooms/{roomName}/theme/room-background" method="put" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}

{% openapi src="/files/mtSteZAZ7yj32J5Ha9vT" path="/rooms/{roomName}/theme/room-knock-page-background" method="put" %}
[\_api-reference-docs-openapi.json](https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2Fgit-blob-b180d39652badc3cdf76164592d9d900537b09bd%2F_api-reference-docs-openapi.json?alt=media)
{% endopenapi %}


# Web Component Reference

Our web component allows you to embed Whereby's pre-built UI on any webpage. It provides a simple readable integration and exposes local client events and commands between our platform and yours.

## Installation

When using React or a bundler like Webpack, Rollup, Parcel, etc

```bash
npm install @whereby.com/browser-sdk
```

```javascript
import "@whereby.com/browser-sdk/embed"
```

{% tabs %}
{% tab title="HTML" %}
{% code overflow="wrap" %}

```html
<whereby-embed room="https://subdomain.whereby.com/your_room?roomKey=3fe345a"></whereby-embed>
```

{% endcode %}

You can use a `hostRoomUrl` instead of the `roomUrl`, if you want to give the user [host privileges](/whereby-product-features/user-roles-and-privileges#hosts)
{% endtab %}

{% tab title="JSX" %}

```jsx
const MyComponent = ({ roomUrl }) => {
    return <whereby-embed room={roomUrl} />
}

export default MyComponent
```

You can use a `hostRoomUrl` instead of the `roomUrl`, if you want to give the user [host privileges](/whereby-product-features/user-roles-and-privileges#hosts)
{% endtab %}
{% endtabs %}

{% hint style="info" %}
If you aren't using a bundler or a library containing a bundler you can access the component code directly from our CDN using a [simple Script tag](/whereby-for-web-browser/web-component-and-pre-built-ui/web-app-quickstart#using-a-less-than-script-greater-than-element) in your site
{% endhint %}

### Attributes of the component

The web component has a variety of attributes available to customize the meeting experience for your users. It’s possible for each participant in a meeting to have different attribute combinations.

<table data-full-width="true"><thead><tr><th width="301.33333333333337">Attribute</th><th>Description</th></tr></thead><tbody><tr><td><code>aec=off</code></td><td><p>Turn off acoustic echo cancellation on audio, useful in situations where higher quality audio is important like in music lessons.</p><p>AEC must be on in order to use the in room "Noise Reduction" feature.</p></td></tr><tr><td><code>agc=off</code></td><td><p>Turn off automatic gain control (or volume level) on audio.</p><p>AGC must be on in order to use the in room "Noise Reduction" feature.</p></td></tr><tr><td><code>audio=off</code></td><td>Participant joins the room with microphone turned off.</td></tr><tr><td><p><br><code>audioDenoiser=on</code></p><p><code>audioDenoiser=off</code></p></td><td><p>Enables/Disables the noise cancellation feature.</p><p>Can increase CPU load, particularly for older/slower devices.</p></td></tr><tr><td><code>autoHideSelfView</code></td><td><p>Automatically hide the self view in the bottom right.</p><p>Floating the self view to the bottom right is required in order to hide the self view. Must be used with <strong>floatSelf</strong> for this feature to work.</p></td></tr><tr><td><code>autoSpotlight</code></td><td><p>Automatically spotlight the local participant on room join.</p><p>Only works when the participant joining has host privileges.</p></td></tr><tr><td><code>avatarUrl=&#x3C;url></code></td><td><p>Set the profile avatar of participant.</p><p>Images must be a square .png or .jpg, maximum of 64pxx64px<br><br>The image URL must be listed in the <a href="https://github.com/whereby/docs/tree/main/whereby-101/customizing-rooms/broken-reference/README.md">allowed domains</a> section of the dashboard. The image URL must be https and cannot contain query params.</p></td></tr><tr><td><code>background=off</code></td><td>Hide the room background.</td></tr><tr><td><p><code>bottomToolbar=on</code></p><p><code>bottomToolbar=off</code></p></td><td>Show/hide the entire bottom toolbar.</td></tr><tr><td><p><code>breakout=on</code></p><p><code>breakout=off</code></p></td><td>Show/hide the breakout room feature for the meeting host.</td></tr><tr><td><p><code>callQualityMonitoring=on</code></p><p><code>callQualityMonitoring=off</code></p></td><td><p>Show/hide the <a href="/whereby-product-features/insights-suite-and-api/real-time-troubleshooting#meeting-diagnostics">meeting diagnostics</a> button, sidebar, and indicators.</p><p>The rooms top toolbar is required to use the meeting diagnostics feature.</p></td></tr><tr><td><p><code>cameraAccess=on</code></p><p><code>cameraAccess=off</code></p></td><td>Camera permissions are not requested or used at all. On by default.</td></tr><tr><td><code>cameraEffect=&#x3C;effect></code></td><td><p>Set default camera effect to be used. Still user changeable.</p><p><strong>Possible values:</strong> <code>slight-blur</code>, <code>blur</code>, <code>image-cabin</code>, <code>image-concrete</code>, <code>image-brick</code>, <code>image-sunrise</code>, <code>image-day</code>, <code>image-night</code></p></td></tr><tr><td><p><code>chat=on</code></p><p><code>chat=off</code></p></td><td>Show/hide the chat button.</td></tr><tr><td><p><code>chatDownload=on</code></p><p><code>chatDownload=off</code></p></td><td><p>Allows you to download the chat transcript from a session once it's finished.</p><p>This will only enable the chat download functionality for the user that has this parameter included in their URL.</p></td></tr><tr><td><code>displayName=&#x3C;name></code></td><td><p>Set display name of participant.</p><p>Supports <strong>any characters except code characters <code>$!&#x3C;>:;</code></strong> and can be <strong>up to 100 characters long</strong>. Strings not in this format will be rejected and the user will be prompted to enter a different display name instead.</p></td></tr><tr><td><code>externalId=&#x3C;id></code></td><td><p>A custom identifier for the participant. Gets saved in Insights data.</p><p>Supports <strong>alphanumeric characters</strong> (<code>A-Za-z0-9-_</code>) and can be <strong>up to 36 characters long</strong>. Strings not in this format will be rejected and return an error. We recommend the UUID v4 format.</p></td></tr><tr><td><code>floatSelf</code></td><td>Float the self view to the bottom right.</td></tr><tr><td><p><code>groups=&#x3C;group-names></code><br></p><p><code>e.g. Orange,Banana,Coconut</code></p></td><td>Predefine up to 20 groups for the breakout groups function.</td></tr><tr><td><p><code>highlightActiveSpeaker=on</code></p><p><code>highlightActiveSpeaker=off</code></p></td><td>Show/hide active speaker highlighting in real-time.</td></tr><tr><td><code>lang=&#x3C;code></code></td><td><p>Set the room UI language.</p><p><strong>Possible values</strong>: Czech <code>cs</code>, Chinese (Traditional) <code>zh-hant</code>, Danish <code>da</code>, Dutch <code>nl</code>, English <code>en</code>, French <code>fr</code>, German <code>de</code>, Greek <code>el</code>, Hindi <code>hi</code>, Hungarian <code>hu</code>, Italian <code>it</code>, Japanese <code>jp</code>, Norwegian <code>nb</code>, Portuguese <code>pt</code>, Polish <code>pl</code>, Spanish <code>es</code>, Swedish <code>sv</code>, or Ukrainian <code>uk</code></p></td></tr><tr><td><p><code>leaveButton=on</code></p><p><code>leaveButton=off</code></p></td><td>Show/hide the leave button.</td></tr><tr><td><p><code>localization=on</code></p><p><code>localization=off</code></p></td><td><p>Show/hide the language picker.</p><p>Hiding the localization options means the user will not be able to change their language preference.</p></td></tr><tr><td><code>locking=off</code></td><td>Hide the room lock button.</td></tr><tr><td><code>logo=off</code></td><td>Hide the logo in the room header.</td></tr><tr><td><p><code>lowData=on</code></p><p><code>lowData=off</code></p></td><td>Use a lower resolution by default.</td></tr><tr><td><code>metadata=&#x3C;string></code></td><td>Gets passed on to the corresponding webhooks.</td></tr><tr><td><code>minimal</code></td><td><p>Applies a minimal UI. Turns off all controls except for cam and mic.</p><p><strong>Hidden items:</strong> top bar, chat, screensharing, leave button, and Whereby’s default branding.<br></p><p><strong>Shown items:</strong> Video, audio, and people buttons.</p></td></tr><tr><td><code>moreButton=off</code></td><td>Hide the more [...] button.</td></tr><tr><td><code>participantCount=off</code></td><td>Hide the participant counter.</td></tr><tr><td><code>people=off</code></td><td>Hide the people button.</td></tr><tr><td><code>pipButton=off</code></td><td>Hide the Picture in Picture button.</td></tr><tr><td><p><code>precallCeremony=on</code></p><p><code>precallCeremony=off</code></p></td><td><p>Determines if users see the pre-call device and connectivity test.</p><p>This feature is a subset of the Pre-call review. This means in order for the pre-call tests to appear, pre-call cannot be turned off.</p></td></tr><tr><td><code>precallCeremonyCanSkip=on</code></td><td><p>Adds functionality for participants to skip the connectivity test.</p><p>This feature is a subset of the Pre-call review. This means in order for the pre-call tests to appear, pre-call cannot be turned off.</p></td></tr><tr><td><code>precallPermissionHelpLink=&#x3C;url></code></td><td>Specify custom help link in pre-call review step pointing users to additional support pages.</td></tr><tr><td><p><code>precallReview=on</code></p><p><code>precallReview=off</code></p></td><td>Determines if users see the pre-call review step.</td></tr><tr><td><code>roomIntegrations=on</code></td><td><p>Enables YouTube and Miro integrations in the meeting.</p><p>It is recommended you do testing to verify these integrations behave as expected before releasing to your users.</p></td></tr><tr><td><p><code>screenshare=on</code></p><p><code>screenshare=off</code></p></td><td>Show/hide the screenshare button.</td></tr><tr><td><code>settingsButton=off</code></td><td>Hide the settings button.</td></tr><tr><td><code>skipMediaPermissionPrompt</code></td><td>Skip the 'request permissions' screen and immediately trigger the browser’s camera/microphone prompt</td></tr><tr><td><p><code>subgridLabels=on</code></p><p><code>subgridLabels=off</code></p></td><td>Enable name labels for participants in the subgrid.</td></tr><tr><td><p><code>timer=on</code></p><p><code>timer=off</code></p></td><td>Show/hide the meeting timer.</td></tr><tr><td><code>toolbarDarkText</code></td><td>Sets button icon labels color to black.</td></tr><tr><td><code>toolbarText=on</code><br><code>toolbarText=off</code></td><td>Removes text from labels in the room toolbar.</td></tr><tr><td><p><code>topToolbar=on</code></p><p><code>topToolbar=off</code></p></td><td>Show/hide the entire top toolbar.</td></tr><tr><td><code>video=off</code></td><td>Participant joins the room with camera turned off.</td></tr><tr><td><code>virtualBackgroundUrl=&#x3C;url></code></td><td><p>Specify custom virtual background which should be applied to the local participant.</p><p>The image must be provided in <strong>1280x720</strong> resolution in either <code>image/jpeg</code> or <code>image/png</code> format. In addition, the image should be retrievable using CORS.</p></td></tr></tbody></table>

{% hint style="success" %}
There are additional room customizations and options that can be found in the [URL parameters](/whereby-for-web-browser/web-component-and-pre-built-ui/configuring-with-attributes) section. These options must be added as parameters on the `room` source URL, and are not currently supported as attributes directly on the component.
{% endhint %}

#### Usage examples

{% tabs %}
{% tab title="Room w/ multiple customizations" %}
{% code overflow="wrap" %}

```html
<whereby-embed room="https://subdomain.whereby.com/your_room" displayName="John Smith" audio=off video=off background=off chat=off />
```

{% endcode %}
{% endtab %}

{% tab title="Basic room embed" %}

```html
<whereby-embed room="https://subdomain.whereby.com/your_room" />
```

{% endtab %}

{% tab title="Room w/ minimal UI" %}
{% code overflow="wrap" %}

```html
<whereby-embed room="https://subdomain.whereby.com/your_room" minimal />
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Listening to events

You can listen for events on the `<whereby-embed>` component. The following events are supported:

<table><thead><tr><th width="289.3333333333333">Event type</th><th width="190">Description</th><th>Properties (from "detail")</th></tr></thead><tbody><tr><td><code>ready</code></td><td>Basic dependencies have loaded and the room is ready to be used</td><td>–</td></tr><tr><td><code>grant_device_permission</code></td><td>The local user grants permission to camera and microphone in the pre-call screen</td><td>{ granted: Boolean }</td></tr><tr><td><code>deny_device_permission</code></td><td>The local user denies permission to camera and microphone in the pre-call screen</td><td>{ denied: Boolean }</td></tr><tr><td><code>precall_check_completed</code></td><td>The local user <em>completed</em> the presented pre-call check steps.<br><br>Possible values for all <code>status</code> properties: <code>passed</code> | <code>failed</code>.</td><td><p>{</p><p>status: String,</p><p>steps: {</p><p>camera: { status: String; },</p><p>speaker: { status: String; },</p><p>microphone: { status: String; },</p><p>bandwidth: { status: String; },</p><p>}</p><p>}</p></td></tr><tr><td><code>precall_check_skipped</code></td><td>The local user <em>skipped</em> the presented pre-call check steps</td><td>-</td></tr><tr><td><code>knock</code></td><td>The local user knocks to get into the room</td><td>–</td></tr><tr><td><code>cancel_knock</code></td><td>The local user cancels the knock</td><td>-</td></tr><tr><td><code>join</code></td><td>The local user joins</td><td>–</td></tr><tr><td><code>leave</code></td><td>The local user leaves</td><td>{ removed: Boolean }</td></tr><tr><td><code>meeting_end</code></td><td>A host has ended the meeting via "end meeting for all"</td><td>–</td></tr><tr><td><code>participantupdate</code></td><td>A new participant join/leave</td><td>{ count: Number }</td></tr><tr><td><code>participant_join</code></td><td>A new participant joins the room</td><td><p>{</p><p>participant: {</p><p>metadata: String</p><p>}</p><p>}</p></td></tr><tr><td><code>participant_leave</code></td><td>A participant leaves the room</td><td><p>{</p><p>participant: {</p><p>metadata: String</p><p>}</p><p>}</p></td></tr><tr><td><code>microphone_toggle</code></td><td>The local user toggles the microphone</td><td>{ enabled: Boolean }</td></tr><tr><td><code>camera_toggle</code></td><td>The local user toggles the camera</td><td>{ enabled: Boolean }</td></tr><tr><td><code>chat_toggle</code></td><td>The local user toggles the chat</td><td>{ open: Boolean }</td></tr><tr><td><code>people_toggle</code></td><td>The local user toggles the people pane</td><td>{ open: Boolean }</td></tr><tr><td><code>pip_toggle</code></td><td>The local user toggles Picture-in-Picture mode</td><td>{ open: Boolean }</td></tr><tr><td><code>screenshare_toggle</code></td><td>The local user toggles the screenshare</td><td>{ enabled: Boolean }</td></tr><tr><td><code>streaming_status_change</code></td><td>Streaming status changes.<br><br>Possible values: <code>requested</code> | <code>starting</code> | <code>streaming</code> | <code>stopping</code> | <code>stopped</code></td><td>{ status: String }</td></tr><tr><td><code>recording_status_change</code></td><td>Recording status changes.<br><br>Possible values: <code>starting</code> | <code>started</code> | <code>stopped</code></td><td>{ status: String }</td></tr><tr><td><code>transcription_status_change</code></td><td>Transcription status changes.<br><br>Possible values: <code>starting</code> | <code>started</code> | <code>stopped</code></td><td>{ status: String }</td></tr><tr><td><code>connection_status_change</code></td><td>User connection status changes.<br><br>Possible values: <code>stable</code> | <code>unstable</code></td><td>{ status: String }</td></tr><tr><td><code>audio_only_mode_status_change</code></td><td>Audio-only mode is turned on or off for the local user.<br><br>Possible values: <code>true</code> (enabled) | <code>false</code> (disabled)</td><td>Boolean</td></tr></tbody></table>

You can use standard JavaScript to listen to the events. Here's an example:

```javascript
  const elm = document.querySelector("whereby-embed");
  let output = "";

  function logEvent(event) {
    output = `got event ${JSON.stringify({ type: event.type, detail: event.detail })}\n`;
    console.log(output)
  }
  elm.addEventListener("ready", logEvent)
  elm.addEventListener("precall_check_skipped", logEvent)
  elm.addEventListener("precall_check_completed", logEvent)
  elm.addEventListener("knock", logEvent)
  elm.addEventListener("participantupdate", logEvent)
  elm.addEventListener("join", logEvent)
  elm.addEventListener("leave", logEvent)
  elm.addEventListener("participant_join", logEvent)
  elm.addEventListener("participant_leave", logEvent)
  elm.addEventListener("microphone_toggle", logEvent)
  elm.addEventListener("camera_toggle", logEvent)
  elm.addEventListener("chat_toggle", logEvent)
  elm.addEventListener("people_toggle", logEvent)
  elm.addEventListener("pip_toggle", logEvent)
  elm.addEventListener("deny_device_permission", logEvent)
  elm.addEventListener("screenshare_toggle", logEvent)
  elm.addEventListener("streaming_status_change", logEvent)
  elm.addEventListener("connection_status_change", logEvent)
  elm.addEventListener("audio_only_mode_status_change", logEvent)
```

Example output:

```javascript
got event {"type":"ready","detail":null}
got event {"type":"deny_device_permission","detail":{"denied":false}}
got event {"type":"precall_check_completed","detail":{"status":"failed",steps: {"camera":"passed","speaker":"failed","microphone":"failed","bandwidth":"passed"}}}
got event {"type":"join","detail":null}
got event {"type":"participant_join","detail":{"metadata":"userId"}}
got event {"type":"participantupdate","detail":{"count":2}}
got event {"type":"participant_leave","detail":{"metadata":"userId"}}
got event {"type":"participantupdate","detail":{"count":1}}
got event {"type":"streaming_status_change","detail":{"status":"starting"}}
got event {"type":"connection_status_change","detail":{"status":"unstable"}}
got event {"type":"audio_only_mode_status_change","detail":true}
got event {"type":"leave","detail":{"removed":false}}
```

### Sending commands <a href="#sending-commands" id="sending-commands"></a>

{% hint style="warning" %}
For this feature to work, you must add the origin of your application to the "[Allowed domains](/further-resources/faq-and-troubleshooting/allowed-domains-and-localhost)" section in your Whereby account. If not present, the following methods will not do anything.
{% endhint %}

The `<whereby-embed>` component exposes a set of methods your application can invoke to perform actions in the room. Currently, the following methods are available:

| Method                                            | Description                                                                                                                                                                                                                                                                                                     |
| ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `endMeeting()`                                    | End meeting for all on behalf of the local user, who needs to be a host in the room.                                                                                                                                                                                                                            |
| `knock()`                                         | Knock on a locker room, on behalf of the local user.                                                                                                                                                                                                                                                            |
| `cancelKnock()`                                   | Cancel the knock, on behalf of the local user.                                                                                                                                                                                                                                                                  |
| `leaveRoom()`                                     | Allows local user to leave the room.                                                                                                                                                                                                                                                                            |
| `startRecording()`                                | Start cloud recording on behalf of the local user, who needs to be a host in the room.                                                                                                                                                                                                                          |
| `stopRecording()`                                 | Stop cloud recording on behalf of the local user, who needs to be a host in the room.                                                                                                                                                                                                                           |
| `startStreaming()`                                | Start streaming on behalf of the local user, who needs to be a host in the room.                                                                                                                                                                                                                                |
| `stopStreaming()`                                 | Stop streaming on behalf of the local user, who needs to be a host in the room.                                                                                                                                                                                                                                 |
| `startLiveTranscription()`                        | Start live transcription on behalf of the local user, who needs to be a host in the room.                                                                                                                                                                                                                       |
| `stopLiveTranscription()`                         | Stop live transcription on behalf of the local user, who needs to be a host in the room.                                                                                                                                                                                                                        |
| `toggleCamera([true \| false])`                   | Toggle the local user's camera on or off. Without any arguments, it toggles depending on current state.                                                                                                                                                                                                         |
| `toggleMicrophone([true \| false])`               | Toggle the local user's microphone on or off. Without any arguments, it toggles depending on current state.                                                                                                                                                                                                     |
| `toggleScreenshare([true \| false])`              | Toggle the local user's screenshare on or off. Without any arguments, it toggles depending on current state.                                                                                                                                                                                                    |
| `toggleChat([true \| false])`                     | Toggle the local user's chat open or closed. Without any arguments, it toggles depending on current state.                                                                                                                                                                                                      |
| `toggleAudioOnlyMode([true \| false], [options])` | Turn audio-only mode on or off for the local user. While on, all incoming video is paused and only audio is received. Without any arguments, it toggles depending on current state. `options.autoDisableLocalCamera` (default `true`) also turns off the local user's camera when audio-only mode is turned on. |

Here is a small example showing uses of these methods:

```javascript
const room = document.querySelector("whereby-embed");
room.startRecording(); // Start cloud recording
room.stopRecording(); // Stop cloud recording
room.startStreaming(); // Start streaming
room.stopStreaming(); // Stop streaming
room.startLiveTranscription(); // Start live transcription
room.stopLiveTranscription(); // Stop live transcription
room.toggleCamera(); // Camera will be turned on if off, and off if on
room.toggleMicrophone(); // Microphone will be turned on if off, and off if on
room.toggleScreenshare(); // Screenshare will be turned on if off, and off if on
room.toggleChat(); // Chat will be opened if on, and closed if off
room.toggleCamera(true); // Turn camera on
room.toggleMicrophone(true); // Turn microphone on
room.toggleScreenshare(true); // Turn screenshare on
room.toggleCamera(false); // Turn camera off
room.toggleMicrophone(false); // Turn microphone off
room.toggleScreenshare(false); // Turn screenshare off
room.toggleAudioOnlyMode(); // Audio-only mode will be turned on if off, and off if on
room.toggleAudioOnlyMode(true); // Turn audio-only mode on (also turns the camera off)
room.toggleAudioOnlyMode(true, { autoDisableLocalCamera: false }); // Turn audio-only mode on and keep the camera on
room.toggleAudioOnlyMode(false); // Turn audio-only mode off
```


# Core SDK Reference

The **Whereby Core SDK** is the low-level foundation of the Whereby SDK. It exposes a set of containers, actions, and client classes for working with local media and room connections. It's used to power the [Whereby Browser SDK,](/whereby-for-web-browser/react-based-browser-sdk/quick-start) [Whereby Assistants](/reference/assistant-sdk-reference/api-reference/assistant),[ React Native](/reference/react-native-reference) and other forms of Whereby meetings. It also contains utils which may be useful in custom experiences.

### Audience

Core is designed for developers who need fine-grained control over the Whereby experience. It is best suited if you:

* Are building a custom video UI from scratch (not using React or our higher level components)
* Need to integrate Whereby into a non-React environment or a framework of your choice
* Want direct access to connection, media and layout state
* Are working on advanced use cases such as automation or headless integrations where you want to orchestrate media yourself at a lower level

For most web applications, we recommend starting with our higher level [`@whereby.com/browser-sdk`](/whereby-for-web-browser/react-based-browser-sdk/quick-start) , or if you can [`@whereby.com/assistant`](/reference/assistant-sdk-reference/api-reference/assistant) to create custom bots that might work for your use case. Reach for `@whereby.com/core` when you need deeper controls.

### Use Cases

* Implementing a **custom meeting UI** that renders participants with your own layout engine
* Running **automated tests** or **headless monitoring** clients with fine control over media state
* Building **framework integrations** (e.g. Vue, Svelte, Angular) on top of Whereby's primitives
* Experimenting with **advanced media workflows** like custom device selection

### Requirements

The Core SDK is intended for **browser environments** and requires access to browser APIs:

* `navigator.mediaDevices` (to request camera/microphone)
* `MediaStream` and `MediaTrack`
* `RTCPeerConnection` (WebRTC signaling and transport).

It can also be used in Node.js if you provide compatible polyfills for the necessary Media and WebRTC APIs. However, if you're considering using Node.js we would recommend checking out our [Assistant SDK](/reference/assistant-sdk-reference/api-reference/assistant) that handles this for you!

## Getting started

### Installation

Install the `@whereby.com/core` package from the public[ npm registry.](https://www.npmjs.com/package/@whereby.com/core)

{% tabs %}
{% tab title="npm" %}

```bash
npm install @whereby.com/core
```

{% endtab %}

{% tab title="yarn" %}

```bash
yarn add @whereby.com/core
```

{% endtab %}

{% tab title="pnpm" %}

```bash
pnpm add @whereby.com/core
```

{% endtab %}
{% endtabs %}


# Quick Start

The following code snippets show a basic example of using the core sdk to join and leave a room.

1. Create client

```jsx
import { WherebyClient } from "@whereby.com/core";

const client = new WherebyClient();
const roomConnection = client.getRoomConnection();
const localMedia = client.getLocalMedia();
```

2. Join room

```jsx
 type JoinRoomOptions = {
	 roomUrl: string;
	 audio?: boolean;
	 video?: boolean;
 }
 
 async function joinRoom({roomUrl, audio = false, video = false}: JoinRoomOptions) {
 
 /** If sending media, you need to start local media before initialising, for example: 
        async function startLocalMedia(stream: MediaStream) {
	await localMedia.startMedia(stream);
		}
 **/
        roomConnection.initialize({
            localMediaOptions: {
                audio,
                video,
            },
            roomUrl,
        });
        
        try {
            await roomConnection.joinRoom();
        } catch(error) {
            console.error("Could not join room", error);
            return;
        }
   }
```

3. Subscribe to remote participants

```jsx
import { RemoteParticipantState } from "@whereby.com/core"

public subscribeToRemoteParticipants(callback: (participants: RemoteParticpantState) => void): () => void {
        return roomConnection.subscribeToRemoteParticipants(callback);
    }
```

4. Minimal sample: Join for 10 seconds and then leave

```javascript
import { WherebyClient, RemoteParticipantState } from "@whereby.com/core";

const client = new WherebyClient();
const roomConnection = client.getRoomConnection();
const localMedia = client.getLocalMedia();

function subscribeToRemoteParticipants(
  callback: (participants: RemoteParticipantState[]) => void
) {
  return roomConnection.subscribeToRemoteParticipants(callback);
}

async function main(roomUrl: string) {

  // start media here if passing in a stream
  roomConnection.initialize({
    localMediaOptions: { audio: false, video: false },
    roomUrl,
  });
  
  try {
    await roomConnection.joinRoom();
  } catch(error) {
    console.error("Could not join room", error);
    return;
  }       

  const unsubscribe = subscribeToRemoteParticipants((participants) => {
    console.log(
      "Participants",
      participants.map((p) => ({
        id: p.id,
        displayName: p.displayName,
      }))
    );
  });

  setTimeout(async () => {
    unsubscribe?.();
    await roomConnection.leaveRoom();
    await localMedia.stopMedia?.();
    console.log("Left room");
 
  }, 10000);
}
```

This demonstrates the most basic functionality of the library. From this example, you can go on to implement more advanced functionality that is explained in more detail in the next sections of the documentation:

* [API Reference](/reference/core-sdk-reference/api-reference)


# API Reference

The WherebyClient is the entry point for this API. Construct it once, and then you can retrieve each of the sub-clients.

```jsx
import { WherebyClient } from "@whereby.com/core";

const client = new WherebyClient();
const localMedia = client.getLocalMedia();
const roomConnection = client.getRoomConnection();
```

### Clients

{% content-ref url="/pages/QSj03KWJGgzAATRrqJd7" %}
[WherebyClient](/reference/core-sdk-reference/api-reference/wherebyclient)
{% endcontent-ref %}

{% content-ref url="/pages/d2ykTQWKdTdY11Mnx7VM" %}
[LocalMediaClient](/reference/core-sdk-reference/api-reference/localmediaclient)
{% endcontent-ref %}

{% content-ref url="/pages/WGL3fF0jbdomGjoT0oC4" %}
[RoomConnectionClient](/reference/core-sdk-reference/api-reference/roomconnectionclient)
{% endcontent-ref %}


# WherebyClient

```jsx
import { WherebyClient } from "@whereby.com/core";

const client = new WherebyClient();
```

The WherebyClient is the main entry point for the Core SDK. It acts as a wrapper around the underlying state store and service layer, and gives you access to the specialized client classes.

Creating a WherebyClient automatically sets up the internal store and services. From there, you can retrieve the specific clients you need:

* LocalMediaClient → manage camera and microphone
* RoomConnectionClient → join/leave rooms, subscribe to remote participants, any in room actions

### Methods

| Method                | Returns                | Description                                                                                                            |
| --------------------- | ---------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `new WherebyClient()` | `WherebyClient`        | Creates a new client instance with it’s own store and sub-clients. Construct once per session.                         |
| `getLocalMedia()`     | `LocalMediaClient`     | Manages local media streams. Use to start/stop local media and toggle tracks.                                          |
| `getRoomConnection()` | `RoomConnectionClient` | Manages and observes the room connection lifecycle. Use to initialize, join room and subscribe to remote participants. |
| `destroy()`           | `void`                 | Destroy all sub-clients and release resources. Always ccll at teardown to unsubscribe and clean up.                    |


# LocalMediaClient

<pre class="language-jsx"><code class="lang-jsx"><strong>const localMedia = client.getLocalMedia();
</strong></code></pre>

LocalMediaClient manages the local audio/video streams and state of a client. It exposes state subscriptions and provides actions to manage media and devices. If you want the client to join the session with media, you should start local media before joining the room. Local media is retrieved from the WherebyClient.

## Utilities

| Method     | Returns                                                                                   | Description                            |
| ---------- | ----------------------------------------------------------------------------------------- | -------------------------------------- |
| `getState` | [`LocalMediaState`](/reference/core-sdk-reference/types/localmedia-types#localmediastate) | Returns the entire local media state   |
| `destroy`  | `void`                                                                                    | Destroy the LocalMediaClient instance. |

## State Subscriptions

All subscribe methods follow this format:

* Call signature: `subscribeX(callback: (payload: T) => void: () => void`
* Contract: Invokes a callback on initial subscription and whenever the state changes.
* Returns: an unsubscribe function

### Methods

<table><thead><tr><th width="278.92578125">Method</th><th width="214.03643798828125">Payload Type</th><th>Description</th></tr></thead><tbody><tr><td><code>subscribeCameraDeviceError</code></td><td><code>error: unknown | null</code></td><td>Emits local camera device error if detected</td></tr><tr><td><code>subscribeCameraDevices</code></td><td><code>cameraDevices:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#mediadeviceinfo"><code>MediaDeviceInfo</code></a></td><td>Emits the local camera devices</td></tr><tr><td><code>subscribeIsSettingCameraDevice</code></td><td><code>isSetting: boolean</code></td><td>Emits true or false when the local camera device is being set</td></tr><tr><td><code>subscribeIsSettingMicrophoneDevice</code></td><td><code>isSetting: boolean</code></td><td>Emits true or false when the local microphone device is being set</td></tr><tr><td><code>subscribeMicrophoneDeviceError</code></td><td><code>error: unknown | null</code></td><td>Emits local microphone device error if detected</td></tr><tr><td><code>subscribeMicrophoneDevices</code></td><td><code>microphoneDevices:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#mediadeviceinfo"><code>MediaDeviceInfo</code></a></td><td>Emits the local microphone devices</td></tr><tr><td><code>subscribeSpeakerDevices</code></td><td><code>speakerDevices:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#mediadeviceinfo"><code>MediaDeviceInfo</code></a></td><td>Emits the local speaker devices</td></tr><tr><td><code>subscribeCurrentCamera</code></td><td><code>cameraId?: string</code></td><td>Emits the cameraId of the currently selected camera device</td></tr><tr><td><code>subscribeCurrentMicrophone</code></td><td><code>microphoneId?: string</code></td><td>Emits the cameraId of the currently selected microphone device</td></tr><tr><td><code>subscribeCurrentSpeaker</code></td><td><code>speakerId?: string</code></td><td>Emits the cameraId of the currently selected speaker device</td></tr><tr><td><code>subscribeLocalMediaStarting</code></td><td><code>starting: boolean</code></td><td>Emits true or false whether the localMedia is starting</td></tr><tr><td><code>subscribeLocalStream</code></td><td><code>stream?:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#mediastream"><code>MediaStream</code></a></td><td>Emits the local media stream</td></tr><tr><td><code>subscribeLocalMediaStartError</code></td><td><code>error: unknown | null</code></td><td>Emits any local media starting errors</td></tr></tbody></table>

## Actions

<table><thead><tr><th width="198.0390625">Method</th><th width="199.00909423828125">Parameters</th><th>Returns</th><th>Description</th></tr></thead><tbody><tr><td><code>startMedia</code></td><td><code>options:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#localmediaoptions-less-than-object-greater-than"><code>LocalMediaOptions</code></a> <code>| MediaStream</code><br><em><code>(default { audio: true, video: true })</code></em></td><td><code>Promise&#x3C;void></code></td><td>Initializes local media (mic/camera). Pass constraints or an existing <a href="/reference/core-sdk-reference/types/roomconnection-types#mediastream"><code>MediaStream</code></a>.</td></tr><tr><td><code>toggleCamera</code></td><td><code>(enabled?: boolean)</code></td><td><code>void</code></td><td>Enables / disabled camera</td></tr><tr><td><code>toggleMicrophone</code></td><td><code>(enabled?: boolean)</code></td><td><code>void</code></td><td>Enables / disables microphone</td></tr><tr><td><code>toggleHdMode</code></td><td><code>(enabled?: boolean)</code></td><td><code>void</code></td><td>Enables / disables high-definition (hd) video mode. Default: <code>true</code></td></tr><tr><td><code>toggleLowDataMode</code></td><td><code>(enabled?: boolean)</code></td><td><code>void</code></td><td>Enables / disables low data mode</td></tr><tr><td><code>toggleWidescreenMode</code></td><td><code>(enabled?: boolean)</code></td><td><code>void</code></td><td>Enables / disables widescreen video mode. Default: <code>true</code></td></tr><tr><td><code>setCameraDevice</code></td><td><code>(deviceId: string)</code></td><td><code>void</code></td><td>Set the camera device to the specified deviceId</td></tr><tr><td><code>setMicrophoneDevice</code></td><td><code>(deviceId: string)</code></td><td><code>void</code></td><td>Set the microphone device to the specified deviceId</td></tr><tr><td><code>setSpeakerDevice</code></td><td><code>(deviceId: string)</code></td><td><code>void</code></td><td>Set the speaker device to the specified deviceId</td></tr><tr><td><code>stopMedia</code></td><td></td><td><code>void</code></td><td>Stops local media</td></tr></tbody></table>

## Events

`LocalMediaClient` extends `EventEmitter` . You can listen to lifecycle and state change events directly:

```jsx
import { LOCAL_STREAM_CHANGED } from "@whereby.com/core";

const localMedia = client.getLocalMedia();

function localMediaChanged(stream: MediaStream) {
    console.log("Local media has changed", stream);
}

localMedia.on(LOCAL_STREAM_CHANGED, localMediaChanged);
```

#### LocalMediaEvents

<table data-full-width="false"><thead><tr><th width="262.82122802734375">Event (constant)</th><th>Event name (string)</th><th width="208.276123046875">Payload</th><th>Emitted when</th></tr></thead><tbody><tr><td><code>CAMERA_DEVICE_ERROR_CHANGED</code></td><td><code>local-media:camera-device-error-changed</code></td><td><code>error: unknown | null</code></td><td>A camera error occurs</td></tr><tr><td><code>CAMERA_DEVICES_CHANGED</code></td><td><code>ocal-media:camera-devices-changed</code></td><td><code>cameraDevices:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#mediadeviceinfo"><code>MediaDeviceInfo</code></a></td><td>There's a change to camera devices</td></tr><tr><td><code>IS_SETTING_CAMERA_DEVICE</code></td><td><code>local-media:is-setting-camera-device</code></td><td><code>isSetting: boolean</code></td><td>Camera device is being set</td></tr><tr><td><code>IS_SETTING_MICROPHONE_DEVICE</code></td><td><code>local-media:is-setting-microphone-device</code></td><td><code>isSetting: boolean</code></td><td>Microphone device is being set</td></tr><tr><td><code>MICROPHONE_DEVICE_ERROR_CHANGED</code></td><td><code>ocal-media:microphone-device-error-changed</code></td><td><code>error: unknown | null</code></td><td>A microphone error occurs</td></tr><tr><td><code>MICROPHONE_DEVICES_CHANGED</code></td><td><code>ocal-media:microphone-devices-changed</code></td><td><code>microphoneDevices:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#mediadeviceinfo"><code>MediaDeviceInfo</code></a></td><td>There is a change to microphone devices</td></tr><tr><td><code>SPEAKER_DEVICES_CHANGED</code></td><td><code>local-media:speaker-devices-changed</code></td><td><code>speakerDevices:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#mediadeviceinfo"><code>MediaDeviceInfo</code></a></td><td>When there is a change to speaker devices</td></tr><tr><td><code>CURRENT_CAMERA_CHANGED</code></td><td><code>ocal-media:current-camera-changed</code></td><td><code>cameraId?: string</code></td><td>When selected camera is changed</td></tr><tr><td><code>CURRENT_MICROPHONE_CHANGED</code></td><td><code>local-media:current-microphone-changed</code></td><td><code>microphoneId?: string</code></td><td>When selected microphone is changed</td></tr><tr><td><code>CURRENT_SPEAKER_CHANGED</code></td><td><code>local-media:current-speaker-changed</code></td><td><code>speakerId?: string</code></td><td>When selected speaker is changed</td></tr><tr><td><code>LOCAL_MEDIA_STARTING</code></td><td><code>local-media:starting</code></td><td><code>starting: boolean</code></td><td>When local media is starting</td></tr><tr><td><code>LOCAL_STREAM_CHANGED</code></td><td><code>local-media:local-stream-changed</code></td><td><code>stream?: MediaStream</code></td><td>When media stream is changed</td></tr><tr><td><code>LOCAL_MEDIA_START_ERROR_CHANGED</code></td><td><code>ocal-media:start-error-changed</code></td><td><code>error: unknown | null</code></td><td>An error occus when starting local media</td></tr></tbody></table>


# RoomConnectionClient

```jsx
const roomConnection = client.getRoomConnection()
```

RoomConnectionClient manages entire room connection. It exposes state subscriptions and provides actions to manage and observe remoteParticipants and in room actions. Room connection s retrieved from the WherebyClient.

## Utilities

| Method     | Returns               | Description                                |
| ---------- | --------------------- | ------------------------------------------ |
| `getState` | `RoomConnectionState` | Returns the entire room connection state   |
| `destroy`  | `void`                | Destroy the RoomConnectionClient instance. |

## State Subscriptions

All subscribe methods follow this format:

* Call signature: `subscribeX(callback: (payload: T) => void: () => void`
* Contract: Invokes a callback on initial subscription and whenever the state changes.
* Returns: an unsubscribe function

### Methods

<table><thead><tr><th width="266.87677001953125">Method</th><th width="423.48443603515625">Payload Type</th><th>Description</th></tr></thead><tbody><tr><td><code>subscribeToChatMessages</code></td><td><a href="/reference/core-sdk-reference/types/roomconnection-types#chatmessage"><code>ChatMessage</code></a><code>[]</code></td><td>Emits chat messages from remote participants</td></tr><tr><td><code>subscribeToCloudRecording</code></td><td><a href="/reference/core-sdk-reference/types/roomconnection-types#screenshare"><code>CloudRecordingState</code></a> <code>| undefined</code></td><td>Emits cloud recording status</td></tr><tr><td><code>subscribeToBreakoutConfig</code></td><td><a href="/reference/core-sdk-reference/types/roomconnection-types#breakout"><code>BreakoutState</code></a></td><td>Emits breakout config</td></tr><tr><td><code>subscribeToConnectionStatus</code></td><td><a href="/reference/core-sdk-reference/types/roomconnection-types#connectionstatus-less-than-string-greater-than"><code>ConnectionStatus</code></a></td><td>Emits the connection status</td></tr><tr><td><code>subscribeToJoinStage</code></td><td><a href="/reference/core-sdk-reference/types/roomconnection-types#joinroomstage"><code>JoinRoomStage</code></a> <code>| null</code></td><td>Emits the step <code>joinRoom()</code> is waiting on whenever it changes, or <code>null</code> when no join is in progress. Only emits on changes, not on initial subscription. Read the current value from <code>getState().joinStage</code>. See <a href="#join-stage">Join stage</a></td></tr><tr><td><code>subscribeToLiveStream</code></td><td><code>{ status: "streaming" } | undefined</code></td><td>Emits streaming status</td></tr><tr><td><code>subscribeToLiveCaptions</code></td><td><a href="/reference/core-sdk-reference/types/roomconnection-types#screenshare-2"><code>LiveCaptionsState</code></a> <code>| undefined</code></td><td>Emits live captions status</td></tr><tr><td><code>subscribeToLiveTranscription</code></td><td><a href="/reference/core-sdk-reference/types/roomconnection-types#screenshare-1"><code>LiveTranscriptionState</code></a> <code>| undefined</code></td><td>Emits live transcription status</td></tr><tr><td><code>subscribeToLocalScreenshare</code></td><td><a href="/reference/core-sdk-reference/types/roomconnection-types#clientview"><code>LocalScreenshareState</code></a> <code>| undefined</code></td><td>Emits local screenshare status</td></tr><tr><td><code>subscribeToLocalParticipant</code></td><td><a href="/reference/core-sdk-reference/types/roomconnection-types#localparticipantstate-less-than-object-greater-than"><code>LocalParticipantState</code></a></td><td>Emits local participant state</td></tr><tr><td><code>subscribeToRemoteParticipants</code></td><td><a href="/reference/core-sdk-reference/types/roomconnection-types#remoteparticipantstate-less-than-object-greater-than"><code>RemoteParticipantState</code></a><code>[]</code></td><td>Emits the remote participant state</td></tr><tr><td><code>subscribeToScreenshares</code></td><td><a href="/reference/core-sdk-reference/types/roomconnection-types#screenshare-2"><code>ScreenshareState</code></a><code>[]</code></td><td>Emits screenshare state</td></tr><tr><td><code>subscribeToWaitingParticipants</code></td><td><a href="/reference/core-sdk-reference/types/roomconnection-types#waitingparticipantstate-less-than-object-greater-than"><code>WaitingParticipantState</code></a><code>[]</code></td><td>Emits waiting participants</td></tr><tr><td><code>subscribeToSpotlightedParticipants</code></td><td><a href="/reference/core-sdk-reference/types/roomconnection-types#clientview"><code>ClientView</code></a><code>[]</code></td><td>Emits spotlighted participants</td></tr><tr><td><code>subscribeToAudioOnlyMode</code></td><td><code>boolean</code></td><td>Emits <code>true</code> when audio-only mode is enabled and <code>false</code> when it is disabled. Only emits on changes, not on initial subscription. Read the current value from <code>getState().isAudioOnlyModeEnabled</code></td></tr><tr><td><code>subscribeToRemoteParticipantQualityReport</code></td><td><a href="/reference/core-sdk-reference/types/roomconnection-types#remoteparticipantqualityreport"><code>RemoteParticipantQualityReport</code></a></td><td>Emits the call quality report for remote participants whenever it changes. Only emits on changes, not on initial subscription. Read the current value from <code>getState().remoteParticipantQualityReport</code>. See <a href="#remote-participant-call-quality">Remote participant call quality</a></td></tr><tr><td><code>subscribeToLocalParticipantQualityReport</code></td><td><a href="/reference/core-sdk-reference/types/roomconnection-types#localparticipantqualityreport"><code>LocalParticipantQualityReport</code></a></td><td>Emits the call quality report for the local participant whenever it changes. Only emits on changes, not on initial subscription. Read the current value from <code>getState().localParticipantQualityReport</code>. See <a href="#local-participant-call-quality">Local participant call quality</a></td></tr><tr><td><code>subscribeToRoomSessionId</code></td><td><code>string | null</code></td><td>Emits<br>the ID of the room's current session whenever it changes, or null when the<br>session ends. A new session starts when a second participant joins and ends<br>when everyone has left. All participants in the same session see the same ID.<br>Only emits on changes, not on initial subscription. Read the current value<br>from <code>getState().roomSessionId</code></td></tr></tbody></table>

{% hint style="info" %}
A host's reply to your knock, the message sent with `holdWaitingParticipant` or `rejectWaitingParticipant`, is not a separate subscription. Read `knockResponse` from `getState()` when `subscribeToConnectionStatus` reports `knock_on_hold` or `knock_rejected`. See `KnockResponse`.
{% endhint %}

## Actions

<table><thead><tr><th width="198.86848958333331">Method</th><th width="146.5767822265625">Parameters</th><th>Returns</th><th>Description</th></tr></thead><tbody><tr><td><code>joinRoom</code></td><td></td><td><code>Promise&#x3C;</code><a href="/reference/core-sdk-reference/types/roomconnection-types#roomjoinedsuccess-less-than-object-greater-than"><code>RoomJoinedSuccess</code></a><code>></code></td><td>Join the room specified in WherebyClientOptions. Rejects if the room can't be joined, with a <a href="/reference/core-sdk-reference/types/roomconnection-types#joinroomerrornames"><code>JoinRoomErrorNames</code></a> value or an error from the server. See <a href="#join-errors">Join errors</a></td></tr><tr><td><a data-footnote-ref href="#user-content-fn-1"><code>knock</code></a></td><td></td><td><code>void</code></td><td>Let the room host know that the local participant is waiting and wants to join</td></tr><tr><td><code>cancelKnock</code></td><td></td><td><code>void</code></td><td>Cancel the knock request</td></tr><tr><td><code>setDisplayName</code></td><td><code>(displayName: string)</code></td><td><code>void</code></td><td>Change your display name</td></tr><tr><td><code>sendChatMessage</code></td><td><code>(text: string, parentId?: string)</code></td><td><code>void</code></td><td><p>Send a chat message to the room.</p><p>If <code>parentId</code> is provided and matches the <code>id</code> of a previously received chat message then the chat message will be sent as a <em>reply</em> to the original chat message.</p></td></tr><tr><td><code>removeChatMessage</code></td><td><code>(id: string, sig?: string | null)</code></td><td><code>void</code></td><td><p>Mark a chat message with <code>removed: true</code> in the rooms state's <code>chatMessages</code>.</p><p>To remove a chat message, a <code>sig</code> provided in a previously sent ChatMessage must be included.</p><p>Hosts can remove any chat message without needing to send any <code>sig.</code></p></td></tr><tr><td><code>toggleCamera</code></td><td><code>(enabled?: boolean)</code></td><td><code>void</code></td><td>Change the state of your camera</td></tr><tr><td><code>toggleMicrophone</code></td><td><code>(enabled?: boolean)</code></td><td><code>void</code></td><td>Change the state of your microphone</td></tr><tr><td><code>toggleHdMode</code></td><td><code>(enabled?: boolean)</code></td><td><code>void</code></td><td>Enables / disables high-definition (hd) video mode. Default: <code>true</code></td></tr><tr><td><code>toggleLowDataMode</code></td><td><code>(enabled?: boolean)</code></td><td><code>void</code></td><td>Change the state of low data mode</td></tr><tr><td><code>toggleAudioOnlyMode</code></td><td><code>(enabled?: boolean, options?:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#toggleaudioonlymodeoptions"><code>ToggleAudioOnlyModeOptions</code></a><code>)</code></td><td><code>void</code></td><td>Enables / disables audio-only mode. While enabled, all incoming video is paused and only audio is received. Omitting <code>enabled</code> toggles the current state. See <a href="#audio-only-mode">Audio-only mode</a></td></tr><tr><td><code>toggleWidescreenMode</code></td><td><code>(enabled?: boolean)</code></td><td><code>void</code></td><td>Enables / disables widescreen video mode. Default: <code>true</code></td></tr><tr><td><code>toggleRaiseHand</code></td><td><code>(enabled?: boolean)</code></td><td><code>void</code></td><td>Toggle raising and lowering your hand in the meeting. Any host in the meeting can acknowledge your request with the <code>askToSpeak</code> host action.</td></tr><tr><td><code>startScreenshare</code></td><td></td><td><code>void</code></td><td>Start screen share</td></tr><tr><td><code>stopScreenshare</code></td><td></td><td><code>void</code></td><td>Stop screen share</td></tr><tr><td><code>leaveRoom</code></td><td></td><td><code>void</code></td><td>Leave the room</td></tr><tr><td><code>joinBreakoutGroup</code></td><td><code>(group: string)</code></td><td><code>void</code></td><td>Join a breakout group.</td></tr><tr><td><code>joinBreakoutMainRoom</code></td><td></td><td><code>void</code></td><td>Join the main room in a breakout session.</td></tr><tr><td><code>switchCameraEffect</code></td><td><code>(effectId: string)</code></td><td><code>void</code></td><td>Enable a camera effect.</td></tr><tr><td><code>clearCameraEffect</code></td><td></td><td><code>void</code></td><td>Disable a camera effect.</td></tr><tr><td><code>enableAudioDenoiser</code></td><td></td><td><code>void</code></td><td>Enable noise suppression on the local microphone stream. Automatically re-applied if the microphone device is later switched. Use <code>isAudioDenoiserSupported()</code> to check browser support first.</td></tr><tr><td><code>disableAudioDenoiser</code></td><td></td><td><code>void</code></td><td>Disable noise suppression on the local microphone stream.</td></tr><tr><td><code>startLiveCaptions</code></td><td></td><td><code>void</code></td><td>Start live captions for local participant only (if enabled for room)</td></tr><tr><td><code>stopLiveCaptions</code></td><td></td><td><code>void</code></td><td>Stop live captions for local participant only (if enabled for room)</td></tr></tbody></table>

### Join stage

`joinStage` in the room connection state is the step `joinRoom()` is waiting on, such as `"organization"` or `"signal_connect"`, or `null` when no join is in progress. Use it to show users what a slow join is waiting for, or to give up on a join that stalls. See [`JoinRoomStage`](/reference/core-sdk-reference/types/roomconnection-types#joinroomstage) for the stages.

The SDK has no join timeout of its own. To add one, start a timer when the stage changes, and call `leaveRoom()` when it runs out. `joinRoom()` then rejects with `"join_cancelled"`, and the stage you gave up on tells you which step stalled.

```javascript
import { WherebyClient } from "@whereby.com/core";

const client = new WherebyClient();
const roomConnection = client.getRoomConnection();

// Give up when the join stays on one stage for 15 seconds
let stalledStage = null;
let timer;
const unsubscribe = roomConnection.subscribeToJoinStage((joinStage) => {
    clearTimeout(timer);
    if (!joinStage) return;

    timer = setTimeout(() => {
        stalledStage = joinStage;
        roomConnection.leaveRoom();
    }, 15000);
});

try {
    await roomConnection.joinRoom();
} catch (error) {
    if (error === "join_cancelled" && stalledStage) {
        console.error(`Gave up joining the room, stalled at ${stalledStage}`);
    }
} finally {
    clearTimeout(timer);
    unsubscribe();
}
```

You can also read the stage with `getState().joinStage`, or listen for the `connection:join-stage-changed` event (`CONNECTION_JOIN_STAGE_CHANGED`).

{% hint style="info" %}
`joinStage` is `null` before `joinRoom()` is called, once the room is joined, after the join fails or is left, and while knocking on a locked room, so a timer like the one above doesn't run while a participant waits for a host. If the connection drops during a join, `joinStage` keeps reporting the stage. Rejoining after a dropped connection doesn't count as a join, so `joinStage` stays `null` while the SDK reconnects.
{% endhint %}

### Join errors

`joinRoom()` rejects with a string when the room can't be joined:

| Error                                           | When                                                                                                                        |
| ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `"organization_fetch_failed"`                   | The organization the room belongs to couldn't be fetched                                                                    |
| `"join_cancelled"`                              | The room was left (`leaveRoom()`, `destroy()`, or being kicked), or `joinRoom()` was called again, before the join finished |
| An error from the server, such as `"room_full"` | The server refused the join                                                                                                 |

If no room URL was set, `joinRoom()` rejects with an `Error` instead. The [`JoinRoomErrorNames`](/reference/core-sdk-reference/types/roomconnection-types#joinroomerrornames) type lists the errors the SDK rejects with itself.

{% hint style="info" %}
When `joinRoom()` is called again before an earlier join finishes, the earlier promise rejects with `"join_cancelled"` and the new join carries on. The `"join_cancelled"` rejection isn't reported as unhandled, so an app that leaves without awaiting the join, for example on unmount, doesn't need to catch it.
{% endhint %}

### Room integrations

`startRoomIntegration`, `stopRoomIntegration` and `updateRoomIntegrationProps` share YouTube videos and Miro boards with the room. See [Room Integrations](/reference/core-sdk-reference/api-reference/roomconnectionclient/room-integrations).

### Audio-only mode

Audio-only mode pauses all incoming video and keeps audio flowing. It matches the "Disable videos" option in the standard Whereby app. Your own camera stays on unless you pass `autoDisableLocalCamera: true`, and it is not turned back on when you disable audio-only mode.

```javascript
import { WherebyClient } from "@whereby.com/core";

const client = new WherebyClient();
const roomConnection = client.getRoomConnection();

// enable audio-only mode (pauses all incoming video) with...
roomConnection.toggleAudioOnlyMode(true);
// or, optionally also turn off the local camera when enabling...
roomConnection.toggleAudioOnlyMode(true, { autoDisableLocalCamera: true });

// later, disable audio-only mode with...
roomConnection.toggleAudioOnlyMode(false);
// or, toggle the current state by omitting the argument...
roomConnection.toggleAudioOnlyMode();

// get notified whenever audio-only mode changes...
roomConnection.subscribeToAudioOnlyMode((isEnabled) => {
    console.log("Audio-only mode enabled:", isEnabled); // true or false
});
```

{% hint style="info" %}
Audio-only mode only affects what you receive. Other participants are not told when you turn it on.
{% endhint %}

### Remote participant call quality

The remote participant quality report gives each remote participant in the room a call quality level of `"ok"`, `"warning"` or `"critical"`. Use it to show a connection quality indicator next to each participant.

```javascript
import { WherebyClient } from "@whereby.com/core";

const client = new WherebyClient();
const roomConnection = client.getRoomConnection();

// Called whenever the report changes. The report is keyed by clientId, with one
// entry for each remote participant in the room (the local participant isn't included).
// It is {} until the first scores arrive, and goes back to {} after leaving.
const unsubscribe = roomConnection.subscribeToRemoteParticipantQualityReport((remoteParticipantQualityReport) => {
    Object.entries(remoteParticipantQualityReport).forEach(([clientId, { quality }]) => {
        // quality is "ok", "warning" or "critical": the worse of the participant's video and audio quality
        console.log(`Call quality status for participant[${clientId}]: ${quality}`);
    });
});

// read the current report at any time...
console.log(roomConnection.getState().remoteParticipantQualityReport);

// stop receiving updates
unsubscribe();
```

{% hint style="info" %}
The report reflects the quality of the media you receive from each remote participant. It is empty (`{}`) until the first quality scores arrive after joining a room, and is reset to empty after leaving.
{% endhint %}

### Local participant call quality

The local participant quality report gives the local participant (you) a call quality level of `"ok"`, `"warning"` or `"critical"`, and a separate CPU level for the local device. Use it to warn users when their own connection or device is struggling.

```javascript
import { WherebyClient } from "@whereby.com/core";

const client = new WherebyClient();
const roomConnection = client.getRoomConnection();

// Called whenever the report changes.
const unsubscribe = roomConnection.subscribeToLocalParticipantQualityReport((localParticipantQualityReport) => {
    console.log(`Call quality status for local client: ${localParticipantQualityReport.quality}`);
    // `cpu` is left out when the browser can't measure CPU pressure (no Compute Pressure API)
    console.log(`CPU status for local client: ${localParticipantQualityReport.cpu ?? "unsupported"}`);
});

// read the current report at any time...
console.log(roomConnection.getState().localParticipantQualityReport);

// stop receiving updates
unsubscribe();
```

`quality` is the worse of the local participant's video and audio quality. `cpu` reflects CPU pressure on the local device, and does not affect `quality`.

{% hint style="info" %}
The report is empty (`{}`) until the first quality score arrives after joining a room, and is reset to empty after leaving. `cpu` is only included in browsers that support the [Compute Pressure API](https://developer.mozilla.org/en-US/docs/Web/API/Compute_Pressure_API) (currently Chromium-based browsers), so a missing `cpu` means it isn't measured, not that it's `"ok"`.
{% endhint %}

## Host-only actions

When a participant provides a valid "host" `roomKey` in the [`RoomConnectionOptions`](https://docs.whereby.com/reference/react-hooks-reference/types#roomconnectionoptions-less-than-object-greater-than) when the RoomConnectionClient is initialized, they will have access to a number of addition host-only actions in rooms:

| Method                       | Parameters                                   | Returns | Description                                                                                                                                                                                                                                                                                                                                    |
| ---------------------------- | -------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `lockRoom`                   | `(locked: boolean)`                          | `void`  | Lock (`true`) or unlock (`false`) the current room                                                                                                                                                                                                                                                                                             |
| `acceptWaitingParticipant`   | `(participantId: string)`                    | `void`  | Accept waiting participant                                                                                                                                                                                                                                                                                                                     |
| `holdWaitingParticipant`     | `(participantId: string, response?: string)` | `void`  | <p>Put a waiting participant on hold, optionally with a message explaining why.<br><br>They stay in the waiting room and in the <code>waitingParticipants</code> list, so they can be accepted or rejected later. Their connection status becomes <code>knock\_on\_hold</code> and the message reaches them as <code>knockResponse</code>.</p> |
| `rejectWaitingParticipant`   | `(participantId: string, response?: string)` | `void`  | Reject a waiting participant, optionally with a message.                                                                                                                                                                                                                                                                                       |
| `askToSpeak`                 | `(participantId: string)`                    | `void`  | <p>Ask the specified remote participant to unmute their microphone and speak in the meeting.</p><p>This is typically useful in response to a <code>toggleRaiseHand</code> request from a participant in the meeting.</p>                                                                                                                       |
| `askToTurnOnCamera`          | `(participantId: string)`                    | `void`  | Ask a participant to turn on their camera                                                                                                                                                                                                                                                                                                      |
| `askToTurnOnScreenshare`     | `(participantId: string)`                    | `void`  | Ask a participant to start screen sharing                                                                                                                                                                                                                                                                                                      |
| `muteParticipants`           | `(participantIds: string[])`                 | `void`  | Mute the specified remote participants                                                                                                                                                                                                                                                                                                         |
| `turnOffParticipantCameras`  | `(participantIds: string[])`                 | `void`  | Turn off the camera of the specificed remote participants                                                                                                                                                                                                                                                                                      |
| `stopParticipantScreenshare` | `(participantId: string)`                    | `void`  | Stop a participants screen share in the meeting                                                                                                                                                                                                                                                                                                |
| `kickParticipant`            | `(participantId: string)`                    | `void`  | Remove the specified remote participant from the meeting                                                                                                                                                                                                                                                                                       |
| `spotlightParticipant`       | `(participantId: string)`                    | `void`  | <p>Put a spotlight on a participant.</p><p>When used in combination with the video grid, the spotlighted participant will move to the presentation stage, and their video cell will be bigger.</p>                                                                                                                                             |
| `removeSpotlight`            | `(participantId: string)`                    | `void`  | Remove spotlight on a participant.                                                                                                                                                                                                                                                                                                             |
| `startCloudRecording`        |                                              | `void`  | Start cloud recording                                                                                                                                                                                                                                                                                                                          |
| `stopCloudRecording`         |                                              | `void`  | Stop cloud recording                                                                                                                                                                                                                                                                                                                           |
| `startLiveTranscription`     |                                              | `void`  | Start live transcription (if enabled for room)                                                                                                                                                                                                                                                                                                 |
| `stopLiveTranscription`      |                                              | `void`  | Stop live transcription (if enabled for room)                                                                                                                                                                                                                                                                                                  |
| `endMeeting`                 | `(stayBehind?: boolean)`                     | `void`  | <p>End the meeting for <em>all</em> remote participants.</p><p>If <code>stayBehind</code> is not provided or is not <code>true</code>, then the local participant will also leave the room</p>                                                                                                                                                 |

### Breakout host actions

These require the host role *and* a group (SFU) room. Check `isAvailable` on the `BreakoutState` before offering breakout controls, and read `error` if an action was refused.

| Method                            | Parameters                                      | Description                                                                                                                                                                                                                                        |
| --------------------------------- | ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `startBreakoutSession`            | `(options: StartBreakoutSessionOptions)`        | Start a breakout session with the given groups, optional participant assignments and session settings                                                                                                                                              |
| `updateBreakoutSession`           | `(options: UpdateBreakoutSessionOptions)`       | Update groups, assignments and/or settings, before or during a session. Only the fields you pass are changed                                                                                                                                       |
| `stopBreakoutSession`             |                                                 | End the session and return participants to the main room                                                                                                                                                                                           |
| `assignBreakoutParticipants`      | `(assignments: { [clientId: string]: string })` | <p>Assign participants to groups, as a map of <code>clientId → groupId</code>.<br><br>Merged with the current assignments: participants you leave out keep theirs, and an empty <code>groupId</code> unassigns one.</p>                            |
| `assignAllBreakoutParticipants`   |                                                 | Randomly distribute all remote participants evenly across the groups                                                                                                                                                                               |
| `unassignAllBreakoutParticipants` |                                                 | Clear every group assignment                                                                                                                                                                                                                       |
| `shuffleBreakoutParticipants`     |                                                 | Re-distribute the already-assigned participants randomly. Unassigned participants are left out                                                                                                                                                     |
| `extendBreakoutTimer`             | `(seconds?: number)`                            | Add time to the running timer. Defaults to 60 seconds                                                                                                                                                                                              |
| `stopBreakoutTimer`               |                                                 | Turn the timer off without ending the session                                                                                                                                                                                                      |
| `broadcastToGroups`               | `(participantId: string)`                       | <p>Broadcast a main-room participant into every breakout group, for announcements that should reach all groups at once.<br><br>This spotlights the participant; participants inside a group see them in <code>broadcastingParticipants</code>.</p> |
| `stopBroadcastToGroups`           | `(participantId: string)`                       | Stop broadcasting the participant into the groups                                                                                                                                                                                                  |

## Events

`RoomConnectionClient` extends `EventEmitter` . You can listen to lifecycle and state change events directly:

```jsx
import { REMOTE_PARTICIPANTS_CHANGED } from "@whereby.com/core";

const roomConnection = client.getRoomConnection();

function logChatMessage(message: ChatMessage) {
    console.log("New chat message received", message);
}

roomConnection.on(REMOTE_PARTICIPANTS_CHANGED, logChatMessage);
```

#### RoomConnectionEvents

<table><thead><tr><th width="260.01739501953125">Event (constant)</th><th width="188.490478515625">Event name (string)</th><th width="398.95318603515625">Payload</th><th>Emitted when</th></tr></thead><tbody><tr><td><code>BREAKOUT_CONFIG_CHANGED</code></td><td><code>breakout:config-changed</code></td><td><code>config:</code><a href="/reference/core-sdk-reference/types/roomconnection-types#breakout"><code>BreakoutState</code></a></td><td>Breakout config changes</td></tr><tr><td><code>CHAT_NEW_MESSAGE</code></td><td><code>chat:new-message</code></td><td><code>messages:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#chatmessage"><code>ChatMessage</code></a><code>[]</code></td><td>A new chat message is received</td></tr><tr><td><code>CLOUD_RECORDING_STATUS_CHANGED</code></td><td><code>cloud-recording:status-changed</code></td><td><code>{ status: "requested" | "recording" | "error" }, startedAt?: string, error?: string } | undefined</code></td><td>Cloud recording is started or stopped</td></tr><tr><td><code>CONNECTION_STATUS_CHANGED</code></td><td><code>connection:status-changed</code></td><td><code>status:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#connectionstatus-less-than-string-greater-than"><code>ConnectionStatus</code></a></td><td>There's a change to connection status</td></tr><tr><td><code>CONNECTION_JOIN_STAGE_CHANGED</code></td><td><code>connection:join-stage-changed</code></td><td><code>joinStage:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#joinroomstage"><code>JoinRoomStage</code></a> <code>| null</code></td><td>The step <code>joinRoom()</code> is waiting on changes, or the join ends</td></tr><tr><td><code>LOCAL_PARTICIPANT_CHANGED</code></td><td><code>local-participant:changed</code></td><td><code>participant?:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#localparticipantstate-less-than-object-greater-than"><code>LocalParticipantState</code></a></td><td>There's a change to the local participant state</td></tr><tr><td><code>LOCAL_SCREENSHARE_CHANGED</code></td><td><code>local-screenshare:state-changed</code></td><td><code>status:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#clientview"><code>LocalScreenshareState</code></a></td><td>Local screenshare is started or stopped</td></tr><tr><td><code>LIVE_TRANSCRIPTION_STATUS_CHANGED</code></td><td><code>live-transcription:status-changed</code></td><td><code>status:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#screenshare-1"><code>LiveTranscriptionState</code></a></td><td>Live transcription is started or stopped</td></tr><tr><td><code>LIVE_CAPTIONS_STATUS_CHANGED</code></td><td><code>live-captions:status-changed</code></td><td><code>status:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#screenshare-2"><code>LiveCaptionsState</code></a></td><td>Live captions is started or stopped for local participant</td></tr><tr><td><code>AUDIO_ONLY_MODE_CHANGED</code></td><td><code>audio-only-mode:changed</code></td><td><code>isEnabled: boolean</code></td><td>Audio-only mode is enabled or disabled</td></tr><tr><td><code>REMOTE_PARTICIPANT_QUALITY_REPORT_CHANGED</code></td><td><code>remote-participant-quality-report:changed</code></td><td><code>report:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#remoteparticipantqualityreport"><code>RemoteParticipantQualityReport</code></a></td><td>The call quality of one or more remote participants changes</td></tr><tr><td><code>LOCAL_PARTICIPANT_QUALITY_REPORT_CHANGED</code></td><td><code>local-participant-quality-report:changed</code></td><td><code>report:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#localparticipantqualityreport"><code>LocalParticipantQualityReport</code></a></td><td>The call quality or CPU level of the local participant changes</td></tr><tr><td><code>REMOTE_PARTICIPANTS_CHANGED</code></td><td><code>remote-participants:changed</code></td><td><code>participants:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#remoteparticipantstate-less-than-object-greater-than"><code>RemoteParticipantState</code></a><code>[]</code></td><td>There's a change to the remote participant state</td></tr><tr><td><code>SCREENSHARE_STARTED</code></td><td><code>screenshare:started</code></td><td><code>screenshares:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#screenshare-2"><code>ScreenshareState</code></a><code>[]</code></td><td>Remote screenshare is started or stopped</td></tr><tr><td><code>ROOM_JOINED</code></td><td><code>room:joined</code></td><td><code>room:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#roomjoinedevent-less-than-object-greater-than"><code>RoomJoinedEvent</code></a></td><td>A client joins the room</td></tr><tr><td><code>ROOM_JOINED_ERROR</code></td><td><code>room:joined:error</code></td><td><code>error: RoomJoinedErrors | string</code></td><td>A client leaves the room</td></tr><tr><td><code>WAITING_PARTICIPANT_JOINED</code></td><td><code>waiting-participant:joined</code></td><td><code>participant:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#waitingparticipantstate-less-than-object-greater-than"><code>WaitingParticipantState</code></a></td><td>A client joins the waiting room</td></tr><tr><td><code>WAITING_PARTICIPANT_LEFT</code></td><td><code>waiting-participant:left</code></td><td><code>participantId: string</code></td><td>A client leaves the waiting room</td></tr><tr><td><code>SPOTLIGHT_PARTICIPANT_ADDED</code></td><td><code>spotlight:participant-added</code></td><td><code>particpant:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#clientview"><code>ClientView</code></a></td><td>A client is spotlighted</td></tr><tr><td><code>SPOTLIGHT_PARTICIPANT_REMOVED</code></td><td><code>spotlight:participant-removed</code></td><td><code>participantId: string</code></td><td>A client is removed from the spotlight</td></tr><tr><td><code>STREAMING_STARTED</code></td><td><code>streaming:started</code></td><td><code>streaming:</code> <a href="/reference/core-sdk-reference/types/roomconnection-types#livestreamstate"><code>LiveStreamState</code></a></td><td>Streaming is started</td></tr><tr><td><code>STREAMING_STOPPED</code></td><td><code>streaming:stopped</code></td><td><code>void</code></td><td>Streaming is stopped</td></tr><tr><td><code>ROOM_SESSION_ID_CHANGED</code></td><td><code>room-session-id:changed</code></td><td><code>roomSessionId: string | null</code></td><td>Room session starts or ends</td></tr></tbody></table>

[^1]: `Only needed when the roomConnectionStatus is room_locked`


# File Sharing

Share files with everyone in the room. A file is uploaded and then posted to the room as a chat message, so it appears both in `state.fileUploads` (local upload progress for files **you** send) and on the `file` property of the corresponding `state.chatMessages` entry (for every participant, including the sender).

### Methods

#### `sendFiles(files: File[]): void`

Validate, upload, and share the given files with the room. Invalid files are rejected locally (see Validation); valid files are still uploaded. Only one `sendFiles` request can be in flight at a time. Progress and per-file errors are reflected in `getState().fileUploads`.

```ts
const roomConnection = wherebyClient.getRoomConnection();

roomConnection.sendFiles(files); // files: File[]

const unsubscribe = roomConnection.subscribe((state) => {
    for (const upload of state.fileUploads) {
        console.log(upload.name, upload.status, upload.error);
    }
});
```

#### `downloadFile(file: ChatFileShare): Promise<Blob>`

Download a shared file. Resolves with the file contents as a `Blob`, or rejects if the download fails. Use the `file` property from a chat message.

```ts
const blob = await roomConnection.downloadFile(file); // file: ChatFileShare
const url = URL.createObjectURL(blob);
// ...use `url`, then URL.revokeObjectURL(url)
```

### State

| Field                  | Type                         | Description                                                                     |
| ---------------------- | ---------------------------- | ------------------------------------------------------------------------------- |
| `fileUploads`          | `FileUpload[]`               | The files you have shared this session, with per-file upload status.            |
| `chatMessages[n].file` | `ChatFileShare \| undefined` | Present on chat messages that carry a shared file. Pass this to `downloadFile`. |

#### `FileUpload`

```ts
interface FileUpload {
    id: string;
    name: string;
    size: number;
    type: string;
    status: "uploading" | "sent" | "error";
    error?: FileShareError;
}
```

#### `ChatFileShare`

```ts
interface ChatFileShare {
    downloadUrl: string;
    name: string;
    size: number;
    type: string;
    key: string;
    id?: string;
}
```

#### `FileShareError`

```ts
type FileShareError =
    | "file_sharing_not_available" // file sharing is not available for this room
    | "file_sharing_not_enabled"   // file sharing is disabled for this room
    | "not_in_a_room_session"      // no active room session to share into
    | "upload_failed"              // the upload to storage failed
    | "too_many_files"             // more than MAX_FILES_PER_UPLOAD files in one call
    | "unsupported_file_type"      // file type is not in ACCEPTED_FILE_TYPES
    | "file_too_large";            // file exceeds MAX_FILE_SIZE
```

### Validation

`sendFiles` validates files on the client before uploading, mirroring the limits the backend enforces, so failures surface immediately in `fileUploads`:

* **More than `MAX_FILES_PER_UPLOAD` (10) files in a single call** fails the whole batch — every file is marked `status: "error"` with `error: "too_many_files"` and nothing is uploaded.
* Otherwise, each file is checked individually. A file whose type is not in `ACCEPTED_FILE_TYPES` is marked `unsupported_file_type`, and a file larger than `MAX_FILE_SIZE` is marked `file_too_large`. **Rejected files are skipped; the remaining valid files are still uploaded and shared.**

#### Exported constants

Re-exported from `@whereby.com/core` so you can validate before calling `sendFiles`:

```ts
import { MAX_FILES_PER_UPLOAD, MAX_FILE_SIZE, ACCEPTED_FILE_TYPES } from "@whereby.com/core";
```

| Constant               | Value                      | Description                                   |
| ---------------------- | -------------------------- | --------------------------------------------- |
| `MAX_FILES_PER_UPLOAD` | `10`                       | Maximum number of files per `sendFiles` call. |
| `MAX_FILE_SIZE`        | `15728640` (15 MB)         | Maximum size, in bytes, of a single file.     |
| `ACCEPTED_FILE_TYPES`  | `Record<string, string[]>` | Map of accepted MIME type to file extensions. |

**Supported formats:** `.doc`, `.docx`, `.pdf`, `.rtf`, `.xlsx`, `.csv`, `.txt`, `.mp3`, `.wav`, `.gif`, `.jpg`, `.jpeg`, `.png`, `.webp`, `.mp4`, `.mov`, `.webm`, `.mkv`.


# Room Integrations

Share a YouTube video or a Miro board with everyone in the room. One participant starts the share, the server broadcasts it, and it appears in `state.roomIntegrations.running` for everyone in the room, or in the current breakout group.

{% hint style="info" %}
**TODO:** add the `@whereby.com/core` version that ships room integrations before publishing.
{% endhint %}

The methods on this page start, stop and update sessions. To show a running session, render an iframe and speak the [room integration iframe protocol](/reference/core-sdk-reference/api-reference/room-integration-iframe-protocol). For a full example without React, see [Room integrations without React](/whereby-for-web-browser/react-based-browser-sdk/room-integrations-without-react).

### Methods

All three methods need a connected room. Called before that, they log a warning and do nothing. None of them return anything. Watch `getState().roomIntegrations` for the result.

#### `startRoomIntegration(options): void`

```ts
startRoomIntegration(options: {
    roomIntegrationId: string;
    tagName: string;
    shareUrl: string;
    props?: RoomIntegrationProps;
}): void
```

Validate the content and ask the server to share it with the room, or with your breakout group if you're in one. Get `tagName`, `shareUrl` and `props` from the picker (`whereby:formSubmit`) or from [`roomIntegrationContent`](#building-content-without-the-picker).

Local state doesn't change straight away. The server broadcasts the new session to everyone, including you, and then it appears in `roomIntegrations.running`.

```ts
import { roomIntegrationContent } from "@whereby.com/core";

const roomConnection = wherebyClient.getRoomConnection();
const { roomIntegrations } = roomConnection.getState();

const youtube = roomIntegrations.embeddable.find((integration) => integration.name === "youtube");
const content = roomIntegrationContent.youtube({ url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ" });

if (youtube && content) {
    roomConnection.startRoomIntegration({ roomIntegrationId: youtube.roomIntegrationId, ...content });
}
```

#### `stopRoomIntegration(options): void`

```ts
stopRoomIntegration(options: { roomIntegrationSessionId: string; intent?: "stop" | "end" }): void
```

Stop a running session for everyone. Only the participant who started it, or a host, can stop it. Check `session.canStop` first. `intent` defaults to `"stop"`. Pass `"end"` when the user deliberately closed the content, for example after a `whereby:close` message from the content frame.

#### `updateRoomIntegrationProps(options): void`

```ts
updateRoomIntegrationProps(options: { roomIntegrationSessionId: string; props: RoomIntegrationProps }): void
```

Merge `props` into a running session's props and send them to everyone in the room. Call it when the content frame posts `whereby:updateProps`. You rarely need it otherwise.

### State

| Field              | Type                                                                                                      | Description                                                                |
| ------------------ | --------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| `roomIntegrations` | [`RoomIntegrationsState`](/reference/core-sdk-reference/types/roomconnection-types#roomintegrationsstate) | Which integrations the room offers, which are running, and the last error. |

There's no dedicated subscription for room integrations. Use `subscribe` and compare `state.roomIntegrations` with the previous value:

```ts
let previous = roomConnection.getState().roomIntegrations;

roomConnection.subscribe((state) => {
    if (state.roomIntegrations === previous) {
        return;
    }
    previous = state.roomIntegrations;
    renderShareMenu(state.roomIntegrations.embeddable);
    renderRunningIntegrations(state.roomIntegrations.running);
});
```

`GridClient` also has [`subscribeRunningRoomIntegrations`](/reference/core-sdk-reference/api-reference/gridclient) if you only need the running sessions.

#### `RoomIntegrationsState`

```ts
type RoomIntegrationsState = {
    hasFetched: boolean;
    isFetching: boolean;
    error: RoomIntegrationErrorDetail | null;
    enabled: RoomIntegration[];
    embeddable: RoomIntegration[];
    running: RoomIntegrationSessionView[];
};
```

| Field        | Description                                                                                                                                                                                                          |
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `hasFetched` | `true` once the room's list of integrations has loaded. The client fetches it after the room connects. Until then `enabled` and `embeddable` are empty, and `startRoomIntegration` fails with `unknown_integration`. |
| `isFetching` | `true` while that request is in flight.                                                                                                                                                                              |
| `error`      | The last error from a fetch, start, stop or props update. Cleared by the next successful fetch and by the next start or stop that passes the local checks.                                                           |
| `enabled`    | Integrations switched on for this room, including ones that can't run in an SDK app.                                                                                                                                 |
| `embeddable` | The subset of `enabled` that can run in an SDK app. Today that's YouTube and Miro. Offer only these. `startRoomIntegration` doesn't check this flag.                                                                 |
| `running`    | Sessions running in your part of the room. In a breakout group you only see that group's sessions. People who join late receive the running sessions when they join.                                                 |

See [RoomConnection Types](/reference/core-sdk-reference/types/roomconnection-types#roomintegration) for `RoomIntegration`, `RoomIntegrationSessionView` and `RoomIntegrationErrorDetail`.

### Errors

`state.roomIntegrations.error` is `{ code, message }`. Switch on `code`. `message` is for developers.

| `code`                    | Raised by             | Meaning                                                                                                                                                       |
| ------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `unknown_integration`     | SDK, start and stop   | Start: no integration with that `roomIntegrationId`, often because the list hasn't loaded yet. Stop: no running session with that `roomIntegrationSessionId`. |
| `integration_not_enabled` | SDK, start            | The integration exists but isn't switched on for this room.                                                                                                   |
| `invalid_content`         | SDK, start and update | `tagName` isn't a custom element name, `shareUrl` isn't `https`, or `props` isn't a flat object of strings, numbers, booleans and `null`.                     |
| `not_allowed_to_stop`     | SDK, stop             | You didn't start this session and you aren't a host.                                                                                                          |
| `not_in_a_room`           | Server                | The server doesn't consider you a participant in the room.                                                                                                    |
| `forbidden`               | Server                | The server refused the request.                                                                                                                               |
| `missing_parameters`      | Server                | The request was missing a field.                                                                                                                              |
| `invalid_parameters`      | Server                | The request had a field the server didn't accept.                                                                                                             |
| `internal_server_error`   | Server                | The server failed to carry out the request.                                                                                                                   |
| `unknown`                 | SDK or server         | The integration list failed to load, or the server sent an error code the SDK doesn't recognise.                                                              |

### Building content without the picker

`roomIntegrationContent` builds `{ tagName, shareUrl, props }` from a link you already have. It doesn't need a browser, so it also works from Node, for example in an [Assistant](/reference/assistant-sdk-reference).

```ts
import { roomIntegrationContent } from "@whereby.com/core";
```

Both functions return `null` when they can't use the input.

#### `roomIntegrationContent.youtube({ url, startAt?, metadata? }): RoomIntegrationContent | null`

| Option     | Type                                                          | Description                                                                                                                                                                      |
| ---------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `url`      | `string`                                                      | **Required.** A YouTube link or a bare 11-character video id. Accepts `youtube.com/watch?v=`, `youtu.be/`, `/embed/`, `/shorts/` and `/live/` links, and `youtube-nocookie.com`. |
| `startAt`  | `number?`                                                     | Where to start, in seconds. Defaults to the `t=` or `start=` value in the link, or `0`.                                                                                          |
| `metadata` | `{ aspectRatio?: number; isLive?: boolean; title?: string }?` | `aspectRatio` defaults to `16 / 9`. Set `isLive` for live streams.                                                                                                               |

`youtube()` schedules playback to start four seconds after you call it, which gives each participant's frame time to load. Build the content right before you start it.

#### `roomIntegrationContent.miro({ accessLink }): RoomIntegrationContent | null`

`accessLink` must be a Miro embed link, `https://miro.com/app/live-embed/...` from **Share → Embed** in Miro, or `https://miro.com/app/access-link/...` from the Miro board picker. A normal board URL returns `null`, because Miro only renders links its own API generates.

#### `RoomIntegrationContent`

```ts
interface RoomIntegrationContent {
    tagName: string;
    shareUrl: string;
    props: RoomIntegrationProps;
}
```

### Picker helpers

Exported from `@whereby.com/core` for building the picker yourself. The [iframe protocol reference](/reference/core-sdk-reference/api-reference/room-integration-iframe-protocol#picker-frame) explains how they fit together.

| Export                                                                    | Description                                                                                                |
| ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `roomIntegrationPickerUrl({ integration, parentOrigin, featureSource? })` | Returns the URL of the integration's picker page. Only `integration.webview` is read.                      |
| `ROOM_INTEGRATION_PICKER_MESSAGES`                                        | `{ FORM_SUBMIT: "whereby:formSubmit", FORM_CLOSE: "whereby:formClose", ERROR: "whereby:bootstrapError" }`  |
| `RoomIntegrationPickerResult` (type)                                      | `{ tagName: string; shareUrl: string; props: RoomIntegrationProps }`, the payload of `whereby:formSubmit`. |
| `roomIntegrationContentTagName(name)`                                     | The `tagName` for an integration name, for example `"youtube-integration-contentframe"`.                   |


# GridClient

```jsx
const grid = client.getGrid()
```

RoomConnectionClient manages entire room connection. It exposes state subscriptions and provides actions to manage and observe remoteParticipants and in room actions. Room connection s retrieved from the WherebyClient.

## Utilities

| Method     | Returns     | Description                                |
| ---------- | ----------- | ------------------------------------------ |
| `getState` | `GridState` | Returns the entire grid state              |
| `destroy`  | `void`      | Destroy the RoomConnectionClient instance. |

## State Subscriptions

All subscribe methods follow this format:

* Call signature: `subscribeX(callback: (payload: T) => void: () => void`
* Contract: Invokes a callback on initial subscription and whenever the state changes.
* Returns: an unsubscribe function

### Methods

<table><thead><tr><th width="278.92578125">Method</th><th>Payload Type</th><th>Description</th></tr></thead><tbody><tr><td><code>subscribeClientViews</code></td><td><code>clientViews: ClientView[]</code></td><td>Emits client views</td></tr><tr><td><code>subscribeSpotlightedParticipants</code></td><td><code>spotlighted:ClientView[]</code></td><td>Emits spotlighted client views</td></tr><tr><td><code>subscribeNumberOfClientViews</code></td><td><code>num:number</code></td><td>Emits number of client views</td></tr><tr><td><code>subscribeRunningRoomIntegrations</code></td><td><code>sessions: RoomIntegrationSessionView[]</code></td><td>Emits the running <a href="/reference/core-sdk-reference/api-reference/roomconnectionclient/room-integrations">room integrations</a> in the main room or your current breakout group. Only called on changes, so read <code>getState().runningRoomIntegrations</code> for the current value</td></tr></tbody></table>

## Actions

<table><thead><tr><th width="186.70442708333331">Method</th><th width="144.67578125">Parameters</th><th>Returns</th><th>Description</th></tr></thead><tbody><tr><td><code>spotlightParticipant</code></td><td><code>id: string</code></td><td><code>void</code></td><td>Spotlights the specified participant</td></tr><tr><td><code>removeSpotlight</code></td><td><code>id: string</code></td><td><code>void</code></td><td>Removes spotlight on specified participant (if spotlighted)</td></tr></tbody></table>

## Events

`GridClient` extends `EventEmitter` . You can listen to lifecycle and state change events directly:

```jsx
import { NUMBER_OF_CLIENT_VIEWS_CHANGED } from "@whereby.com/core";

const grid = client.getGrid();

function numberOfClientsChanged(numClients: number) {
    console.log("Num of clients changed", numClients);
}

grid.on(NUMBER_OF_CLIENT_VIEWS_CHANGED, numberOfClientsChanged);
```

<table><thead><tr><th>Event (constant)</th><th>Event name (string)</th><th width="205.98529052734375">Payload</th><th>Emitted when</th></tr></thead><tbody><tr><td><code>CLIENT_VIEW_CHANGED</code></td><td><code>grid:client-view-changed</code></td><td><code>clientViews: ClientView[]</code></td><td>Client view changes</td></tr><tr><td><code>CLIENT_VIEW_SPOTLIGHTS_CHANGED</code></td><td><code>grid:client-view-spotlights-changed</code></td><td><code>clientViews: ClientView[]</code></td><td>Client is spotlighted</td></tr><tr><td><code>NUMBER_OF_CLIENT_VIEWS_CHANGED</code></td><td><code>grid:number-of-client-views-changed</code></td><td><code>numClients: number</code></td><td>Number of client views change</td></tr><tr><td><code>RUNNING_ROOM_INTEGRATIONS_CHANGED</code></td><td><code>grid:running-room-integrations-changed</code></td><td><code>sessions: RoomIntegrationSessionView[]</code></td><td>A room integration starts or stops, or anything about a running one changes, such as its props</td></tr></tbody></table>


# Room Integration iframe Protocol

Room integrations run in iframes that Whereby serves from the integration's origin. Your page talks to them with `window.postMessage`. In React, [`useRoomIntegrationPicker`](/reference/react-hooks-reference/useroomintegrationpicker) and [`useRoomIntegrationView`](/reference/react-hooks-reference/useroomintegrationview) handle all of this for you. Read this page if you use `@whereby.com/core` without React, or want to know what the hooks do.

There are two kinds of frame:

* The **picker frame** lets the user choose what to share. It sends back one answer.
* The **content frame** shows a running session. It stays open and keeps sending and receiving messages until the session stops.

Every message, in both directions, has this shape:

```ts
{ type: string; payload?: unknown }
```

## Security rules

Your page and the frames trust each other only through these checks. Skip one and another page or frame can impersonate the integration.

* **Post to the exact origin.** Compute the frame's origin with `new URL(integration.webview).origin` and pass it as the `targetOrigin` of every `postMessage`. Never use `"*"`. The props you send include the session id and the presenter's name.
* **Check `event.origin`.** Ignore any message whose origin isn't the frame's origin.
* **Check `event.source`.** Ignore any message whose `event.source` isn't your iframe's `contentWindow`. Two frames from the same integration share an origin, so the origin check alone can't tell a picker from a content frame, or one YouTube session from another. Read `iframe.contentWindow` when the message arrives rather than saving it earlier. It's `null` until the frame attaches and changes when the frame reloads.
* **Tell the frame your origin.** Both URLs carry a `parentOrigin` query parameter set to `window.location.origin`. The frame posts only to that origin and only accepts messages from it.
* **Don't add `sandbox`.** Some providers open a window to sign the user in, and a sandbox without `allow-popups` blocks it without any error.

## Picker frame

### URL

Build it with `roomIntegrationPickerUrl` from `@whereby.com/core`:

```ts
import { roomIntegrationPickerUrl } from "@whereby.com/core";

const src = roomIntegrationPickerUrl({
    integration, // a RoomIntegration; only `webview` is read
    parentOrigin: window.location.origin,
    featureSource: "my-app", // optional
});
// => <webview>/bootstrap.html?parentOrigin=https%3A%2F%2Fexample.com&featuresource=my-app
```

Use `allow="clipboard-read; clipboard-write; fullscreen"` so users can paste links into it.

### Messages

The picker only sends. It doesn't expect any message from your page. The message types are exported from `@whereby.com/core` as `ROOM_INTEGRATION_PICKER_MESSAGES`:

| Constant      | `type`                   | Payload                                        | Sent when                                                                                                                    |
| ------------- | ------------------------ | ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `FORM_SUBMIT` | `whereby:formSubmit`     | `{ tagName, shareUrl, props, featureSource? }` | The user picked something. Pass `tagName`, `shareUrl` and `props` to `startRoomIntegration`. You can ignore `featureSource`. |
| `FORM_CLOSE`  | `whereby:formClose`      | none                                           | The user closed the picker without choosing.                                                                                 |
| `ERROR`       | `whereby:bootstrapError` | `{ message: string }`                          | The picker page failed to load.                                                                                              |

Treat the first of these as the answer and stop listening. `subscribeToRoomIntegrationPicker` in `@whereby.com/browser-sdk/react` does exactly that, and you can use it without React (see [Room integrations without React](/whereby-for-web-browser/react-based-browser-sdk/room-integrations-without-react)).

## Content frame

### URL

Start from the integration's `webview` URL and add two query parameters:

```ts
const url = new URL(session.integration.webview);
url.searchParams.set("parentOrigin", window.location.origin);
url.searchParams.set("roomintegrationsessionid", session.roomIntegrationSessionId);
const src = url.href;
```

Use `allow="autoplay; fullscreen; encrypted-media; picture-in-picture"`, and add `allowfullscreen`.

### Startup

1. The frame loads and posts `whereby:frameReady`.
2. You reply with `whereby:props`, carrying the session's full props (see [Props you send](#props-you-send)).
3. The frame applies them and renders the content. If it gets no props within 3 seconds, it logs a warning and renders anyway.
4. When the content has loaded, the frame posts `whereby:contentReady`.

The frame posts `whereby:frameReady` once per load. If it reloads, it posts it again, and you send the full props again.

### Frame to your page

| `type`                  | Payload                                                | What to do                                                                                                                                                                                                         |
| ----------------------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `whereby:frameReady`    | none                                                   | Send `whereby:props` with the full props.                                                                                                                                                                          |
| `whereby:updateProps`   | `{ props, roomIntegrationSessionId, breakoutGroupId }` | Call `roomConnection.updateRoomIntegrationProps({ roomIntegrationSessionId: session.roomIntegrationSessionId, props: payload.props })`. Don't apply the props to the frame yourself. They come back from the room. |
| `whereby:contentReady`  | `{ roomIntegrationSessionId, breakoutGroupId }`        | Optional. The content has loaded, so you can hide a loading state.                                                                                                                                                 |
| `whereby:close`         | none                                                   | If `session.canStop` is `true`, call `roomConnection.stopRoomIntegration({ roomIntegrationSessionId, intent: "end" })`. Otherwise ignore it. YouTube sends this when the video ends.                               |
| `whereby:audioOverride` | `{ enabled: boolean \| null }`                         | Optional. The content asks you to change the local microphone. `false` means turn audio input off, `null` means the request is over.                                                                               |
| `whereby:volume`        | `{ requestId: number, volume: number }`                | The answer to a `whereby:getVolume` with the same `requestId`.                                                                                                                                                     |

Use the session id from your own session object, not the one in the payload.

### Your page to the frame

| `type`              | Payload                 | Effect                                                                                                                                                                                               |
| ------------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `whereby:props`     | `RoomIntegrationProps`  | The frame sets each key as an attribute on the content element. It skips keys whose value is `null` or `undefined`. Send the full props after `whereby:frameReady`, then only the keys that changed. |
| `whereby:setVolume` | `{ volume: number }`    | Sets the volume on this device. YouTube takes `0` to `1`.                                                                                                                                            |
| `whereby:getVolume` | `{ requestId: number }` | Asks for the volume. The frame answers with `whereby:volume` and the same `requestId`. Time out if no answer comes. The React hook waits 2 seconds.                                                  |

### Props you send

Send the session's `props`, plus four keys that tell the content who it's running for:

| Key                        | Value                              |
| -------------------------- | ---------------------------------- |
| `ispresenter`              | `session.isPresenter`              |
| `presenterdisplayname`     | `session.presenterDisplayName`     |
| `roomintegrationsessionid` | `session.roomIntegrationSessionId` |
| `breakoutgroupid`          | `session.breakoutGroupId`          |

```ts
function outboundProps(session) {
    return {
        ...session.props,
        ispresenter: session.isPresenter,
        presenterdisplayname: session.presenterDisplayName,
        roomintegrationsessionid: session.roomIntegrationSessionId,
        breakoutgroupid: session.breakoutGroupId,
    };
}
```

YouTube uses `ispresenter` to decide whose play, pause and seek actions are sent to the room.

### Keeping the frame in sync

Whenever the session in the room connection state changes, compute `outboundProps(session)` again, compare it with what you last sent, and post `whereby:props` with only the keys that differ. Don't send anything before `whereby:frameReady`. Reset what you last sent when the frame reloads.

The loop goes like this. The content posts `whereby:updateProps`, you call `updateRoomIntegrationProps`, the server broadcasts the change, the new props show up in `getState().roomIntegrations.running`, and you post the difference to the frame. Every participant's page runs the same loop, so every frame gets the same props.

Moving the iframe element in the DOM, or removing and re-adding it, reloads it. Keep it in one place and change its size and position with CSS.


# Types

{% content-ref url="/pages/EK7z5PY2CLimsHKnaPp1" %}
[LocalMedia Types](/reference/core-sdk-reference/types/localmedia-types)
{% endcontent-ref %}

{% content-ref url="/pages/h4IBf7O7kxaodS3RsTRe" %}
[RoomConnection Types](/reference/core-sdk-reference/types/roomconnection-types)
{% endcontent-ref %}


# LocalMedia Types

## LocalMediaState

| Property                               | Description                                             |
| -------------------------------------- | ------------------------------------------------------- |
| `currentCameraDeviceId?: string`       | ID of the selected camera device                        |
| `currentMicrophoneDeviceId?: string`   | ID of the selected microphone device                    |
| `currentSpeakerDeviceId?: string`      | ID of the selected speaker device                       |
| `cameraDeviceError: unknown`           | If there's an error with the selected camera device     |
| `cameraDevices: MediaDeviceInfo[]`     | List of available camera devices                        |
| `isSettingCameraDevice: boolean`       | True if camera is being set                             |
| `isSettingMicrophoneDevice: boolean`   | True if microphone is being set                         |
| `isStarting: boolean`                  | True if `localMedia` is starting                        |
| `localStream?: MediaStream`            | Local stream of the client                              |
| `microphoneDeviceError: unknown`       | If there's an error with the selected microphone device |
| `microphoneDevices: MediaDeviceInfo[]` | List of available microphone devices                    |
| `speakerDevices: MediaDeviceInfo[]`    | List of available speaker devices                       |
| `startError: unknown`                  | If there's an error starting local media                |


# Grid Types

## GridState

| Property                                                | Description                                                                                                                                                      |
| ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `allClientViews: ClientView[]`                          | List of all client views                                                                                                                                         |
| `spotlightedParticipants: ClientView[]`                 | List of all spotlighted participants                                                                                                                             |
| `numParticipants: number`                               | Number of participants in a session                                                                                                                              |
| `runningRoomIntegrations: RoomIntegrationSessionView[]` | Running [room integrations](/reference/core-sdk-reference/types/roomconnection-types#roomintegrationsessionview) in the main room or your current breakout group |


# RoomConnection Types

### MediaStreamConstraints

{% embed url="<https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#constraints>" %}

### MediaStream

{% embed url="<https://developer.mozilla.org/en-US/docs/Web/API/MediaStream>" %}

### MediaDeviceInfo

{% embed url="<https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo>" %}

## LocalMediaOptions: <mark style="color:green;">\<Object></mark>

| Property        | Description  |
| --------------- | ------------ |
| `audio:boolean` | Enable audio |
| `video:boolean` | Enable video |

## WherebyClientOptions: <mark style="color:green;">\<Object></mark>

| Property                               | Description                                                                                                                 |
| -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `localMediaOptions: localMediaOptions` | Options for starting local media                                                                                            |
| `displayName?: string`                 | Display name of the client                                                                                                  |
| `roomUrl?: string`                     | Room url of the session                                                                                                     |
| `assistantKey?: string \| null`        | If initializing [`Assistant`](/reference/assistant-sdk-reference/api-reference/assistant) the `assistantKey` is required    |
| `roomKey?: string \| null`             | URL of the room to join                                                                                                     |
| `externalId?: string \| null`          | A custom identifier for the participant. Gets saved in Insights data. Supports any **English alphabet characters** `(A-Z)`. |
| `isNodeSDK?: boolean`                  | True if initializing in a Node environment                                                                                  |
| `isAssistant`                          | True if initializing an `Assistant`                                                                                         |

## RemoteParticipantState: <mark style="color:green;">\<Object></mark>

| Property                                  | Description                                                                                                                                                                                                                                                                           |
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `displayName: string`                     | Display name of the remote participant                                                                                                                                                                                                                                                |
| `id: string`                              | <p>Id of the remote</p><p>participant</p>                                                                                                                                                                                                                                             |
| `roleName: string`                        | <p>The role of the local participant. This will be one of the following values:<br><br><code>none</code>, <code>visitor</code>, <code>granted\_visitor</code>, <code>viewer</code>, <code>granted\_viewer</code>, <code>host</code>, <code>recorder</code>, <code>streamer</code></p> |
| `stream?:MediaStream`                     | Stream of the remote participant                                                                                                                                                                                                                                                      |
| `isAudioEnabled:boolean`                  | The remote participant has their camera enabled                                                                                                                                                                                                                                       |
| `isVideoEnabled:boolean`                  | The remote participant has their microphone enabled                                                                                                                                                                                                                                   |
| `isLocalParticipant:boolean`              | For remote participants, this value is always false                                                                                                                                                                                                                                   |
| `presentationStream: MediaStream \| null` | Screenshare stream if the participant is presenting                                                                                                                                                                                                                                   |
| `externalId: string \| null`              | A custom identifier for the participant.                                                                                                                                                                                                                                              |
| `stickyReaction?: StickyReaction`         | Whether the participant has hand raised                                                                                                                                                                                                                                               |
| `isDialIn: boolean`                       | True if participant is a dial in agent                                                                                                                                                                                                                                                |

## WaitingParticipantState: <mark style="color:green;">\<Object></mark>

| Property                       | Description                                         |
| ------------------------------ | --------------------------------------------------- |
| `id: string`                   | Id of the participant in the waiting room           |
| `displayName?: string \| null` | Display name of the participant in the waiting room |

## ChatMessage: <mark style="color:green;">\<Object></mark> <a href="#chatmessage" id="chatmessage"></a>

| Property            | Description                                                                                                                                                                                                                                                                                                           |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id: string`        | Unique identifier for the chat message                                                                                                                                                                                                                                                                                |
| `senderId: string`  | Id of the participant who sent the chat message                                                                                                                                                                                                                                                                       |
| `parentId?: string` | If present, indicates that the chat message is a reply to a chat message whose `id` matches the given `parentId` value here. If not present, then this chat message is not a reply to any other chat message(s) previously received                                                                                   |
| `timestamp: string` | Timestamp of when the message was sent                                                                                                                                                                                                                                                                                |
| `sig?: string`      | If the current participant is the owner of the chat message (i.e. they sent this chat message) then the service will return this property that can be used to e.g. remove this chat message at a later time (see [`removeChatMessage` API)](/reference/core-sdk-reference/api-reference/roomconnectionclient#actions) |
| `text: string`      | Text content of the chat message to be displayed                                                                                                                                                                                                                                                                      |
| `removed: boolean`  | If `true` then this chat message should be considered removed from any ongoing chat display                                                                                                                                                                                                                           |

## LocalScreenshareState: <mark style="color:green;">\<Object></mark> <a href="#clientview" id="clientview"></a>

<table><thead><tr><th width="220.73828125">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>status: "inactive" | "starting" | "active" | "error"</code></td><td>Local screen sharing status</td></tr><tr><td><code>startedAt?: string</code></td><td>If <code>status</code> is <code>"screensharing"</code> then this field will show when the local screen share started. Otherwise this field will be <code>undefined</code>.</td></tr><tr><td><code>error?: string</code></td><td>If <code>status</code> is <code>"error"</code> then this field will provide an error object received from the service. Otherwise this field will be <code>undefined</code>.</td></tr></tbody></table>

## LiveCaption: <mark style="color:green;">\<Object></mark> <a href="#clientview" id="clientview"></a>

<table><thead><tr><th width="380.4270833333333">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>resultId: string</code></td><td>Unique identifier for the current live caption result</td></tr><tr><td><code>participantId: string</code></td><td>Identifier of the participant</td></tr><tr><td><code>text: string</code></td><td>The text content of the live caption result (can be updated until the live caption is finalized)</td></tr><tr><td><code>timestamp: number</code></td><td>Timestamp of when the live caption was received</td></tr></tbody></table>

## ClientView: <mark style="color:green;">\<Object></mark> <a href="#clientview" id="clientview"></a>

A client view can be either a participant or a screenshare.

<table><thead><tr><th width="380.4270833333333">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>id: string</code></td><td>Internal id</td></tr><tr><td><code>clientId: string</code></td><td>Id of the participant</td></tr><tr><td><code>displayName?: string</code></td><td>Display name of the participant or screenshare</td></tr><tr><td><code>stream?: MediaStream</code></td><td>Media stream of the client view</td></tr><tr><td><code>isLocalCliend: boolean</code></td><td>Is the client view owned by the local participant?</td></tr><tr><td><code>isAudioEnabled: boolean</code></td><td>The client view has their microphone enabled</td></tr><tr><td><code>isVideoEnabled: boolean</code></td><td>The client view has their camera enabled</td></tr><tr><td><code>isPresentation: boolean</code></td><td>The client view is a presentation (screenshare)</td></tr></tbody></table>

## CloudRecordingState: <mark style="color:green;">\<Object></mark> <a href="#screenshare" id="screenshare"></a>

<table><thead><tr><th width="224.390625">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>status: "requested" | "recording" | "error"</code></td><td>Cloud recording status</td></tr><tr><td><code>startedAt?: string</code></td><td>If <code>status</code> is <code>"recording"</code> then this field will show when the cloud recording started</td></tr><tr><td><code>error?: string</code></td><td>If <code>status</code> is <code>"error"</code> then this field will show the error message received from the service</td></tr></tbody></table>

## LiveTranscriptionState: <mark style="color:green;">\<Object></mark> <a href="#screenshare" id="screenshare"></a>

<table><thead><tr><th width="220.73828125">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>status: "requested" | "transcribing" | "error"</code></td><td>Live transcription status</td></tr><tr><td><code>startedAt?: string</code></td><td>If <code>status</code> is <code>"transcribing"</code> then this field will show when the live transcription started. Otherwise this field will be <code>undefined</code>.</td></tr><tr><td><code>error?: string</code></td><td>If <code>status</code> is <code>"error"</code> then this field will show the error message received from the service. Otherwise this field will be <code>undefined</code>.</td></tr></tbody></table>

## LiveCaptionsState: <mark style="color:$primary;">\<Object></mark> <a href="#screenshare" id="screenshare"></a>

<table><thead><tr><th width="220.73828125">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>status: "requested" | "captioning" | "error"</code></td><td>Live captions status</td></tr><tr><td><code>startedAt?: string</code></td><td>If <code>status</code> is <code>"captioning"</code> then this field will show when the live captions started. Otherwise this field will be <code>undefined</code>.</td></tr><tr><td><code>error?: string</code></td><td>If <code>status</code> is <code>"error"</code> then this field will show the error message received from the service. Otherwise this field will be <code>undefined</code>.</td></tr><tr><td><code>captionLog: Array&#x3C;</code><a href="#clientview"><code>LiveCaption</code></a><code>></code></td><td>Zero or more live captions data objects received from the Whereby Live Captions service. Entries in this array are removed after 5 seconds of inactivity since their last update.</td></tr></tbody></table>

## ScreenshareState: <mark style="color:green;">\<Object></mark> <a href="#screenshare" id="screenshare"></a>

<table><thead><tr><th width="294.3333333333333">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>participantId: string</code></td><td>Id of the participant owning the screenshare</td></tr><tr><td><code>id: string</code></td><td>Id of the screenshare</td></tr><tr><td><code>hasAudioTrack: boolean</code></td><td></td></tr><tr><td><code>stream?</code>:<a href="#mediastream"><code>MediaStream</code></a></td><td>Media stream of the screenshare</td></tr><tr><td><code>isLocal: boolean</code></td><td>Is the screenshare owned by the local participant?</td></tr></tbody></table>

## LiveStreamState: <mark style="color:green;">\<Object></mark> <a href="#livestreamstate" id="livestreamstate"></a>

| Property              | Description                   |
| --------------------- | ----------------------------- |
| `status: "streaming"` | Live streaming is in progress |
| `startedAt: number`   | When the live stream started  |

## BreakoutState: <mark style="color:green;">\<Object></mark> <a href="#breakout" id="breakout"></a>

Timestamp fields are epoch milliseconds unless noted, so they can be compared directly against `Date.now()` to drive countdowns.

| Type                                                                                            | Description                                                                                                                                                           |
| ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `isAvailable: boolean`                                                                          | Breakout groups require a group (SFU) room. `false` in peer-to-peer rooms, where breakout actions are refused                                                         |
| `error: string \| null`                                                                         | Set when a breakout action was refused, for example starting a session in a peer-to-peer room                                                                         |
| `isActive: boolean`                                                                             | The state of the breakout session. If it's true, a breakout session is currently ongoing in the room                                                                  |
| `currentGroup: { id: string, name: string } \| null`                                            | An object containing the information of the breakout group that the participant is currently in. `null` if the SDK participant is not in a group.                     |
| `groups: { [groupId: string]: string } \| null`                                                 | The configured groups, as a map of group id to group name                                                                                                             |
| `enforceAssignment: boolean`                                                                    | When `true`, participants are meant to stay in the group they are assigned to. The SDK surfaces the flag but does not block `joinBreakoutGroup`, honour it in your UI |
| `autoMoveToGroup: boolean`                                                                      | When `true`, assigned participants are moved into their group automatically when the session starts                                                                   |
| `moveToGroupGracePeriod: number \| null`                                                        | Seconds between the session starting and that automatic move. Defaults to 10                                                                                          |
| `autoMoveToMain: boolean`                                                                       | When `true`, participants are moved back to the main room automatically when the session ends                                                                         |
| `moveToMainGracePeriod: number \| null`                                                         | Seconds between the session ending and that automatic move. Defaults to 30                                                                                            |
| `breakoutTimerSetting: boolean`                                                                 | Whether the session runs on a timer                                                                                                                                   |
| `breakoutTimerDuration: number`                                                                 | Length of the timer in seconds. Defaults to 1800 (30 minutes)                                                                                                         |
| `startedAt: Date \| null`                                                                       | When the breakout session was started                                                                                                                                 |
| `endTime: number \| null`                                                                       | When the timer runs out, as a timestamp                                                                                                                               |
| `moveToGroupAt: number \| null`                                                                 | Timestamp of the upcoming automatic move into the group, or `null` when `autoMoveToGroup` is off                                                                      |
| `moveToMainAt: number \| null`                                                                  | Timestamp of the upcoming automatic move back to the main room, or `null` when `autoMoveToMain` is off                                                                |
| `groupedParticipants: { clients: ClientView[], group: { id: string, name: string } \| null }[]` | List of the groups in the current breakout session, including the participants in each group.                                                                         |
| `participantsInCurrentGroup: ClientView[]`                                                      | Participants in the current breakout group. Empty list if the SDK participants is not currently in a group.                                                           |
| `broadcastingParticipants: ClientView[]`                                                        | Main-room participants currently being broadcast into every group. Only populated for participants who are inside a group                                             |

## BreakoutSessionSettings: <mark style="color:green;">\<Object></mark>

The settings shared by `startBreakoutSession` and `updateBreakoutSession`. All fields are optional, anything you leave out keeps its current value.

| Type                                      | Description                                                                                                   |
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| `enforceAssignment?: boolean`             | Signal that participants should stay in their assigned group instead of picking one                           |
| `autoMoveToGroup?: boolean`               | Move assigned participants into their group automatically when the session starts                             |
| `moveToGroupGracePeriod?: number \| null` | Seconds to wait before that automatic move. Defaults to 10 if you enable `autoMoveToGroup` without setting it |
| `autoMoveToMain?: boolean`                | Move participants back to the main room automatically when the session ends                                   |
| `moveToMainGracePeriod?: number \| null`  | Seconds to wait before that automatic move. Defaults to 30 if you enable `autoMoveToMain` without setting it  |
| `breakoutTimerSetting?: boolean`          | Run the session on a timer                                                                                    |
| `breakoutTimerDuration?: number`          | Timer length in seconds. Defaults to 1800 (30 minutes) if you enable the timer without setting it             |

## StartBreakoutSessionOptions: <mark style="color:green;">\<Object></mark>

`BreakoutSessionSettings`, plus:

| Type                                           | Description                                                            |
| ---------------------------------------------- | ---------------------------------------------------------------------- |
| `groups: { [groupId: string]: string }`        | **Required.** The groups to create, as a map of group id to group name |
| `assignments?: { [clientId: string]: string }` | Which participants go where, as a map of `clientId → groupId`          |

## UpdateBreakoutSessionOptions: <mark style="color:green;">\<Object></mark>

Same shape as `StartBreakoutSessionOptions`, except that `groups` is optional too. Every field you omit is left as it is.

## ToggleAudioOnlyModeOptions: <mark style="color:green;">\<Object></mark> <a href="#toggleaudioonlymodeoptions" id="toggleaudioonlymodeoptions"></a>

| Type                               | Description                                                                                                                     |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `autoDisableLocalCamera?: boolean` | Also turn off the local camera when enabling audio-only mode. The camera is not turned back on when audio-only mode is disabled |

## CallQualityLevel: <mark style="color:green;">\<string></mark> <a href="#callqualitylevel" id="callqualitylevel"></a>

`"ok" | "warning" | "critical"`

## RemoteParticipantQualityReport: <mark style="color:green;">\<Object></mark> <a href="#remoteparticipantqualityreport" id="remoteparticipantqualityreport"></a>

The call quality of each remote participant, keyed by `clientId`: `{ [clientId: string]: { quality: CallQualityLevel } }`. The local participant is not included. Empty (`{}`) until the first quality scores arrive after joining a room, and reset to empty after leaving.

| Type                                             | Description                                                                        |
| ------------------------------------------------ | ---------------------------------------------------------------------------------- |
| [`quality: CallQualityLevel`](#callqualitylevel) | The participant's overall call quality: the worse of their video and audio quality |

## CPUQualityLevel: <mark style="color:green;">\<string></mark> <a href="#cpuqualitylevel" id="cpuqualitylevel"></a>

`"ok" | "warning" | "critical"`

## LocalParticipantQualityReport: <mark style="color:green;">\<Object></mark> <a href="#localparticipantqualityreport" id="localparticipantqualityreport"></a>

The call quality of the local participant: `{ quality?: CallQualityLevel; cpu?: CPUQualityLevel }`. Empty (`{}`) until the first quality score arrives after joining a room, and reset to empty after leaving.

| Type                                              | Description                                                                                                                                                                                                                             |
| ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`quality?: CallQualityLevel`](#callqualitylevel) | The local participant's overall call quality: the worse of their video and audio quality                                                                                                                                                |
| [`cpu?: CPUQualityLevel`](#cpuqualitylevel)       | CPU pressure on the local device. Does not affect `quality`. Left out in browsers without the [Compute Pressure API](https://developer.mozilla.org/en-US/docs/Web/API/Compute_Pressure_API) (currently all but Chromium-based browsers) |

## Breakout group helpers

Exported from `@whereby.com/core` for building the `groups` map:

| Export                              | Description                                                                            |
| ----------------------------------- | -------------------------------------------------------------------------------------- |
| `createBreakoutGroups(count?)`      | Returns `count` groups (`{ a: "Group A", … }`), clamped to the supported range         |
| `defaultBreakoutGroupName(groupId)` | The default display name for a group id, e.g. `"Group A"`                              |
| `BREAKOUT_GROUPS_MIN_MAX`           | `[2, 20]`, the minimum and maximum number of groups                                    |
| `DEFAULT_BREAKOUT_TIMER_DURATION`   | `1800`, the timer duration used when the timer is enabled without an explicit duration |

## ConnectionStatus: <mark style="color:green;">\<string></mark>

<table><thead><tr><th width="222">Value</th><th>Description</th></tr></thead><tbody><tr><td><code>"ready"</code></td><td>Ready to join the room</td></tr><tr><td><code>"connecting"</code></td><td>Currently in the process of doing the initial connection in the room</td></tr><tr><td><code>"connected"</code></td><td>Connected in the room, this is the "stable" state</td></tr><tr><td><code>"room_locked"</code></td><td>Connection failed due to the room being locked, a knock is required to proceed</td></tr><tr><td><code>"knocking"</code></td><td>Waiting for the room host to respond to the knock request</td></tr><tr><td><code>"knock_on_hold"</code></td><td>The host put your knock request on hold. You are still in the waiting room and the host can accept or reject you later, so keep showing a waiting state rather than sending the participant away.<br><br>If the host included a message, it is available as <code>knockResponse</code> on the room connection state.</td></tr><tr><td><code>"knock_rejected"</code></td><td>The host rejected your knock request. If the host included a message, it is available as <code>knockResponse</code></td></tr><tr><td><code>"kicked"</code></td><td><p>The current participant was kicked from the room.</p><p>This can happen in the following scenarios:</p><ul><li>when a meeting host ends the meeting for all participants in the room</li><li>when a meeting host kicks the current participant individually from the room</li></ul></td></tr><tr><td><code>"leaving"</code></td><td>The current participant has invoked the <code>leaveRoom</code> action to exit the room.</td></tr><tr><td><code>"left"</code></td><td>The current participant has now successfully left the room and all other room participants have been notified.</td></tr><tr><td><code>"disconnected"</code></td><td><p>The current participant has been disconnected from the room due to an unplanned loss of network connection.</p><p>This can happen during temporary network outage (e.g. loss of network or switching networks). If/when the network connection returns the SDK will change the room connection status to <code>reconnecting</code>automatically.</p></td></tr><tr><td><code>"reconnecting"</code></td><td><p>A lost internet connection has been re-established.</p><p>The SDK will now automatically re-connect the current participant to the previous room and the room connection state will change to either: a.) <code>knocking</code> if the room is locked, or; b.) <code>connected</code> if the room is unlocked.</p></td></tr></tbody></table>

## JoinRoomStage: <mark style="color:green;">\<string></mark> <a href="#joinroomstage" id="joinroomstage"></a>

The step `joinRoom()` is waiting on. `joinStage` in the room connection state is one of these values, or `null` when no join is in progress. A join goes through the stages in this order.

<table><thead><tr><th width="222">Value</th><th>Description</th></tr></thead><tbody><tr><td><code>"credentials"</code></td><td>Getting device credentials. A request that fails is retried every 2 seconds</td></tr><tr><td><code>"organization"</code></td><td>Fetching the organization the room belongs to</td></tr><tr><td><code>"local_media"</code></td><td>Starting the camera and microphone. The join waits here while the browser asks for permission</td></tr><tr><td><code>"signal_connect"</code></td><td>Connecting to Whereby's signal server</td></tr><tr><td><code>"identify_device"</code></td><td>Waiting for the signal server to identify the device</td></tr><tr><td><code>"join_room"</code></td><td>Asked to join the room, waiting for the server to reply</td></tr></tbody></table>

## JoinRoomErrorNames: <mark style="color:green;">\<string></mark> <a href="#joinroomerrornames" id="joinroomerrornames"></a>

The errors `joinRoom()` rejects with when the SDK gives up on the join itself: `"organization_fetch_failed" | "join_cancelled"`.

<table><thead><tr><th width="222">Value</th><th>Description</th></tr></thead><tbody><tr><td><code>"organization_fetch_failed"</code></td><td>The organization the room belongs to couldn't be fetched</td></tr><tr><td><code>"join_cancelled"</code></td><td>The room was left (<code>leaveRoom()</code>, <code>destroy()</code>, or being kicked), or <code>joinRoom()</code> was called again, before the join finished</td></tr></tbody></table>

`joinRoom()` also rejects with the errors the server sends when it refuses the join, such as `"room_full"` or `"room_join_permission_denied"`. Those aren't part of this type.

## LocalParticipantState: <mark style="color:green;">\<Object></mark>

| Property                                | Description                                                                                                                                                                                                                                                                           |
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `displayName: string`                   | Display name of the local participant (you)                                                                                                                                                                                                                                           |
| `id:string`                             | Local participant id                                                                                                                                                                                                                                                                  |
| `roleName:string`                       | <p>The role of the local participant. This will be one of the following values:<br><br><code>none</code>, <code>visitor</code>, <code>granted\_visitor</code>, <code>viewer</code>, <code>granted\_viewer</code>, <code>host</code>, <code>recorder</code>, <code>streamer</code></p> |
| `stream?:`[`MediaStream`](#mediastream) | <p>When set, the media stream (audio & video) of</p><p>the local participant</p>                                                                                                                                                                                                      |
| `isAudioEnabled:boolean`                | The local participant has their microphone enabled                                                                                                                                                                                                                                    |
| `isVideoEnabled:boolean`                | The local participant has their camera enabled                                                                                                                                                                                                                                        |
| `isLocalParticipant:true`               | Always set to true. Can be used to easily identify the local participant if in an array with eg remote participants                                                                                                                                                                   |
| `isScreensharing:boolean`               | True if the local participant is screen sharing                                                                                                                                                                                                                                       |
| `clientClaim?:string`                   |                                                                                                                                                                                                                                                                                       |
| `breakoutGroupAssigned:string`          | The name of the breakout group the participant is assigned to (if any)                                                                                                                                                                                                                |

## RoomJoinedEvent: <mark style="color:green;">\<Object></mark>

| Property            | Description                               |
| ------------------- | ----------------------------------------- |
| `isLocked: boolean` | True if room is locked                    |
| `selfId: string`    | Id of the participant who joined the room |

## RoomJoinedSuccess: <mark style="color:green;">\<Object></mark>

| Property                        | Description                                                                                                      |
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `room: object`                  | Room state data on room joined                                                                                   |
| `selfId: string`                | Id of the participant who joined the room                                                                        |
| `breakoutGroup: string \| null` | Name of breakout group that the participant joined, or `null` if user is not in a breakout group on room joined. |

## KnockResponse: <mark style="color:green;">\<Object></mark>

The host's response to your knock, delivered when they put you on hold or reject you. Available as `knockResponse` on the room connection state. It is `null` until a response arrives, and a host who responds without writing anything produces a response with no `message`, so always guard on `knockResponse?.message` rather than on `knockResponse` alone.

| Type                           | Description                                                                                                                                      |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `message?: string`             | The message the host wrote when calling `holdWaitingParticipant` or `rejectWaitingParticipant`. Absent when the host responded without a message |
| `sender?: KnockResponseSender` | Who the message came from. Populated with the host's display name for on-hold responses; rejections are delivered without sender details         |

## KnockResponseSender: <mark style="color:green;">\<Object></mark>

| Type                           | Description                                      |
| ------------------------------ | ------------------------------------------------ |
| `displayName?: string \| null` | Display name of the host who responded           |
| `avatarUrl?: string \| null`   | Avatar of the host who responded, when available |

## RoomIntegrationsState: <mark style="color:green;">\<Object></mark> <a href="#roomintegrationsstate" id="roomintegrationsstate"></a>

`roomIntegrations` on the room connection state. See [Room Integrations](/reference/core-sdk-reference/api-reference/roomconnectionclient/room-integrations).

| Type                                        | Description                                                             |
| ------------------------------------------- | ----------------------------------------------------------------------- |
| `hasFetched: boolean`                       | `true` once the room's list of integrations has loaded                  |
| `isFetching: boolean`                       | `true` while the list is loading                                        |
| `error: RoomIntegrationErrorDetail \| null` | The last error from a fetch, start, stop or props update                |
| `enabled: RoomIntegration[]`                | Integrations switched on for the room, including ones the SDK can't run |
| `embeddable: RoomIntegration[]`             | The subset of `enabled` that can run in an SDK app (YouTube and Miro)   |
| `running: RoomIntegrationSessionView[]`     | Sessions running in the main room or your current breakout group        |

## RoomIntegration: <mark style="color:green;">\<Object></mark> <a href="#roomintegration" id="roomintegration"></a>

| Type                                      | Description                                                                                                          |
| ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| `roomIntegrationId: string`               | Id to pass to `startRoomIntegration`                                                                                 |
| `name: string`                            | Machine name, for example `"youtube"` or `"miro"`                                                                    |
| `title: string`                           | Display name, for example `"YouTube"`                                                                                |
| `description: string`                     | Short description, for menus                                                                                         |
| `type: string`                            | The integration's category, for example `"video"`                                                                    |
| `icons: { small: string; large: string }` | Icon URLs                                                                                                            |
| `link: { href: string; text: string }`    | The provider's website                                                                                               |
| `contentTagName: string`                  | Custom element name of the content                                                                                   |
| `entrypoint: string`                      | URL of the integration's script. Used by the Whereby app, not by the SDK                                             |
| `webview: string`                         | URL of the content frame page. The picker is `bootstrap.html` next to it. Its origin is the one to check and post to |
| `matcher: RegExp`                         | Matches links this integration can show                                                                              |
| `isEmbeddable: boolean`                   | `true` if the integration can run in an SDK app                                                                      |

## RoomIntegrationSession: <mark style="color:green;">\<Object></mark> <a href="#roomintegrationsession" id="roomintegrationsession"></a>

| Type                                              | Description                                          |
| ------------------------------------------------- | ---------------------------------------------------- |
| `roomIntegrationSessionId: string`                | Id of the running session                            |
| `roomIntegrationId: string`                       | The integration that's running                       |
| `breakoutGroupId: string`                         | The breakout group it runs in. `""` in the main room |
| `tagName: string`                                 | Custom element name of the content                   |
| `shareUrl: string`                                | The `https` URL of the shared content                |
| `props: RoomIntegrationProps`                     | The content's current state                          |
| `clientId: string`                                | Id of the participant who started it                 |
| `roomIntegrationSessionStartedAt: number \| null` | When it started, in epoch milliseconds               |

## RoomIntegrationSessionView: <mark style="color:green;">\<Object></mark> <a href="#roomintegrationsessionview" id="roomintegrationsessionview"></a>

The entries in `roomIntegrations.running`. A `RoomIntegrationSession`, plus:

| Type                                   | Description                                                                              |
| -------------------------------------- | ---------------------------------------------------------------------------------------- |
| `integration: RoomIntegration`         | The integration that's running                                                           |
| `isPresenter: boolean`                 | `true` if you started it                                                                 |
| `presenterDisplayName: string \| null` | Display name of the participant who started it. `null` if that's you, or if they've left |
| `canStop: boolean`                     | `true` if you started it or you're a host                                                |

## RoomIntegrationProps: <mark style="color:green;">\<Object></mark> <a href="#roomintegrationprops" id="roomintegrationprops"></a>

```ts
type RoomIntegrationProps = { [key: string]: string | number | boolean | null };
```

## RoomIntegrationErrorDetail: <mark style="color:green;">\<Object></mark> <a href="#roomintegrationerrordetail" id="roomintegrationerrordetail"></a>

| Type                         | Description                                                                                                                                                                                                                                                                                                                             |
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `code: RoomIntegrationError` | `"unknown_integration"`, `"integration_not_enabled"`, `"invalid_content"`, `"not_allowed_to_stop"`, `"not_in_a_room"`, `"forbidden"`, `"missing_parameters"`, `"invalid_parameters"`, `"internal_server_error"` or `"unknown"`. See [Errors](/reference/core-sdk-reference/api-reference/roomconnectionclient/room-integrations#errors) |
| `message: string`            | A description for developers                                                                                                                                                                                                                                                                                                            |

## RoomIntegrationContent: <mark style="color:green;">\<Object></mark> <a href="#roomintegrationcontent" id="roomintegrationcontent"></a>

Returned by `roomIntegrationContent.youtube()` and `.miro()`. `RoomIntegrationPickerResult` has the same shape.

| Type                          | Description                        |
| ----------------------------- | ---------------------------------- |
| `tagName: string`             | Custom element name of the content |
| `shareUrl: string`            | The `https` URL of the content     |
| `props: RoomIntegrationProps` | The content's starting state       |


# Assistant SDK Reference

{% hint style="warning" %}
⚠️ **Closed Beta**\
The Assistants feature is currently in Closed Beta. You can request access by emailing <embedded@whereby.com>. Assistants will be made generally available after the beta.
{% endhint %}

The **Whereby Assistant SDK** is a Node.js-focused SDK for building assistants that can join Whereby rooms. It provides all the polyfills and plumbing needed to join a Whereby Room in Node, and exposes a simple API to connect assistants, manage their lifecycle and access audio and video streams and other in-room features for all participants. This SDK can be used in conjunction with our Trigger API to listen for [webhooks](/whereby-product-features/insights-suite-and-api/webhooks) and join the room on certain room conditions being met.

### Audience

This package is designed for **backend developers** and **AI/assistant builders** who want to:

* Run assistants, bots or agents **headlessly** (no browser UI)
* Integrate Whereby with **real-time transcriptions** services
* Stream room audio into **LLM-based agents** for conversation, summarization or automation
* Trigger assistants to join rooms automatically using **webhooks**

### Use cases

* Capturing a single combined audio stream of all participants for transcription, captioning or analysis
* Feeding live meeting audio to real-time AI agents (eg OpenAI Realtime)
* Running a support bot that automatically joins rooms when triggered, and can perform in room actions
* Building meeting recorders or pipelines that store and process session audio

### Requirements

The Assistant SDK is intended for Node.js environments and depends on some external tooling:

* **Node.js ≥ 20**
* [**FFmpeg**](https://ffmpeg.org/) must be installed on the host machine if you wish to make use of the **combined audio stream** functionality.

{% hint style="info" %}
Note: The SDK can not be run in the browser - use [Core](/reference/core-sdk-reference) or [Browser](/whereby-for-web-browser/react-based-browser-sdk/quick-start) SDK for creating user-interface based integrations.
{% endhint %}

## Getting started

### Installation

Install the `@whereby.com/assistant-sdk` package from the public [npm registry.](https://www.npmjs.com/package/@whereby.com/assistant-sdk)

{% tabs %}
{% tab title="npm" %}

```bash
npm install @whereby.com/assistant-sdk
```

{% endtab %}

{% tab title="yarn" %}

```bash
yarn add @whereby.com/assistant-sdk
```

{% endtab %}

{% tab title="pnpm" %}

```bash
pnpm add @whereby.com/assistant-sdk
```

{% endtab %}
{% endtabs %}

### Installing FFmpeg

To use the **combined audio stream** functionality you will need FFmpeg to be installed on the machine running your assistant. You can check if FFmpeg is already installed on your local machine by running:

```bash
ffmpeg -version
```

If you see the version number, you're good to go! if not, install it using one of the methods below:

{% tabs %}
{% tab title="macOS (Homebrew)" %}

```bash
brew install ffmpeg
```

{% endtab %}

{% tab title="Ubutntu/Debian" %}

```bash
sudo apt update
sudo apt install ffmpeg
```

{% endtab %}

{% tab title="Windows (Chocolatey)" %}

```bash
choco install ffmpeg
```

{% endtab %}
{% endtabs %}

Or download a prebuilt binary directly from [ffmpeg.org/download](https://ffmpeg.org/download.html).

{% hint style="info" %}
After installation, make sure ffmpeg is available in your system PATH so the Assistant SDK can call it.
{% endhint %}

On the [next page](/reference/assistant-sdk-reference/quick-start) you can learn how to start working with Whereby Assistants in your code base.


# Quick Start

The following example shows a basic example of creating an assistant to join a room and send a chat message

{% hint style="info" %}
Assistants are most powerful when they are **started automatically in response to events**.

In almost all production use cases you will need a **trigger mechanism** to decide *when* an Assistant should join a room. This can be done with the built-in [**Trigger API**](#using-trigger-api), or by hosting your own service that listens for Whereby webhooks and creates an Assistant instance based on your own custom logic.

Without a trigger, an Assistant can only be started manually, which limits its ability to react to user behavior or integrate seamlessly with in-room events such as participants joining/leaving or room sessions starting/ending.
{% endhint %}

### Getting Started

1. Create your assistant in the Whereby dashboard
   1. Visit Configure > Assistant and create an assistant
   2. Grab your assistant key

<figure><img src="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FKWJ3yDPCmNfxiXnGPUSB%2FScreenshot%202025-09-25%20at%2009.56.31.png?alt=media&amp;token=103c2ab3-f141-4d3c-9f01-0660d5ba8a4b" alt="The Assistant Dashboard"><figcaption></figcaption></figure>

2. Import polyfills and initialize assistant

```javascript
import "@whereby.com/assistant-sdk/polyfills";
```

```jsx
import { Assistant } from "@whereby.com/assistant-sdk";

const assistant = new Assistant({ assistantKey: "my-assistant-key" });
```

3. Have the assistant start to join the room and wait until the room is connected. We should also wrap this call in a try/catch block in case any errors happen during the join room flow:

```jsx
try { 
  await assistant.joinRoom("https://your-subdomain.whereby.com/your-room-name");
} catch(error) {
  console.error("An error occurred joining the room", error);
}; 
```

4. Once the room is connected start using your assistant!

```jsx
const roomConnection = assistant.getRoomConnection();
roomConnection.sendChatMessage("Hello! I'm your assistant, how can I help you?");
```

The above steps can collectively be written in promise-formatted code as follows:

```jsx
const assistant = new Assistant({ assistantKey: "my-assistant-key" });
assistant
  .joinRoom("https://your-subdomain.whereby.com/your-room-name")
  .then(() => {
    const roomConnection = assistant.getRoomConnection();
    roomConnection.sendChatMessage("Hello! I'm your assistant, how can I help you?");
  })
  .catch((error) => {
    console.error("An error occurred joining the room", error);
  });
```

### Using Trigger API

If you'd like the assistant to join the room automatically, you can make some small tweaks to our first example to use our webhook trigger API. This way, you can listen for certain webhook events and create your assistant whenever those webhooks are received! You should still follow step 1 in the above tutorial to obtain the assistant key.

1. Create your assistant in the Whereby dashboard
   1. Visit Configure > Assistant and create an assistant
   2. Grab your assistant key
   3. :exclamation:**Make sure to set the endpoint URL in the configuration steps to receive webhooks**
2. Set up start [trigger](/reference/assistant-sdk-reference/api-reference/trigger)

```jsx
import { Trigger } from "@whereby.com/assistant-sdk";

let hasAssistantJoined = false;

const trigger = new Trigger({
  webhookTriggers: {
    "room.client.joined": () => !hasAssistantJoined,
  },
  port: 3000,
});
```

3. Start the trigger server

```jsx
trigger.start();
```

4. Listen for the [`TRIGGER_EVENT_SUCCESS`](/reference/assistant-sdk-reference/types/trigger-types) event - this indicates that the trigger predicate has been a match, and that your assistant should now join the room. Here, you can create the assistant and join the room before sending a chat message in to the connected room.

```jsx
trigger.on(TRIGGER_EVENT_SUCCESS, async ({ roomUrl }) => {
  console.log("Webhook trigger has been matched!");
  const assistant = new Assistant({ assistantKey: "my-assistant-key" });
  
  try { 
    await assistant.joinRoom("https://your-subdomain.whereby.com/your-room-name");
    console.log("Connected to room");
    hasAssistantJoined = true;
  } catch(error) {
    console.error("An error occurred joining the room", error);
    return;
  };

  const roomConnection = assistant.getRoomConnection();
  roomConnection.sendChatMessage("Hello! I'm your assistant, how can I help you?");
});
```

5. Finally, clean up any open listeners when the assistant eventually leaves the room (e.g. reset the webhook trigger for this room).

```jsx
assistant.on(ASSISTANT_LEFT_ROOM, () => {
  console.log("Disconnected from room");
  hasAssistantJoined = false;
});
```

5. Start building! Here’s a minimal example, using the trigger API and creating an assistant that will send a chat message into the room session.

```jsx
import "@whereby.com/assistant-sdk/polyfills";

import {
    Trigger,
    Assistant,
    TRIGGER_EVENT_SUCCESS,
    ASSISTANT_LEFT_ROOM,
} from "@whereby.com/assistant-sdk";

let hasAssistantJoined = false;

const trigger = new Trigger({
  webhookTriggers: {
    "room.client.joined": () => !hasAssistantJoined,
  },
  port: 3000,
});

trigger.start();

trigger.on(TRIGGER_EVENT_SUCCESS, async ({ roomUrl }) => {
  console.log("Webhook trigger has been matched!");
  const assistant = new Assistant({ assistantKey: "my-assistant-key" });
  
  try { 
    await assistant.joinRoom("https://your-subdomain.whereby.com/your-room-name");
    console.log("Connected to room");
    hasAssistantJoined = true;
  } catch(error) {
    console.error("An error occurred joining the room", error);
    return;
  }
    
  const roomConnection = assistant.getRoomConnection();
  roomConnection.sendChatMessage("Hello! I'm your assistant, how can I help you?");
    
  assistant.on(ASSISTANT_LEFT_ROOM, () => {
    console.log("Disconnected from room");
    hasAssistantJoined = false;
  });
});
```

This demonstrates the most basic functionality of the library. From this example, you can go on to implement more advanced functionality that is explained in more detail in the next sections of the documentation: [API Reference](/reference/assistant-sdk-reference/api-reference).

Additionally, you can take a look at the source code for an example Whereby Assistant that is published on Github here: <https://github.com/whereby/whereby-assistant-audio-recorder>.


# API Reference

The Assistant SDK provides two primary APIs:

* [Assistant API](/reference/assistant-sdk-reference/api-reference/assistant) - manage active assistant session, access combined audio and other in room actions
* [Trigger API](/reference/assistant-sdk-reference/api-reference/trigger) - programmatically control assistants using [webhooks](/whereby-product-features/insights-suite-and-api/webhooks)

There can be used in tandem to create a rich, automated Assistant experience. The details of each API are outlined in the sections below.

{% content-ref url="/pages/Qv90lN7gxU2h1zG0atUn" %}
[Assistant](/reference/assistant-sdk-reference/api-reference/assistant)
{% endcontent-ref %}

{% content-ref url="/pages/GIU2rh8XcZEit0DwtqQX" %}
[Trigger](/reference/assistant-sdk-reference/api-reference/trigger)
{% endcontent-ref %}


# Assistant

The `Assistant` class is the main entry point of the Assistants SDK. It runs in Node.js and provides everything that you need to connect an AI agent into a Whereby room - to access in-room audio and video streams, manage in-room actions and integrate with external services of your choice.

## Constructor

```tsx
const assistant = new Assistant(options: AssistantOptions)
```

### AssistantOptions

| Parameter      | Type     | Default | Description                                        |
| -------------- | -------- | ------- | -------------------------------------------------- |
| `assistantKey` | `string` | -       | Assistant key generated from the Whereby Dashboard |

## Methods

### Room Lifecycle

To join a room or to then subsequenty perform any in-room actions, the following methods are available.

<table><thead><tr><th width="176.14453125">Method</th><th width="155.6328125">Parameters</th><th width="256.57293701171875">Returns</th><th>Description</th></tr></thead><tbody><tr><td><code>joinRoom</code></td><td><code>roomUrl: string</code></td><td><code>Promise&#x3C;</code><a href="/reference/core-sdk-reference/types/roomconnection-types#roomjoinedsuccess-less-than-object-greater-than"><code>RoomJoinedSuccess</code></a><code>></code></td><td>Connects the assistant to the specified room. In case the room can not be joined the Promise will be rejected with a room joined error code.</td></tr><tr><td><code>getRoomConnection</code></td><td></td><td><a href="/reference/core-sdk-reference/api-reference/roomconnectionclient"><code>RoomConnectionClient</code></a></td><td>Returns the underlying room connection controller.</td></tr></tbody></table>

{% hint style="info" %}
With a [RoomConnectionClient](/reference/core-sdk-reference/api-reference/roomconnectionclient) object the Whereby Assistant can then perform host-level in-room actions including:

* controlling room access for knocking participants,
* control participant spotlighting and audio/video muting/unmuting
* sending chat messages,
* starting and stopping cloud recording (if enabled in the room)
* subscribing to room state changes

For a full overview of available in-room functionality refer to the [RoomConnectionClient reference pages](/reference/core-sdk-reference/api-reference/roomconnectionclient).
{% endhint %}

### Media

To obtain audio and/or media streams from the room or if you want to inject audio and/or video back in to the room from the Assistant then you can use the following media APIs to do so.

```jsx
import "@whereby.com/assistant-sdk/polyfills";

import { 
  Assistant,
  ASSISTANT_LEFT_ROOM,
} from "@whereby.com/assistant-sdk";

const assistant = new Assistant({
  assistantKey: process.env.ASSISTANT_KEY
});

assistant
  .joinRoom("https://your-subdomain.whereby.com/your-room-name")
  .then(({ roomUrl }) => {
    console.log("Assistant has joined the room: ", roomUrl);
  
    // To receive all audio data from the call:
    const combinedAudioSink = assistant.getCombinedAudioSink();
    // recieve raw PCM audio data of all audio in the room with e.g.:
    const unsubscribeCombinedAudioSink = combinedAudioSink.subscribe(({ samples, sampleRate }) => { 
      console.log(`${samples.length} samples received @ ${sampleRate}Hz`)
      // <your audio samples processing here>
    });
  
    // To inject audio and/or video data in to the call:
    assistant.startLocalMedia({
      audio: true,
      video: true,
    }).then(({ audioSource, videoSource }) => {
      setInterval(() => {
        console.log("Injecting media in to room");
    
        // continuously push raw PCM audio data in to the room with e.g.:
        audioSource.onData({ sampleRate: 8000, samples: new Int16Array(8000 / 100) });
    
        // continuously push raw I420 video data in to the room with e.g.:
        videoSource.onFrame({ width: 320, height: 240, data: new Uint8ClampedArray(320 * 240 * 1.5) });
      });
    }).catch((error) => {
      console.error("An error occurred starting local media", error);
      return;
    });
  
    assistant.on(ASSISTANT_LEFT_ROOM, ({ roomUrl }) => {
      console.log("Assistant has left the room: ", roomUrl);
    
      // Clean up any subscribers created above:
      unsubscribeCombinedAudioSink();
    })
  })
  .catch((error) => {
    console.error("An error occurred joining the room", error);
  });

```

<table><thead><tr><th width="187.4921875">Method</th><th width="180.984375">Parameters</th><th width="241.48046875">Returns</th><th>Description</th></tr></thead><tbody><tr><td><code>startLocalMedia</code></td><td><a href="/reference/core-sdk-reference/types/roomconnection-types#localmediaoptions-less-than-object-greater-than"><code>LocalMediaOptions</code></a></td><td><p><code>Promise&#x3C;{</code></p><p><code>audioSource:</code> <a href="/reference/assistant-sdk-reference/types/assistant-types#audiosource-less-than-object-greater-than"><code>AudioSource</code></a> <code>| null,</code></p><p><code>videoSource:</code> <a href="/reference/assistant-sdk-reference/types/assistant-types#videosource-less-than-object-greater-than"><code>VideoSource</code></a> <code>| null</code></p><p><code>}></code></p></td><td>Creates and starts local audio and/or video media for the assistant based on parameters and returns media objects that can be used to inject media data in to the room</td></tr><tr><td><code>stopLocalMedia</code></td><td></td><td><code>void</code></td><td>Stops local media for the assistant</td></tr><tr><td><code>getLocalMedia</code></td><td></td><td><a href="/reference/core-sdk-reference/api-reference/localmediaclient"><code>LocalMediaClient</code></a></td><td>Returns the underlying local media client controller.</td></tr><tr><td><code>getCombinedAudioSink</code></td><td></td><td><a href="/reference/assistant-sdk-reference/types/assistant-types#audiosink-less-than-object-greater-than"><code>AudioSink</code></a> <code>| null</code></td><td>Returns a raw audio sink object containing all in-room audio combined on a single audio channel.</td></tr></tbody></table>

## Events

`Assistant` extends `EventEmitter` . You can listen to lifecycle and state change events directly:

```jsx
import "@whereby.com/assistant-sdk/polyfills";

import { 
  Assistant,
  ASSISTANT_JOINED_ROOM,
  ASSISTANT_LEFT_ROOM,
  PARTICIPANT_VIDEO_TRACK_ADDED,
  PARTICIPANT_AUDIO_TRACK_ADDED,
} from "@whereby.com/assistant-sdk";

const mediaDataSubscriptions = [];

const assistant = new Assistant({
  assistantKey: process.env.ASSISTANT_KEY
});

assistant.on(ASSISTANT_JOINED_ROOM, ({ roomUrl }) => {
  console.log("Assistant has joined the room: ", roomUrl);
});

assistant.on(PARTICIPANT_AUDIO_TRACK_ADDED, ({ participantId, trackId, data }) => {
  console.log("Remote participant audio track available: ", participantId, trackId);
  
  mediaDataSubscriptions.push(
    // recieve raw PCM audio data of this audio track in the room with e.g.:
    data.subscribe(({ samples, sampleRate }) => { 
      console.log(`${samples.length} audio samples received @ ${sampleRate}Hz`);
    })
  );
});

assistant.on(PARTICIPANT_VIDEO_TRACK_ADDED, ({ participantId, trackId, data }) => {
  console.log("Remote participant video track available: ", participantId, trackId);
  
  mediaDataSubscriptions.push(
    // recieve raw I420 video data of this video track in the room with e.g.:
    data.subscribe(({ width, height, data }) => { 
      console.log(`${data.length} video samples received @ ${width}x${height} pixels`);
    })
  );
});

assistant.on(ASSISTANT_LEFT_ROOM, ({ roomUrl }) => {
  console.log("Assistant has left the room: ", roomUrl);
  
  // Clean-up all media data subscriptions on exit
  mediaDataSubscriptions.forEach(unsubscribeFn => unsubscribeFn());
});

try {
  void assistant.joinRoom("https://your-subdomain.whereby.com/your-room-name");
} catch(error) {
  console.error("An error occurred joining the room", error);
}; 

```

<table><thead><tr><th width="287.91796875">Event</th><th width="237.89678955078125">Payload</th><th>Emitted when</th></tr></thead><tbody><tr><td><code>ASSISTANT_JOINED_ROOM</code></td><td><code>{ roomUrl: string }</code></td><td>Assistant has joined the room</td></tr><tr><td><code>ASSISTANT_LEFT_ROOM</code></td><td><code>{ roomUrl: string }</code></td><td>Assistant has left the room</td></tr><tr><td><code>PARTICIPANT_VIDEO_TRACK_ADDED</code></td><td><p><code>{</code></p><p><code>participantId: string;</code></p><p><code>trackId: string;</code></p><p><code>data:</code> <a href="/reference/assistant-sdk-reference/types/assistant-types#videosink-less-than-object-greater-than"><code>VideoSink</code></a></p><p><code>}</code></p></td><td>A remote participant has added or changed a video track</td></tr><tr><td><code>PARTICIPANT_VIDEO_TRACK_REMOVED</code></td><td><p><code>{</code></p><p><code>participantId: string;</code></p><p><code>trackId: string</code></p><p><code>}</code></p></td><td>A remote participant has removed a video track</td></tr><tr><td><code>PARTICIPANT_AUDIO_TRACK_ADDED</code></td><td><p><code>{</code></p><p><code>participantId: string;</code></p><p><code>trackId: string;</code></p><p><code>data:</code> <a href="/reference/assistant-sdk-reference/types/assistant-types#audiosink-less-than-object-greater-than"><code>AudioSink</code></a></p><p><code>}</code></p></td><td>A remote participant has added or changed an audio track</td></tr><tr><td><code>PARTICIPANT_AUDIO_TRACK_REMOVED</code></td><td><p><code>{</code></p><p><code>participantId: string;</code></p><p><code>trackId: string</code></p><p><code>}</code></p></td><td>A remote participant has removed an audio track</td></tr></tbody></table>


# Trigger

The `Trigger` API lets you run an `express` server that listens for Whereby [webhooks](/whereby-product-features/insights-suite-and-api/webhooks) and, based on your rules, returns a `TRIGGER_EVENT_SUCCESS` event if the conditions of your trigger are met.

## Constructor

```jsx
const trigger = new Trigger(options: TriggerOptions)
```

### TriggerOptions

<table><thead><tr><th>Parameter</th><th width="216.40106201171875">Type</th><th width="73.640625">Default</th><th>Description</th></tr></thead><tbody><tr><td><code>webhookTriggers</code></td><td><a href="/reference/assistant-sdk-reference/types/trigger-types#wherebywebhooktriggers-less-than-object-greater-than"><code>WherebyWebhookTriggers</code></a></td><td></td><td><p>Custom matcher functions that the assistant can use to self-trigger <code>TRIGGER_EVENT_SUCCESS</code> events.</p><p>Return <code>true</code> from a <a href="/reference/assistant-sdk-reference/types/trigger-types#wherebywebhooktriggers-less-than-object-greater-than"><code>WherebyWebhookTriggers</code></a> callback to fire this event or <code>false</code> to ignore the incoming webhook.</p></td></tr><tr><td><code>port</code></td><td><code>number</code></td><td><code>4999</code></td><td>Port for the HTTP server listening for Whereby <a href="/whereby-product-features/insights-suite-and-api/webhooks">webhooks</a>.</td></tr></tbody></table>

## Methods

| Method  | Parameters | Returns | Description                                              |
| ------- | ---------- | ------- | -------------------------------------------------------- |
| `start` |            | `void`  | Starts the Express server and begins accepting webhooks. |

## Events

The `Trigger` API extends `EventEmitter` and emits lifecycle events after your trigger predicate returns `true.`

```jsx
import { TRIGGER_EVENT_SUCCESS, Trigger } from "@whereby.com/assistant";

let hasJoined = false;
const trigger = new Trigger({
  webhookTriggers: {
    "room.client.joined": () => !hasJoined,
  },
  port: 4999,
});


trigger.on(TRIGGER_EVENT_SUCCESS, ({ roomUrl }) => {
  console.log("Trigger successful for room: ", roomUrl);
});
```

<table><thead><tr><th width="204.91015625">Event</th><th width="339.75225830078125">Payload</th><th>Emitted when</th></tr></thead><tbody><tr><td><code>TRIGGER_EVENT_SUCCESS</code></td><td><p><code>{</code></p><p><code>roomUrl:string;</code></p><p><code>triggerWebhook:</code> <a href="/reference/assistant-sdk-reference/types/trigger-types#wherebywebhooktriggers-less-than-object-greater-than"><code>WherebyWebhookType</code></a></p><p><code>}</code></p></td><td>Trigger has met the required custom conditions in a webhook trigger matcher function (matcher function returned <code>true</code>).</td></tr></tbody></table>


# Types

{% content-ref url="/pages/cWXsdGlI5eU0t0tavhpq" %}
[Assistant Types](/reference/assistant-sdk-reference/types/assistant-types)
{% endcontent-ref %}

{% content-ref url="/pages/kFYC80qPylx4Qb3gkF7O" %}
[Trigger Types](/reference/assistant-sdk-reference/types/trigger-types)
{% endcontent-ref %}


# Assistant Types

## AudioSource: <mark style="color:green;">\<Object></mark>

| Property                                                                                  | Description                                             |
| ----------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| `onData: (data:` [`RTCAudioData`](#rtcaudiodata-less-than-object-greater-than)`) => void` | Raw PCM-encoded audio samples to inject in to the room. |

## AudioSink: <mark style="color:green;">\<Object></mark>

| Property                                                                                                               | Description                                                                                                   |
| ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| `subscribe: (callback: (data:` [`RTCAudioData`](#rtcaudiodata-less-than-object-greater-than)`) => void) => () => void` | Subscribe to live raw PCM-encoded audio samples received from the room delivered at 10 millisecond intervals. |

## VideoSource: <mark style="color:green;">\<Object></mark>

| Property                                                                                   | Description                                              |
| ------------------------------------------------------------------------------------------ | -------------------------------------------------------- |
| `onFrame: (data:` [`RTCVideoData`](#rtcvideodata-less-than-object-greater-than)`) => void` | Raw I420-encoded video samples to inject in to the room. |

## VideoSink: <mark style="color:green;">\<Object></mark>

| Property                                                                                                               | Description                                                                                                                                                             |
| ---------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `subscribe: (callback: (data:` [`RTCVideoData`](#rtcvideodata-less-than-object-greater-than)`) => void) => () => void` | Subscribe to live raw I420-encoded video frames received from the room delivered at the input video's frame rate (e.g. 24 frames per second = every \~42 milliseconds). |

## RTCAudioData: <mark style="color:green;">\<Object></mark>

| Property                 | Description                                  |
| ------------------------ | -------------------------------------------- |
| `sampleRate: number`     | Sample rate of data (in Hertz)               |
| `samples: Int16Array`    | Raw PCM audio sample data                    |
| `channelCount: number`   | Number of PCM channels in data. Default: `1` |
| `bitsPerSample: number`  | Number of bits per sample. Default: `16`     |
| `numberOfFrames: number` | Number of frames represented in `samples`    |

## RTCVideoData: <mark style="color:green;">\<Object></mark>

| Property                  | Description                            |
| ------------------------- | -------------------------------------- |
| `width: number`           | Video width (in pixels)                |
| `height: number`          | Video height (in pixels)               |
| `data: Uint8ClampedArray` | Raw I420 video sample data             |
| `rotation: number`        | Orientation of the video. Default: `0` |


# Trigger Types

## WherebyWebhookTriggers: <mark style="color:green;">\<Object></mark>

<table><thead><tr><th width="390.96484375">Property</th><th width="173.77734375">Default</th><th>Description</th></tr></thead><tbody><tr><td><p><code>"room.client.joined": (</code></p><p><code>webhookData:</code> <a href="#wherebywebhookroomclientjoined-less-than-object-greater-than"><code>WherebyWebhookRoomClientJoined</code></a> <code>) => Promise&#x3C;boolean> | boolean</code></p></td><td><code>() => false</code></td><td>Custom matcher on incoming <a href="/whereby-product-features/insights-suite-and-api/webhooks">"room.client.joined" webhook events</a>. Return <code>true</code> if a match should be triggered or <code>false</code> otherwise.</td></tr><tr><td><p><code>"room.client.left": (</code></p><p><code>webhookData:</code> <a href="#wherebywebhookroomclientleft-less-than-object-greater-than"><code>WherebyWebhookRoomClientLeft</code></a> <code>) => Promise&#x3C;boolean> | boolean</code></p></td><td><code>() => false</code></td><td>Custom matcher on incoming <a href="/whereby-product-features/insights-suite-and-api/webhooks">"room.client.left" webhook events</a>. Return <code>true</code> if a match should be triggered or <code>false</code> otherwise.</td></tr><tr><td><p><code>"room.session.started": (</code></p><p><code>webhookData:</code> <a href="#wherebywebhookroomsessionstarted-less-than-object-greater-than"><code>WherebyWebhookRoomSessionStarted</code></a> <code>) => Promise&#x3C;boolean> | boolean</code></p></td><td><code>() => false</code></td><td>Custom matcher on incoming <a href="/whereby-product-features/insights-suite-and-api/webhooks">"room.session.started" webhook events.</a> Return <code>true</code> if a match should be triggered or <code>false</code> otherwise.</td></tr><tr><td><p><code>"room.session.ended": (</code></p><p><code>webhookData:</code> <a href="#wherebywebhookroomsessionended-less-than-object-greater-than"><code>WherebyWebhookRoomSessionEnded</code></a> <code>) => Promise&#x3C;boolean> | boolean</code></p></td><td><code>() => false</code></td><td>Custom matcher on incoming <a href="/whereby-product-features/insights-suite-and-api/webhooks">"room.session.ended" webhook events.</a> Return <code>true</code> if a match should be triggered or <code>false</code> otherwise.</td></tr><tr><td><code>"assistant.requested": (webhookData:</code><a href="#wherebywebhookassistantrequested-less-than-object-greater-than"> <code>WherebyWebhookAssistantRequested</code></a><code>) => Promise&#x3C;boolean> | boolean</code></td><td><code>() => false</code></td><td>Custom matcher on incoming <a href="/whereby-product-features/insights-suite-and-api/webhooks">"assistant.requested" webhook events.</a> Return <code>true</code> if a match should be triggered or <code>false</code> otherwise.</td></tr></tbody></table>

## WherebyWebhookBase: <mark style="color:green;">\<Object></mark>

| Property            | Description                    |
| ------------------- | ------------------------------ |
| `type: WebhookType` | Type of webhook                |
| `apiVersion: 1.0`   | API version                    |
| `id: string`        | Webhook ID                     |
| `createdAt: string` | Time the webhook was generated |

## WherebyWebhookInRoom: <mark style="color:green;">\<Object></mark>

<table><thead><tr><th width="300.578125">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>meetingId?: string</code></td><td>Meeting identifier from the meeting that the webhook was fired from</td></tr><tr><td><code>roomName: string</code></td><td>Name of the room from which the webhook was fired from</td></tr><tr><td><code>roomSessionId: string | null</code></td><td>Session ID of the meeting that the webhook was fired from (if any)</td></tr><tr><td><code>subdoman: string</code></td><td>The subdomain identifier for your organization</td></tr></tbody></table>

## WherebyWebhookDataClient: <mark style="color:green;">\<Object></mark>

<table><thead><tr><th width="302.49609375">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>displayName: string</code></td><td>Display name of the participant</td></tr><tr><td><code>participantId: string</code></td><td>Unique identifier for the participant</td></tr><tr><td><code>metadata: string | null</code></td><td>Custom metadata attached to the webhook</td></tr><tr><td><code>externalId: string | null</code></td><td>Custom identifier attached to the webhook</td></tr></tbody></table>

## WherebyWebhookDataClientJoinLeave: <mark style="color:green;">\<Object></mark>

<table><thead><tr><th width="303.4140625">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>roleName:</code> <a href="#wherebyrolename-less-than-string-greater-than"><code>WherebyRoleName</code></a></td><td>Role name of the client</td></tr><tr><td><code>numClients: number</code></td><td>Number of clients</td></tr><tr><td><code>numClientsByRoleName: Record&#x3C;</code><a href="#wherebyrolename-less-than-string-greater-than"><code>WherebyRoleName</code></a><code>, number></code></td><td>Number of clients grouped by role name</td></tr></tbody></table>

## WherebyWebhookRoomClientJoined: <mark style="color:green;">\<Object></mark>

Extends [WherebyWebhookBase](#wherebywebhookbase-less-than-object-greater-than)

| Property                                                                                                                                                                                                                                                                                    | Description           |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| `data:` [`WherebyWebhookInRoom`](#wherebywebhookinroom-less-than-object-greater-than) `&` [`WherebyWebhookDataClientJoinLeave`](#wherebywebhookdataclientjoinleave-less-than-object-greater-than) `&` [`WherebyWebhookDataClient`](#wherebywebhookdataclient-less-than-object-greater-than) | Payload of this event |

## WherebyWebhookRoomClientLeft: <mark style="color:green;">\<Object></mark>

Extends [WherebyWebhookBase](#wherebywebhookbase-less-than-object-greater-than)

| Property                                                                                                                                                                                                                                                                                    | Description           |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| `data:` [`WherebyWebhookInRoom`](#wherebywebhookinroom-less-than-object-greater-than) `&` [`WherebyWebhookDataClientJoinLeave`](#wherebywebhookdataclientjoinleave-less-than-object-greater-than) `&` [`WherebyWebhookDataClient`](#wherebywebhookdataclient-less-than-object-greater-than) | Payload of this event |

## WherebyWebhookRoomSessionStarted: <mark style="color:green;">\<Object></mark>

Extends [WherebyWebhookBase](#wherebywebhookbase-less-than-object-greater-than)

| Property                                                                              | Description           |
| ------------------------------------------------------------------------------------- | --------------------- |
| `data:` [`WherebyWebhookInRoom`](#wherebywebhookinroom-less-than-object-greater-than) | Payload of this event |

## WherebyWebhookRoomSessionEnded: <mark style="color:green;">\<Object></mark>

Extends [WherebyWebhookBase](#wherebywebhookbase-less-than-object-greater-than)

| Property                                                                              | Description           |
| ------------------------------------------------------------------------------------- | --------------------- |
| `data:` [`WherebyWebhookInRoom`](#wherebywebhookinroom-less-than-object-greater-than) | Payload of this event |

## WherebyWebhookAssistantRequested: <mark style="color:green;">\<Object></mark>

Extends [WherebyWebhookBase](#wherebywebhookbase-less-than-object-greater-than)

| Property                                                                              | Description           |
| ------------------------------------------------------------------------------------- | --------------------- |
| `data:` [`WherebyWebhookInRoom`](#wherebywebhookinroom-less-than-object-greater-than) | Payload of this event |

## WherebyRoleName: <mark style="color:green;">\<string></mark>

| Type                |
| ------------------- |
| "`owner"`           |
| `"member"`          |
| `"host"`            |
| `"granted_visitor"` |
| `"viewer"`          |
| `"granted_viewer"`  |
| `"recorder"`        |
| `"streamer"`        |
| `"captioner"`       |
| `"assistant"`       |


# React SDK Reference

The Whereby browser SDK includes React hooks and components which allow integrating a fully custom video experience into your web application.

{% hint style="warning" %}
This is the documentation for version 3x of Whereby's browser-sdk. If you are still on version 2x, please refer to the [legacy documentation here](https://whereby.gitbook.io/legacy-docs). If you are upgrading from version 2x, please see the [migration guide](/whereby-for-web-browser/react-based-browser-sdk/migrate-from-version-2.x-to-3).
{% endhint %}

Check out our toolkit helping your designers plan and implement video call experiences

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th data-hidden></th><th data-hidden></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>Video Call UI Kit</td><td></td><td></td><td><a href="https://www.figma.com/community/file/1411023646481069706/video-call-ui-kit-by-whereby">https://www.figma.com/community/file/1411023646481069706/video-call-ui-kit-by-whereby</a></td><td><a href="https://888889433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLH2UIJDLc2EElQvYUxWX%2Fuploads%2FtDsegpoofcQHez5FdOoZ%2FDocs_landing%402x.jpg?alt=media&amp;token=f2f9bbb0-d9a5-4fb0-8b3a-9b52f09be49b">Docs_landing@2x.jpg</a></td></tr></tbody></table>

## Getting started

### Installation

Install the `@whereby.com/browser-sdk` package from the public [npm registry](https://www.npmjs.com/package/@whereby.com/browser-sdk).

{% tabs %}
{% tab title="npm" %}

```bash
npm install @whereby.com/browser-sdk
```

{% endtab %}

{% tab title="yarn" %}

```bash
yarn add @whereby.com/browser-sdk
```

{% endtab %}

{% tab title="pnpm" %}

```bash
pnpm add @whereby.com/browser-sdk
```

{% endtab %}
{% endtabs %}

## Quick Start

{% content-ref url="/pages/V0f2EicuA3ay0WktbtUH" %}
[Browser SDK quickstart](/whereby-for-web-browser/react-based-browser-sdk/quick-start)
{% endcontent-ref %}

## Available hooks

{% content-ref url="/pages/lFZVOkmKDjatvjJ73nZp" %}
[useRoomConnection](/reference/react-hooks-reference/useroomconnection)
{% endcontent-ref %}

{% content-ref url="/pages/qQCrPmO3YprhnACT2uqr" %}
[useLocalMedia](/reference/react-hooks-reference/uselocalmedia)
{% endcontent-ref %}

## Available components

{% content-ref url="/pages/IKcS58kC3R86uFILom3u" %}
[WherebyProvider](/reference/react-hooks-reference/wherebyprovider)
{% endcontent-ref %}

{% content-ref url="/pages/mi6qgWPgNsMhg1cxfq2D" %}
[VideoView](/reference/react-hooks-reference/videoview)
{% endcontent-ref %}

{% content-ref url="/pages/QcsZlPYhpGaBPb6enUwl" %}
[VideoGrid](/reference/react-hooks-reference/videogrid)
{% endcontent-ref %}


# WherebyProvider

```jsx
<WherebyProvider />
```

The `WherebyProvider` is necessary so that every component in the app, has access to Whereby's internal state.

## Usage

```tsx
import * as React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import App from './App'
import { WherebyProvider } from '@whereby.com/browser-sdk/react'

ReactDOM.render(
  <WherebyProvider>
    <App />
  </WherebyProvider>,
  document.getElementById('root')
)
```




---

[Next Page](https://docs.whereby.com/llms-full.txt/1)

