> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# 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

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);
```