RTMP
The rtmp resource pushes a room to external RTMP destinations such as YouTube, Twitch, or any RTMP endpoint. Start a stream with start, and stop it with stop by passing its room id.
Start a live stream
At least one destination is required, and a layout must be specified.
- Node.js
- Go
- Rust
await client.rtmp.start(roomId, {
streams: [{ url: "rtmp://a.rtmp.youtube.com/live2", streamKey: "yt_streamkey" }],
composition: { layout: "spotlight", quality: "high" },
});
client.RTMP.Start(ctx, roomID, videosdk.RTMPStartParams{
Streams: []videosdk.RTMPStream{{URL: "rtmp://a.rtmp.youtube.com/live2", StreamKey: "yt_streamkey"}},
Composition: &videosdk.Composition{Layout: videosdk.CompositionLayoutSpotlight, Quality: videosdk.Ptr(videosdk.CompositionQualityHigh)},
})
client.rtmp().start(&room_id, RtmpStartParams {
streams: vec![RtmpStream {
url: "rtmp://a.rtmp.youtube.com/live2".into(),
stream_key: "yt_streamkey".into(),
}],
composition: Some(Composition {
layout: Some(CompositionLayout::Spotlight),
quality: Some(CompositionQuality::High),
..Default::default()
}),
..Default::default()
}).await?;
Options: streams (required), composition (see Composition), transcription, resourceId.
Stop
- Node.js
- Go
- Rust
await client.rtmp.stop(roomId);
client.RTMP.Stop(ctx, videosdk.EgressHandle{RoomID: roomID})
client.rtmp().stop(&room_id).await?;
List and get
- Node.js
- Go
- Rust
await client.rtmp.list({ roomId });
await client.rtmp.get(id);
client.RTMP.List(ctx, videosdk.RTMPListParams{RoomID: videosdk.String(roomID)})
client.RTMP.Get(ctx, id)
client.rtmp().list(RtmpListParams { room_id: Some(room_id.clone()), ..Default::default() }).await?;
client.rtmp().get(&id).await?;
The livestream object
rtmp.list and get return this object.
| Field | Type | Description |
|---|---|---|
id | string | Livestream id. |
roomId | string | Room this livestream belongs to. |
sessionId | string | Session this livestream belongs to. |
region | string | Region the livestream runs in. |
outputs | object[] | RTMP destinations, each with url and streamKey. |
start | string | Start time (ISO-8601). |
end | string | End time, null while running. |
Composition
The composition option controls the layout and rendering of the stream. Provide a named layout or a custom template URL.
| Field | Values |
|---|---|
layout | grid, spotlight, sidebar, or a custom template URL |
priority | SPEAKER or PIN |
gridSize | tiles in grid, 0-25 (default 25) |
orientation | portrait or landscape |
theme | DARK, LIGHT, or DEFAULT |
quality | low, med, high, or ultra |
There is no resolution option. Use quality.
Got a Question? Ask us on discord

