SARISKA
Search
K
Comment on page

API's References for Live Streaming

The page describes api methods to start and stop a live streaming along with getting the live count of all the user watching a live stream.
post
https://api.sariska.io
/api/v1/misc/generate-token
Generate JWT Token to use with sariska services
Parameters
Body
apiKey
string
please pass apiKey with tied with your sariska account
user
object
exp
string
pass exp claim of jwt token
nbf
string
pass nbf claim of jwt token
scope
string
pass scope of token it can be messaging or media or sariska or leave it blank
Body
Example
Schema
{
"apiKey": "iufwenufewifweifiuTbddhbdjhjfbjfjwfjwfj",
"user": {
"id": "ytyVgh",
"name": "Nick",
"email": "[email protected]",
"avatar": "https://some-storage-location/nick.jpg"
},
"exp": "24 hours"
}
Responses
200: OK
A successfully generated response for jwt token
401: Unauthorized
Failed to generate token
post
https://api.sariska.io
/terraform/v1/hooks/srs/startRecording
Starts new live streaming
Parameters
Body
stream_keys
array
List of RTMP server keys for simulcast live streaming to all platforms, including Instagram, YouTube, Twitch, Vimeo, Periscope, Facebook, DLive, Mixcloud, and Restream.
stream_urls
array
This is a list of additional RTMP URLs for platforms not included in the above-listed platforms or host URL is dynamic
room_name
string
The room name recorder needs to join.
is_recording
boolean
Please set this flag to true if you want MP4 recordings of the live stream.
multi_bitrate
boolean
If `true` is passed, the stream will be transcoded into 5 different variants: 720p (HD), 480p (HD_MID), 360p (MID), 240p (MID_LOW), and 240p (LOW) with bitrates of 2628kbps, 1128kbps, 878kbps, 528kbps, and 264kbps, respectively. This will ensure the best possible viewing experience, regardless of the user's network or device.
is_vod
boolean
Please set this flag to true if you want to access the Video on Demand (VOD) URL. The VOD will be available after the live streaming has finished.
username
boolean
Please set this flag to true if you want the participant name to appear in the video tiles.
audio_only
boolean
Please set this flag to true if you want the streaming to be audio-only.
layout
string
By default, the live streaming layout is optimized for `desktop`. If you want it to be optimized for mobile, you can pass the flag `mobile`
profile
string
By default, `adaptive` bitrate streaming is enabled between the videobridge and recorder for each participant's stream. However, if you want to record and stream each participant's original quality, you can pass the flag as `HD`
reconnect_window
number
The default time interval for the recorder is 1 minute. If a different time interval is set, the recorder will remain active for that duration, and if all participants leave before the interval ends, a new streaming API call must be made to restart the recording.
Body
Example
Schema
{
"stream_keys": [
{
"key": "youtube",
"value": "youtube_stream_key"
},
{
"key": "facebook",
"value": "facebook_stream_key"
},
{
"key": "twitch",
"value": "twitch_stream_key"
},
{
"key": "vimeo",
"value": "vimeo_stream_key"
},
{
"key": "instagram",
"value": "instagram_stream_key"
}
],
"room_name": "room1234",
"layout": "mobile",
"profile": "HD",
"reconnect_window": "6000 equivalent to 1 min"
}
Responses
200: OK
A generated response after live streaming started successfully
400: Bad Request
Bad request
401: Unauthorized
Authenticatin token has expired
422: Unprocessable Entity
Not able to process your http request
502: Bad Gateway
Server crash
504: Gateway Timeout
Failed to start streaming within 30 seconds of time , if you receive this request then you can resend the request again.
post
https://api.sariska.io
/terraform/v1/hooks/srs/stopRecording
Stops already started live streaming
Parameters
Body
room_name
string
stops streaming of given room name
Body
Example
Schema
{
"room_name": "room1234"
}
Responses
200: OK
A generated response for successfully stopped streaming
400: Bad Request
Bad request
401: Unauthorized
Authenticatin token has expired
422: Unprocessable Entity
Not able to process your http request
502: Bad Gateway
Server crash
504: Gateway Timeout
Failed to stop streaming within 30 seconds of time , if you receive this request then you can resend the request again.
get
https://api.sariska.io
/terraform/v1/hooks/srs/live/viewers/count/{stream_name}
Get all live viewers count
Parameters
Path
stream_name*
string
Responses
200: OK
A generated response for fetching live hls users count
In order to test these APIs live, you can visit our swagger tool below.
Last modified 1d ago