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/captureHeaders Parameters
REQUIRED
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
quality | orientation | width(default) | height(default) |
---|---|---|---|
high | landscape | 1920 | 1080 |
med | landscape | 1280 | 720 |
low | landscape | 854 | 480 |
high | portrait | 1080 | 1920 |
med | portrait | 720 | 1280 |
low | portrait | 480 | 854 |
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)
POST
|
https://api.videosdk.live/v2/hls/capture
NodeJS
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