Guide to Interactive streaming

This guides explains you on how to build interactive live streaming apps via conferencing SDK.

Generate an API Key for your project

  1. Generate a Bearer Token

  2. Creating a Conference Room

  3. Alternative to Creating a Conference Room

  4. Start Live Streaming

  5. Stop Live Streaming

  6. Streaming to Multiple Outlets

Generate API Key

You can generate your API key for your project by visiting and signing up.

The full instruction on how to do it can be found here: Link

Generate a Bearer Token

We generate these authentication tokens on our own servers. You can use the same token for all the services offered by Sariska.

To generate a token, follow the instruction on the page here

“user” data in the above curl command is optional and the bearer token is generated regardless of it.

Creating a Conference Room for Your Live Stream

In order to start a multi host live stream, all the hosts need to join a common room. The name for this common room can be anything the hosts choose to. This part details on how to create a simple conference for your hosts to live stream.


The first step is to install the sariska-media-transport library by running the following command in your project directory using NPM.

npm i sariska-media-transport

Initialise SDK:

After installing the SDK, perform initial setup tasks by running initialize().

import SariskaMediaTransport from "sariska-media-transport";


Create Connection:

To establish a connection, you would need to generate a token. You’d also need to specify a room name, this is the room your hosts will join to live stream together.

const token = {your-bearer-token};

const connection = new SariskaMediaTransport.JitsiConnection(token, "{room-name}", isNightly);

connection.addEventListener(, () => {
  console.log('connection successful!!!');

connection.addEventListener(, (error) => {
  if (error  === { // token expired set again
      connection.setToken(token) // set a new token
      console.log('connection disconnect!!!', error);

connection.addEventListener(, (error) => {
  console.log('connection disconnect!!!', error);


Create Conference:

Once you have your connection established, the next step is to create a conference.

const conference = connection.initJitsiConference(options);

//Additional options initJitsiConference accepts to enable more features

// startAudioMuted: true  // to join with  audio muted
// startVideoMuted: true // to join with video muted
// startSilent : true  // to join with startSilent no audio receive/send
// rtcstatsServer:  “”  // to send enable rtcstats tracking
// callStatsID: “”    // callstatsid
// callStatsSecret:  “”   // callstatssecet
// channelLastN: 10  // last n speakers

Now, the conferenceobject will have all events and methods that you would possibly need for any feature that you wish to supplement your application with.

Capture local streams:

A MediaStream consists of zero or more MediaStreamTrack objects, representing various audio or video tracks. Each MediaStreamTrack may have one or more channels. The channel represents the smallest unit of a media stream, such as an audio signal associated with a given speaker, like left or right in a stereo audio track. Here we mostly talk about track.

const options = {
  devices: ["audio", "video"],
  resolution: 240, // 180,  240,  360, vga, 480, qhd, 540, hd, 720, fullhd, 1080, 4k, 2160

const localTracks = await SariskaMediaTransport.createLocalTracks(options);

Play Local stream:

const audioTrack = localTracks.find(track=>track.getType()==="audio");
const videoTrack = localTracks.find(track=>track.getType()==="video");

// to play audio 

// to play video

User Joined:

The moderator of the meeting controls and gate keeps the participants. The moderator has exclusive control of the meeting.

conference.addEventListener(, function(id, participant) {
  console.log("user joined!!!", id, participant);

Publish your stream to other peers:

localTracks.forEach(track => conference.addTrack(track));

Playing remote peers streams:

const remoteTracks = [];

conference.addEventListener(, function(track) {

remoteTracks.forEach(track => {
    if (track.getType() === "audio") {
    if (track.getType() === "video") {

Alternative to Creating a Conference Room

If you’d like to quickly test the live streams without having to create a conference, you can use Sariska’s meet application.

let’s say the room name for our case is “streamtest”. Since we are using Sariska’s meet app to run this demo, you can go to

Start Live Streaming

With Sariska, starting a live stream is just a simple API call away. Generate another bearer token and then follow the curl command.

For example, the curl command will look something like this for a room “streamtest”.

curl --location --request GET '<>' \\
		 --header 'Authorization: Bearer {your-bearer-token}' \
		 --data-raw '{        
        	      "room_name": String,  
                      "is_low_latency": true         	              

The sample response for such a request will be

    "started": true,
    "stream_name": "hvfypdujkrpa1gtl",
    "pod_name": "gstreamer-pipeline-bf569469d-v7wjb",
    "hls_url": "",
    "hls_master_url": "",
    "low_latency_hls_url": "",
    "rtmp_url": "rtmp://",
    "flv_url": "",
    "vod_url": ""

Stop Live Streaming

curl --location --request GET '<>' \\
--header 'Authorization: Bearer {your-bearer-token}' 

Sample Response:

	"started": false

Streaming To Multiple Outlets

If you’d like to stream to platforms such as Youtube, Facebook, or Twitch. You can send a request like shown below.

curl --location --request GET '<>' \\
		 --header 'Authorization: Bearer {your-bearer-token}'
		 --data '{"streamKeys": [
		{"streamKey": "youtube", "streamValue": "youtube-stream-key"}, 
		{"streamKey": "facebook", "streamValue": "facebook-stream-key"}, 
		{"streamKey": "twitch", "streamValue": "twitch-stream-key"}, 
		{"streamKey": "vimeo", "streamValue": "vimeo-stream-key"}, 
		{"streamKey": "periscope", "streamValue": "periscope-stream-key"}, 
		{"streamKey": "instagram", "streamValue": "instagram-stream-key"}
			"streamUrls":["rtmp://test-rtmp-url-1", "rtmp://test-rtmp-url-2"],
  • streamKeys (optional): Streaming keys for all the platforms you want to stream at

  • streamUrls (optional): RTMP Url Endpoints

  • is_recording (optional): Flag to state if you’d like to record the meeting

  • is_vod (optional): Flag to state if you’d like to provide this stream as a VOD

  • audio_only (optional): Flag true if you’d like it to be an audio only stream

For detailed information, please refer to the Swagger documentation.

Last updated