Integrating SSAI with Brightcove Web & Smart TV SDK

This document provides detailed instructions on integrating SSAI (Server-Side Ad Insertion) with the Brightcove Web & Smart TV SDK.

Overview

Server-Side Ad Insertion (SSAI) allows you to insert ads into your video streams on the server side, providing a seamless ad experience for viewers. This guide will walk you through the process of implementing SSAI using it's API.

Prerequisites

  • A Brightcove account with access to Video Cloud.

  • The Brightcove Web & Smart TV SDK installed in your project.

  • Have created an Ad Configuration.

Usage Example

  1. Import the Player (with UI) class from the Brightcove SDK.

    import { Player, IntegrationsManager } from '@brightcove/web-sdk/ui';
                
  2. Import the SSAI integration class from the Brightcove SDK.

    import { SsaiIntegrationFactory } from '@brightcove/web-sdk/integrations/ssai';
                
  3. Import the SSAI integration CSS from the Brightcove SDK.

    import '@brightcove/web-sdk/integrations/ssai/styles';
                
  4. Setup SSAI integration.

    IntegrationsManager.registerSsaiIntegrationFactory(SsaiIntegrationFactory);
                
  5. Create and Configure the Player.

    const player = new Player({accountId:'<account-id>'});
    
     player.updateConfiguration({
       brightcove: {
         // Passing an Ad Config ID will enable the fetching of an SSAI stream from the Playback API
         adConfigId: '<valid-ad-config-id>',
       },
       ssai: {
         timeout: 30_000,
         hideOverlays: false,
         // etc
       }
     });
  6. Attach the player to a mount root (DOM element in the page):

    const root = document.querySelector('#player-mount-root');
     player.attach(root);
                
  7. Access the SSAI Integration API via the IntegrationsManager

    const { ssaiIntegration } = player.getIntegrationsManager();
                
  8. Call SSAI-specific methods

    ssaiIntegration.seekInRelativeTime(50);
                

Configuration Summary

This section provides detailed information about the various configuration options available for Server-Side Ad Insertion (SSAI) when using the Web & Smart TV SDK.

Configuration Option Type Default Description
hideOverlays boolean false If true, the countdown timer and Learn More click-through overlays will not be shown while ads are playing.
timeout number 45000 The number of milliseconds after which an XHR to fetch a VMAP will time out.
enableDiscontinuities boolean true If true, request the video source with HLS discontinuities or DASH multiperiod. Only valid for VOD SSAI.
enableOm boolean false If true (and the necessary Open Measurement SDK scripts are embedded), the plugin will use values from the omParams object to start an OM manager and create a new OM session client.
omParams OmConfiguration N/A An object describing the required parameters for starting an Open Measurement session client and OM ad features.
vmapURLParams object {} An object containing the parameters for replacing arbitrary values in the VMAP source URL. See

Public Methods Summary

Method Description Parameters Parameter Type Returns
getRelativeDuration Get the duration of a linear ad or content, whichever is currently playing. None N/A number
seekInRelativeTime Seek to any point in a linear ad or content, whichever is currently playing. seekTarget, preventAdSkips number, boolean? void
getCurrentLinearAd Get the current LinearAd. None N/A LinearAd | null
getRelativeTimelineState Get the TimelineState object relative to the current linear ad or content. None N/A TimelineState | null

Event Summary

Event Name Attribute Description
ClickThrough Readonly Triggered when a click-through event occurs on the SSAI ad.

Error Summary

Error Name Description
AdsBeforePrerollError Error encountered before the preroll ad starts.
AdsPrerollError Error during the preroll ad.
AdsMidrollError Error during the midroll ad.
AdsPostrollError Error during the postroll ad.
AdsMacroReplacementError Error in replacing macros in the ad URL or tracking events.
AdsResumeContentError Error while resuming the content after an ad break.
SsaiVmapParsingError Error parsing the VMAP response for SSAI ads.
SsaiLiveVmapParsingError Error parsing the VMAP response for live SSAI ads.
SsaiVodVmapParsingError Error parsing the VMAP response for VOD SSAI ads.
SsaiUnsupportedOmidAdSessionError OMID (Open Measurement Interface Definition) ad session not supported.
SsaiOmSessionError Error with the OM session for SSAI.
SsaiVmapRequestError Error making the VMAP request for SSAI ads.