/

Examples


With Interstitial Media Insertion, the target stream must be live for the duration of the broadcast. If the target (e.g. StreamA) is stopped while a second video Interstitial-0 is being displayed then subscribers will be disconnected.

It is recommended to switch back (resume) the original source stream in between interstitial inserts. Adding multiple Interstitials leads to layering of stream dependencies and will require resuming multiple times to get back to the original stream content.

For example:

Interstitial Media Insertion into StreamA

Start by broadcasting your target stream (StreamA). A second broadcaster publishes Interstitial-0, and a third broadcaster publishes Interstitial-1.

Example 1:

  • Switch StreamA with Interstitial-0 audio and video
  • Resume StreamA - Interstitial-0 publisher can stop
  • Switch StreamA with Interstitial-1 audio and video
  • Resume StreamA - Interstitial-1 publisher can stop

If you bypass the resume to StreamA, and instead go directly from Interstitial-0 to Interstitial-1, you would need to do the following:

Example 2:

  • Switch StreamA with Interstitial-0 audio and video
  • Switch Interstitial-0 with Interstitial-1 audio and video all three broadcasters must be live at this time
  • Resume Interstitial-0 - Interstitial-1 publisher can stop
  • Resume StreamA - Interstitial-0 publisher can stop

In the above Example 2 scenario, if either StreamA or Interstitial-0 stops while Interstitial-1 is streaming, then all subscribers would be disconnected.

Inserting video while keeping original audio

The following example shows how to correctly swap in the video from multiple sources as insterstitial streams while keeping the original audio.

Switches streamA to:

  • StreamA with streamB video.
  • StreamA with streamC video.
  • Back to streamA with streamB video.
  • Back to streamA video and audio.
//using optional id property
static X = 0;

Add
{//overlay streamB V on streamA
id='0';
target = streamA
interstitial = streamB
interstitialVideo = true
interstitialAudio = false
type = indefinite
}

After switch add another and then call resume at will.

Add
{//overlay streamC V on streamA
id='1';
target = streamA
interstitial = streamC
interstitialVideo = true
interstitialAudio = false
type = indefinite
}

resume streamA 

This will deactivate interstitial 0 make the next interstitial 1 active.

After switch add another and then call resume at will.

Add

{//overlay streamB V on streamA
id='2';
target = streamA
interstitial = streamB
interstitialVideo = true
interstitialAudio = false
type = indefinite
}

resume streamA

This will deactivate interstitial 1 make the next interstitial 2 active.

resume streamA

This second call will deactivate interstitial 2 and resume to all streamA audio and video.

NOTE: Interstitials are ordered by first by start time and secondly by ID.

WebRTC Examples

Standalone Subscribe - Interstitial Media Insertion

Stream Manager Proxy Subscribe - Interstitial Media Insertion