Skip to main content
Version: /v2

This API lets you capture a thumbnail from the ongoing HLS stream in different formats.

HTTP method and endpoint

POST

|

https://api.videosdk.live/v2/hls/capture
Headers Parameters

values : YOUR_TOKEN_WITHOUT_ANY_PREFIX

This will be a JWT token generate using VideoSDK ApiKey and Secret.

Note that the token will not include any prefix such as "Basic " or "Bearer ". Just pass a token as value.

You can generate a new token by refering this Guide: Generate Auth token

REQUIRED

values : application/json

This is usefull for json body parameters, so that VideoSDK servers can understand that the incoming body parameter will be a JSON string.

Body Parameters
REQUIRED
The ID of the Room.
OPTIONAL
Time in seconds when the thumbnail should be captured (if not specified: it will take real time capture)
OPTIONAL
Specifies width for the thumbnail which is to be captured
OPTIONAL

Specifies height for the thumbnail which is to be captured

default values for width and height

qualityorientationwidth(default)height(default)
highlandscape19201080
medlandscape1280720
lowlandscape854480
highportrait10801920
medportrait7201280
lowportrait480854
OPTIONAL
Specifies file format for the thumbnail which is to be captured. supported formats are jpg(default), png and webp (webp only supports in realtime)
Response Parameters
response message.
The ID of the Room.
metadata of the file. that includes file createdAt, width, height and format.
filepath url of captured file in HLS stream.
size of captured file in HLS stream.
name of captured file in HLS stream.
POST
|
https://api.videosdk.live/v2/hls/capture
import fetch from 'node-fetch';
const options = {
method: "POST",
headers: {
"Authorization": "$YOUR_TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify({
"roomId" : "abcd-abcd-abcd",
"time" : "1",
"width" : "see example",
"height" : "see example",
"format" : "jpg"
}),
};
const url= `https://api.videosdk.live/v2/hls/capture`;
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
RESPONSE
{
"message": "captured thumbnail successfully",
"roomId": "abcd-abcd-abcd",
"meta": {
"createdAt": "2023-10-19T07:24:55.195Z",
"width": 1280,
"height": 720,
"format": "jpg"
},
"filePath": "<cdn url>",
"fileSize": 415153,
"fileName": "<filename>"
}

Got a Question? Ask us on discord