Skip to main content

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.

await client.rtmp.start(roomId, {
streams: [{ url: "rtmp://a.rtmp.youtube.com/live2", streamKey: "yt_streamkey" }],
composition: { layout: "spotlight", quality: "high" },
});

Options: streams (required), composition (see Composition), transcription, resourceId.

Stop

await client.rtmp.stop(roomId);

List and get

await client.rtmp.list({ roomId });
await client.rtmp.get(id);

The livestream object

rtmp.list and get return this object.

FieldTypeDescription
idstringLivestream id.
roomIdstringRoom this livestream belongs to.
sessionIdstringSession this livestream belongs to.
regionstringRegion the livestream runs in.
outputsobject[]RTMP destinations, each with url and streamKey.
startstringStart time (ISO-8601).
endstringEnd 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.

FieldValues
layoutgrid, spotlight, sidebar, or a custom template URL
prioritySPEAKER or PIN
gridSizetiles in grid, 0-25 (default 25)
orientationportrait or landscape
themeDARK, LIGHT, or DEFAULT
qualitylow, med, high, or ultra

There is no resolution option. Use quality.

Got a Question? Ask us on discord