Start Multiple Livestream - API
This API lets you start multiple livestream by passing roomId, resourceId, outputs and config object as body parameters.
HTTP method and endpoint
POST
|
https://api.videosdk.live/v2/resource/livestreams/startHeaders 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.
REQUIRED
The ResourcId of the Resource.
REQUIRED
Array of object which contains multiple platfroms streamKey and url.
Make sure the stream key is correctly assigned, and if you're using a dynamic key, confirm that it's valid.
OPTIONAL
- config:
- layout:
- type: "GRID" | "SPOTLIGHT" | "SIDEBAR"
- priority: "SPEAKER" | "PIN"
- gridSize: Number
max 4
- theme: "DARK" | "LIGHT" | "DEFAULT"
- layout:
POST
|
https://api.videosdk.live/v2/resource/livestreams/start
NodeJS
import fetch from 'node-fetch';
const options = {
method: "POST",
headers: {
"Authorization": "$YOUR_TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify({
"roomId" : "xyz",
"resourceId" : "abcdef9879288c1f48339f64",
"outputs" : "[{ streamKey: 'Platform_StreamKey', url: 'RTMP-URL' }]",
"config" : "configObj",
"templateUrl" : "https://www.example.com/?token=token&meetingId=74v5-v21l-n1ey&participantId=RECORDER_ID"
}),
};
const url= `https://api.videosdk.live/v2/resource/livestreams/start`;
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
RESPONSE
{
"success": true,
"data": {
"id": "abcdef9879288c1f48339f54"
}
}
Got a Question? Ask us on discord