> This page is for Browser SDK, version v3.
> For other versions, use one of these documentation indexes:
> - v4 (default): https://signalwire.com/docs/browser-sdk/v4/llms.txt
> - v3: https://signalwire.com/docs/browser-sdk/v3/llms.txt
> - v2: https://signalwire.com/docs/browser-sdk/v2/llms.txt

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# setLocalStream

> setLocalStream method for the RoomSession class.

### setLocalStream

* **setLocalStream**(`stream`): `void`

Replaces the current local media stream with the one specified as a parameter.

#### Parameters

**`stream`** `MediaStream`

The media stream to use.

---

#### Returns

`void`

#### Example

Drawing and streaming the picture of a face:

```javascript
const canvas = document.createElement("canvas");
const ctx = canvas.getContext("2d");

// Set canvas size
canvas.width = 400;
canvas.height = 400;

// Draw circle
ctx.beginPath();
ctx.arc(200, 200, 150, 0, 2 * Math.PI);
ctx.fillStyle = "lightblue";
ctx.fill();

// Draw eyes
ctx.beginPath();
ctx.arc(150, 150, 30, 0, 2 * Math.PI);
ctx.arc(250, 150, 30, 0, 2 * Math.PI);
ctx.fillStyle = "black";
ctx.fill();

// Get the media stream
const stream = canvas.captureStream(25); // 25 FPS

// Stream the canvas
await roomSession.setLocalStream(stream);
```