HLS
The hls resource runs HLS playback streams for broadcasting a meeting to a large audience. Start a stream with start, and stop it with stop by passing its room id.
Start HLS
- Node.js
- Go
- Rust
await client.hls.start(roomId, {
composition: { layout: "spotlight", quality: "high" },
});
client.HLS.Start(ctx, roomID, videosdk.HLSStartParams{
Composition: &videosdk.Composition{Layout: videosdk.CompositionLayoutSpotlight, Quality: videosdk.Ptr(videosdk.CompositionQualityHigh)},
})
client.hls().start(&room_id, HlsStartParams {
composition: Some(Composition {
layout: Some(CompositionLayout::Spotlight),
quality: Some(CompositionQuality::High),
..Default::default()
}),
..Default::default()
}).await?;
Options: composition (see Composition), transcription, webhookUrl, recording, templateUrl, resourceId.
Get the active stream
Returns the active stream with its playback URLs, or an error if none is active. Use getById / GetByID to fetch a stream by id rather than by room.
- Node.js
- Go
- Rust
const stream = await client.hls.get(roomId);
stream.playbackHlsUrl; // manifest URL for players
stream, err := client.HLS.Get(ctx, roomID)
fmt.Println(stream.PlaybackHLSURL) // manifest URL for players
let stream = client.hls().get(&room_id).await?;
println!("{:?}", stream.playback_hls_url); // manifest URL for players
Stop HLS
- Node.js
- Go
- Rust
await client.hls.stop(roomId);
client.HLS.Stop(ctx, videosdk.EgressHandle{RoomID: roomID})
client.hls().stop(&room_id).await?;
Capture a thumbnail
- Node.js
- Go
- Rust
await client.hls.capture({ roomId, format: "png", width: 1280, height: 720 });
client.HLS.Capture(ctx, videosdk.HLSCaptureParams{
RoomID: roomID,
Format: videosdk.HLSCapturePNG,
Width: videosdk.Int(1280),
Height: videosdk.Int(720),
})
client.hls().capture(HlsCaptureParams {
room_id: room_id.clone(),
format: Some(HlsCaptureFormat::Png),
width: Some(1280),
height: Some(720),
..Default::default()
}).await?;
Options: roomId (required), format (png, jpg, webp), width, height, time (seconds, omit to capture in real time).
List and delete
- Node.js
- Go
- Rust
await client.hls.list({ roomId });
await client.hls.delete(id);
client.HLS.List(ctx, videosdk.HLSListParams{RoomID: videosdk.String(roomID)})
client.HLS.Delete(ctx, id)
client.hls().list(HlsListParams { room_id: Some(room_id.clone()), ..Default::default() }).await?;
client.hls().delete(&id).await?;
The HLS stream object
hls.get, getById, and list return this object.
| Field | Type | Description |
|---|---|---|
id | string | HLS stream id. |
roomId | string | Room this stream belongs to. |
sessionId | string | Session this stream belongs to. |
quality | string | Stream quality. |
orientation | string | Video orientation. |
duration | number | Duration in seconds. |
playbackHlsUrl | string | HLS playback URL. |
livestreamUrl | string | Livestream URL. |
downstreamUrl | string | Downstream URL. |
start | string | Start time (ISO-8601). |
end | string | End time, null while live. |
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

