Backstage

Introduction

By default, livestreams are created in backstage mode, while in backstage mode, streams can only be accessed by admin-like users. This is necessary because it makes it possible to create the setup in advance and to notify and grant access to viewers when the event starts. To allow regular users to join a call ahead of time, even if the call is still in backstage mode you can create the call and set the join ahead time backstage setting. The default value of join_ahead_time_seconds is 0, which means that users can only join the call when the call starts.

Configuration

To create a call in backstage mode and allow users to join ahead of the scheduled time you can use the join_ahead_time_seconds settings option.

startsAt = new Date(Date.now() + 30 * 60 * 1000);
client.video.call("livestream", "test-outgoing-call").getOrCreate({
  data: {
    starts_at: startsAt,
    created_by_id: "john",
    settings_override: {
      backstage: {
        enabled: true,
        join_ahead_time_seconds: 300,
      },
    },
  },
});

You can change the backstage mode and join ahead time settings on the call type or on the call level. Allowing the users to join a call in backstage is optional.

// call level
call.update({
  settings_override: {
    backstage: {
      enabled: true,
      join_ahead_time_seconds: 300,
    },
  },
});

// or call type level
client.video.updateCallType({
  name: "<call type name>",
  settings: {
    backstage: {
      enabled: true,
      join_ahead_time_seconds: 300,
    },
  },
});

Setting the backstage mode to false means that calls won’t be created in backstage mode, and anyone can join the call.

Backstage Permissions

When a call is in backstage mode, only users with the join-backstage capability are allowed to join.

client.video.updateCallType({
  name: "<call type name>",
  grants: {
    host: [OwnCapability.JOIN_BACKSTAGE],
  },
});

With this approach you can add multiple members that have the join-backstage capability, which allows you to have multiple hosts. Or, you can bypass this check and allow users to join by creating time with specifying the join_ahead_time_seconds backstage option.

Go Live

When the hosts are ready to start the stream and allow viewers to join, you can call the GoLive method.

This method will automatically start the following processes if those are set to auto-on:

  • HLS broadcast
  • Closed captions
  • Transcription
  • Recording starts in backstage mode, so it’s already on at this point

If you set any of the above processes to available you can start them with a corresponding flag.

call.goLive();

// Optionally start processes that are set to `available`
call.goLive({
  // Optionally start HLS broadcast
  start_hls: true,
  // Optionally start recording the call
  start_recording: true,
  // Optionally start displaying closed captions for call participants
  start_closed_caption: true,
  // Optionally start saving the call transcription to a file
  start_transcription: true,
  // Optionally select storage for the recording file (if none is specified, the default storage will be used)
  recording_storage_name: "<storage name>",
  // Optionally select storage for the transcription file (if none is specified, the default storage will be used)
  transcription_storage_name: "<storage name",
});

It’s also possible to send push notifications to call members on this event, for more information see the Call Types page.

Stop Live

When the stream ends the StopLive endpoint will remove the viewers that are still in the call, and prevent from new viewers to join.

The stop live endpoint will automatically do the followings unless you specify otherwise:

  • Stop HLS broadcast
  • Stop recording
  • Stop closed captions
  • Stop transcriptions

A call can enter and leave backstage mode multiple times.

call.stopLive();

call.stopLive({
  // Optionally prevent stoping HLS broadcast
  continue_hls: true,
  // Optionally prevent stoping recording
  continue_recording: true,
  // Optionally prevent stoping closed captions
  continue_closed_caption: true,
  // Optionally prevent stoping call transcription
  continue_transcription: true,
});
© Getstream.io, Inc. All Rights Reserved.