Server-Side Ad Insertion (SSAI) plugin

The SSAI plugin allows you to serve ads that are dynamically inserted into video content at the server level before content is delivered to the viewer's device. This is in contrast to client-side ad insertion (CSAI), where the viewer's device inserts ads during playback. Ad insertion on the server side is typically in real-time or near real-time. SSAI offers several advantages over CSAI, such as:

  • Server-level ad insertion makes advertisements less susceptible to ad blockers used by viewers, resulting in higher delivery rates.
  • SSAI allows for more precise ad targeting based on real-time viewer data, leading to higher ad relevance and engagement.
  • Ads are seamlessly integrated into the video stream. Therefore, viewers experience smooth playback without buffering or quality degradation during ad transitions.

The SSAI plugin can be configured to work with Google's Interactive Media Ads Dynamic Ad Insertion (IMA DAI) SDK, with AWS Elemental MediaTailor, and with Yospace.

Before you start

Before you use this plugin with the standalone player, we recommend the following steps:

  • Read about embedding the core player in your site by adding the minimum CSS and JavaScript player components.
  • Make sure you have a player token. For more see, Token configuration . Tokens aren't needed for local development.
  • The instructions on this page generally assume you're using the Wowza Flowplayer CDN to embed the player in your site. If you're using npm, see our npm instructions or our TypeScript guide .

DAI considerations

For Google's IMA DAI integration to work with the SSAI plugin, consider the following before you start:

  • Access to a Google Ad Manager 360 Advanced account and a contract with Google to enable DAI.
  • To use IMA DAI pod serving, you must be working with a pod-serving partner.

MediaTailor considerations

For MediaTailor integrations to work with the SSAI plugin, consider the following before you start:

Install the plugin

To install the SSAI plugin, load it next to the core player:

CDN examplenpm example
Copy
Copied
<!-- Load standard player skin -->
<link rel="stylesheet" href="https://cdn.flowplayer.com/releases/native/3/stable/style/flowplayer.css">
<!-- Load player script -->
<script src="//cdn.flowplayer.com/releases/native/3/stable/flowplayer.min.js"></script>

<!-- Load plugin -->
<script src="//cdn.flowplayer.com/releases/native/3/stable/plugins/ssai.min.js"></script>
Copy
Copied
// Import player library and basic CSS for player
import flowplayer from "@flowplayer/player";
import "@flowplayer/player/flowplayer.css";

// Import plugin
import SSAI from "@flowplayer/player/plugins/ssai";

Add HTML elements

Add the HTML components to render the player elements on your page:

Copy
Copied
<div id="player"></div>

Configure with MediaTailor

You can configure the SSAI plugin for use with the Wowza Flowplayer and the AWS Elemental MediaTailor ad insertion service that runs in the AWS Cloud. Our MediaTailor integration supports Apple HTTP live Streaming (HLS) for video on demand (VOD) workflows and linear ads. The configuration with the player can point to your own MediaTailor stream or a Wowza Video media asset.

The following table outlines the required SSAI plugin configuration properties to set up the standalone player with your own AWS Elemental MediaTailor stream. The SSAI plugin is configured under the src namespace.

Property Description
type Must be set to the mediaTailor type to indicate that a MediaTailor stream is to be used with the SSAI plugin.
stream Defines the source URL for the your own MediaTailor stream. You must enable ad ID signaling for sessions and add the aws.adSignalingEnabled=true query parameter to your MediaTailor HLS URL.
Note
  • With a Wowza Video subscription, this same setup can be simplified. See Set up an SSAI schedule in Wowza Video for more details. If you use a Wowza Video asset, you must load the Wowza Video Platform Integration plugin and configure your player with a composite ID . This allows you to use the video ID for your VOD stream and the player configuration for the SSAI ad schedule from Wowza Video.
  • The SSAI ad schedule feature in Wowza Video is currently offered under limited availability, meaning the functionality is available to select Wowza Video users. If you need this functionality, please email us at customerservice@wowza.com .

Example

The following example demonstrates how to configure the player with the properties for your MediaTailor stream. You can also see how to add MediaTailor macros to pass custom metadata along with the ad request to the ad server. Replace placeholder values with your own.

Copy
Copied
const player = flowplayer("#player", {
  title: "MediaTailor stream configuration",
  token: "[your-player-token]",
  src: {
    type: "mediaTailor",
    // Replace with source URL for your MediaTailor stream
    stream: "[mediaTailor-source-url]?aws.adSignalingEnabled=true",
    // Add custom parameters to pass MediaTailor macros
    parameters: {
      age: 25,
      location: "us"
    }
  }
});

For more information about using built-in and custom macros, see Pass metadata with macros.

Configure with DAI

You can configure the SSAI plugin for use with the Google IMA DAI SDK, allowing for the seamless integration of server-side ad stitching techniques. The IMA DAI SDK returns a combined video stream, so you don't have to manage switching between ad and video content within your application. We support both of Google's Full service and Pod serving DAI solutions.

info

DAI Pod Serving is a beta intended for Ad Manager publishers and video technology partners who either have an in-house manifest manipulation service or are currently using third-party manifest manipulation that's already integrated with DAI.

The tables in this section outline the SSAI plugin configuration properties available when configuring the player with Google's IMA DAI SDK. The SSAI plugin is configured under the src namespace.

In addition to the mentioned properties, the SSAI plugin supports all stream request properties available with Google IMA DAI SDK. For a full list, see these references:

You can use these Google IMA sample streams when testing streams with your workflows.

DAI VOD stream parameters

These properties can be used when configuring the player with a DAI VOD stream request.

Property Required Applies to DAI solution Description
backupStream
string
Optional VOD Full service/Pod serving Optional back-up stream to use in case the main stream fails to play.
contentSourceId
string
Required VOD Full service Unique identifier for the publisher content from a CMS. To retrieve this ID in the Media RSS (MRSS) feed from Google, create the content source in your Google Ad Manager UI. Helps Google's ad serving systems associate the correct ad inventory and ad targeting criteria with the specific content being streamed. For more, see Google's API reference.
format
string
Required (for DASH streams) VOD Full service/Pod serving The stream format to request. Accepts hls (default) and dash string values. For more, see Google's API reference.
networkCode
string
Required VOD Pod serving Network code for the publisher making the stream request. Corresponds to the network code for your Ad Manager 360 account. Helps Google's ad serving systems route ad request and responses to the correct publisher account and manage ad inventory effectively. For more, see Google's API reference.
requestStreamUrl(streamManager, streamId)
function
Required VOD Pod serving Callback function that takes streamManager and streamId arguments. Add your code to this function to request and dynamically generate the stream URL from your video technology partner (VTP). Your function should return a Promise object with the stream URL if it's resolved or an error if the promise is rejected. For more, see Google's VOD pod-serving example code.
type
string
Required VOD Full service/Pod serving Must be set to the google/dai type to indicate that a Google DAI stream is to be used with the SSAI plugin.
videoId
string
Required VOD Full service Identifier for each individual video asset the Google MRSS feed uses to populate the content source library. Helps Google's ad serving systems to associate ad targeting criteria and ad insertion policies with specific videos. For more, see Google's API reference.

Example

The following example demonstrate how to incorporate a request for VOD assets using the DAI full-service solution. Aside from the type property, values in these examples are placeholders and must be replaced with your own.

VOD full serviceVOD pod serving (Beta)
Copy
Copied
const player = flowplayer("#player", {
  token: "[your-player-token]",
  src: [{
    contentSourceId: "2548831",
    videoId: "tears-of-steel",
    type: "google/dai",
    backupStream: "http://storage.googleapis.com/testtopbox-public/video_content/bbb/master.m3u8"
  }]
});
Copy
Copied
// SSAI plugin uses networkCode to generate VOD pod serving request
// When DAI stream is initialized, SSAI plugin gets stream ID from IMA DAI SDK
// Stream ID is then passed as argument to requestStreamUrl function

const player = flowplayer("#player", {
  token: "[your-player-token]",
  src: [{
    requestStreamUrl: (streamManager, streamId) => {
      // Add your code to get stream URL from your VTP
    },
    networkCode: "51636543",
    type: "google/dai",
    backupStream: "http://storage.googleapis.com/testtopbox-public/video_content/bbb/master.m3u8"
  }]
});

DAI live stream parameters

These properties can be used when configuring the player with a DAI live stream request.

Property Required Applies to DAI solution Description
assetKey
string
Required Live Full service Used to determine which live stream should play. The live stream request asset key identifier can be found in the DFP UI. For more, see Google's API reference.
backupStream
string
Optional Live Full service/Pod serving Optional back-up stream to use in case the main stream fails to play.
customAssetKey
string
Required Live Pod serving The custom asset key that identifies your pod serving event in Ad Manager 360. This can be created by your manifest manipulator or third-party pod serving partner. For more, see Google's API reference.
format
string
Required (for DASH streams) Live Full service/Pod serving The stream format to request. Accepts hls (default) and dash string values. For more, see Google's API reference.
networkCode
string
Required Live Pod serving Network code for the publisher making the stream request. Corresponds to the network code for your Ad Manager 360 account. Helps Google's ad serving systems route ad request and responses to the correct publisher account and manage ad inventory effectively. For more, see Google's API reference.
streamUrl
string
Required Live Pod serving The video stream URL provided by your manifest manipulator or third-party partner using pod serving. This URL includes a [[STREAMID]] placeholder that's replaced by the stream ID value provided by the IMA DAI SDK before the request is made. For more, see Google's live pod-serving example code.
type
string
Required Live Full service/Pod serving Must be set to the google/dai type to indicate that a Google DAI stream is to be used with the SSAI plugin.

Example

The following examples demonstrate how to incorporate a request for live stream assets using the DAI full-service and pod-serving solutions. Switch between the Live full service and Live pod serving tabs to see code snippets for using the player in each scenario. Aside fom the type property, values in these examples are placeholders and must be replaced with your own.

Live full serviceLive pod serving
Copy
Copied
const player = flowplayer("#player", {
  token: "[your-player-token]",
  src: [{
    assetKey: "c-rArva4ShKVIAkNfy6HUQ",
    type: "google/dai",
    backupStream: "http://storage.googleapis.com/testtopbox-public/video_content/bbb/master.m3u8"
  }]
});
Copy
Copied
const player = flowplayer("#player", {
  token: "[your-player-token]",
  src: [{
    customAssetKey: "google-sample",
    streamUrl: "https://encodersim.sandbox.google.com/masterPlaylist/9c654d63-5373-4673-8c8d-6d92b66b9d46...&stream_id=[[STREAMID]]",
    networkCode: "51636543",
    type: "google/dai",
    backupStream: "http://storage.googleapis.com/testtopbox-public/video_content/bbb/master.m3u8"
  }]
});

Configure with Yospace

You can configure the SSAI plugin to use with Yospace's DAI for live and VOD content. The following table outlines SSAI plugin configuration properties available for use with Yospace. The SSAI plugin is configured under the src namespace.

Property Description
type Set to yospace to indicate that a Yospace stream is to be used with the SSAI plugin.
src Identifies the Yospace stream.

Example

In the following example, replace the src value with your own Yospace stream.

Copy
Copied
const player = flowplayer("#player", {
  token: "[your-player-token]",
  src: [{
    type: "yospace",
    src: "https://csm-e-sdk-validation.bln1.yospace.com/csm/access/12345/c2FtcGxlL21hc3Rl?yo.av=3"
  }]
});

Listen to plugin events

This section describes the events you can capture to control and manage SSAI events within your player instance. To understand even handling differences between CDN and npm implementations, see Plugin events.

To listen to events for this plugin, use the ssai namespace in the player instance. For example, use flowplayer.ssai.events to capture an event. The following table describes the object path and events for the SSAI plugin.

CDN event npm event Description
flowplayer.ssai.events.SSAI_AD_COMPLETED SSAI.events.SSAI_AD_COMPLETED SSAI Fires when an individual ad completes.
flowplayer.ssai.events.SSAI_AD_END SSAI.events.SSAI_AD_END Fires the first time each ad break ends.
flowplayer.ssai.events.SSAI_AD_START SSAI.events.SSAI_AD_START Fires the first time each ad break begins playback.
flowplayer.ssai.events.SSAI_AD_STARTED SSAI.events.SSAI_AD_STARTED Fires when an ad starts.
flowplayer.ssai.events.SSAI_AD_PAUSED SSAI.events.SSAI_AD_PAUSED Fires when an ad pauses.
flowplayer.ssai.events.SSAI_AD_PROGRESS SSAI.events.SSAI_AD_PROGRESS Fires when the current ad progresses.
flowplayer.ssai.events.SSAI_AD_RESUMED SSAI.events.SSAI_AD_RESUMED fires when an ad resumes.
flowplayer.ssai.events.SSAI_AD_SKIPPED SSAI.events.SSAI_AD_SKIPPED Fires when the user skips an ad.

For example, use the following code to set up an event listener capturing when a server-side ad is paused. Then add your custom logic inside the callback function:

CDN examplenpm example
Copy
Copied
player.on(flowplayer.ssai.events.SSAI_AD_PAUSED, (event) => {
  // Add your code here
  console.log("Server-side ad paused.");
});
Copy
Copied
player.on(SSAI.events.SSAI_AD_PAUSED, (event) => {
  // Add your code here
  console.log("Server-side ad paused.");
});