Contact support

Video plugin: API reference

Overview

This document contains the available methods you can use with the Video plugin.

Methods

addCallback

Use the addCallback method to enable listening to video events and calling a function when a specific event occurs.

Syntax

sas.video.addCallback(event, function);

Parameters

Name Type Required / Optional Description
event String Required The name of the event. The supported events are listed in “Available callback functions" in Video plugin: use callback functions.
function Object Required The function to be called.

Examples

sas.video.addCallback('adBegin', onAdBegin);
sas.video.addCallback('adBreakBegin', onAdBreakBegin);
sas.video.addCallback('adBreakEnd', onAdBreakEnd);
sas.video.addCallback('adEnd', onAdEnd);
sas.video.addCallback('adError', onAdError);
sas.video.addCallback('contentEnd', onContentEnd);
sas.video.addCallback('singleError', onSingleError);
sas.video.addCallback('videoEnd', onVideoEnd);

clearPlayer

Use the clearPlayer method to kill the Video plugin instance that has been created for a given video player object. For example, use this method for video playlists with each video having an ad. Call the method after each video and register the plugin again.

Syntax

sas.video.clearPlayer(id);

Parameters

Name Type Required / Optional Description
id String Required The ID of the player element, matching the ID used in the register method.

Example

sas.video.clearPlayer('my-player-id');

register

Use the register method to initialize an instance of the Video plugin and register it for a specific video player. For more information, see “Step 3: Register Video plugin ” in Video plugin: integration tutorial.

Syntax

sas.video.register(config);

Parameters

Name Type Required / Optional Description
config Object Required The configuration object. For more information, see Video plugin: configure and customize.

Example

sas.video.register({
 id: 'video-player',
 adData: {
   sas_siteid: 4593,
   sas_pageid: 86302,
   sas_format_linears: 4692,
   sas_target: 'key=value'
 }
});

removeCallback

Use the removeCallback method to remove callbacks added with the addCallback method.

Syntax

sas.video.removeCallback(event, function);

Parameters

Name Type Required / Optional Description
event String Required The name of the event.
function Object Required The function to be called.

Examples

sas.video.removeCallback('adBegin', onAdBegin);
sas.video.removeCallback('adBreakBegin', onAdBreakBegin);
sas.video.removeCallback('adEnd', onAdEnd);
sas.video.removeCallback('adError', onAdError);

setBannerAdCall

Use the setBannerAdCall to enable control over banner ad calls.

Syntax

sas.video.setBannerAdCall(isActive, element);

Parameters

Name Type Required / Optional Description
element Object Optional The HTML element to be updated, in case of multiple players. It must be a reference to the HTML element whose ID was passed during registration.
isActive Boolean Required The requested state of the feature.

Examples

sas.video.setBannerAdCall(true);
sas.video.setBannerAdCall(false, myPlayer);