***
id: aabf386c-d944-4b2d-a73c-108cae08af1f
title: startStream
slug: /node/reference/video/room-session/start-stream
description: startStream method for the RoomSession class.
max-toc-depth: 3
----------------
[roomsession-41]: /docs/server-sdk/v4/node/reference/video/room-session
[roomsessionstream-8]: /docs/server-sdk/v4/node/reference/video/room-session-stream
[video-roomsessionstream]: /docs/server-sdk/v4/node/reference/video/room-session-stream#events
### startStream
* **startStream**(): `Promise`\<[`RoomSessionStream`][roomsessionstream-8]>
Starts streaming the audio/video of this room to an external service. You can
use the returned [`RoomSessionStream`][roomsessionstream-8] object to
interact with the stream.
#### Parameters
Object containing the parameters of the method.
RTMP or RTMPS url. This must be the address of a server accepting incoming RTMP/RTMPS streams.
Object of event listeners. See [RoomSessionStream Events][video-roomsessionstream] for a list of valid events.
#### Returns
`Promise`\<[`RoomSessionStream`][roomsessionstream-8]>
A promise that resolves to a [`RoomSessionStream`][roomsessionstream-8] object.
#### Example
In this example, we wait for a room to start and then start a stream in that room.
We then stop the stream after 10 seconds. This example assumes that there is a [`RoomSession`][roomsession-41]
already active and that members are joining the room.
```javascript
import { SignalWire } from "@signalwire/realtime-api";
// Initialize the SignalWire client
const client = await SignalWire({ project: "ProjectID Here", token: "Token Here" });
// Access video client from the main client
const videoClient = client.video;
// Setup listener for when a room starts
await videoClient.listen({
onRoomStarted: async (roomSession) => {
console.log("Room started", roomSession.displayName);
roomSession.startStream({
url: "rtmp://example.com/stream"
})
await roomSession.listen({
onStreamStarted: async (stream) => {
console.log("Stream started", stream.state);
// Wait 10 seconds and stop the stream
setTimeout(() => {
console.log("Stopping stream");
stream.stop();
}, 10000);
},
onStreamEnded: (stream) => {
console.log("Stream ended", stream.id, stream.state);
},
});
},
onRoomEnded: async (roomSession) => {
console.log("Room ended", roomSession.displayName);
}
});
```