Packagese.videoplaza.kit.api
Classpublic class VpAdPlayerWrapper
InheritanceVpAdPlayerWrapper Inheritance flash.display.Sprite



Public Properties
 PropertyDefined by
  afterLinearCallback : Function
[write-only] Adds a callback function the Adplayer will trigger after linear ads are shown.
VpAdPlayerWrapper
  beforeLinearCallback : Function
[write-only] Adds a callback function the Adplayer will trigger before linear ads are shown.
VpAdPlayerWrapper
  betweenSponsorAndAdCallback : Function
[write-only] Adds a callback function the Adplayer will trigger in between showing a sponsor ad and a normal ad.
VpAdPlayerWrapper
  deviceContainer : String
VpAdPlayerWrapper
  height : Number
VpAdPlayerWrapper
  maxBitRate : Number
VpAdPlayerWrapper
  persistentID : String
VpAdPlayerWrapper
  width : Number
VpAdPlayerWrapper
  x : Number
VpAdPlayerWrapper
  y : Number
VpAdPlayerWrapper
Public Methods
 MethodDefined by
  
VpAdPlayerWrapper(adPlayerObject:Object)
Constructor.
VpAdPlayerWrapper
  
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
VpAdPlayerWrapper
  
addInsertionPoints(requestSettings:RequestSettings, tags:Array = null, customParameters:Dictionary = null):void
Adds an insertion point to the current session.
VpAdPlayerWrapper
  
disable():void
Disables all ads, turns visibility off.
VpAdPlayerWrapper
  
enable():void
Enables all ads, turns visibility on.
VpAdPlayerWrapper
  
getAdModule(name:String):Object
Returns a specific AdModule.
VpAdPlayerWrapper
  
getAdModules():Object
VpAdPlayerWrapper
  
Retrieves the current itemInfo object.
VpAdPlayerWrapper
  
getInsertionPointPreparationTimeout(insertionPointType:String, cuePoint:Object = null):Number
Returns the maximum amount of time in seconds it will take to prepare the insertion point with prepareInsertionPoint.
VpAdPlayerWrapper
  
getVolume():Number
Retrieves the current AdPlayer volume.
VpAdPlayerWrapper
  
hasEventListener(type:String):Boolean
VpAdPlayerWrapper
  
isEnabled():Boolean
Returns true if the AdPlayer is currently enabled.
VpAdPlayerWrapper
  
mute(doMute:Boolean):void
Mutes or unmutes the AdPlayer.
VpAdPlayerWrapper
  
prepareInsertionPoint(insertionPointType:String, cuePoint:Object = null):void
Prepares an insertion point.
VpAdPlayerWrapper
  
registerTarget(config:Object):void
Register a target for displaying ads.
VpAdPlayerWrapper
  
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
VpAdPlayerWrapper
  
reset():void
Resets the AdPlayer completely.
VpAdPlayerWrapper
  
setAdModuleSize(adModuleName:String, dim:Rectangle):void
VpAdPlayerWrapper
  
setAutoTriggerCuePoints(b:Boolean):void
Instructs the AdPlayer whether to check for and trigger cue points on it's own, or leave this responsibility to the bridge / video player.
VpAdPlayerWrapper
  
setMetaData(metaData:Object, excludeInsertionPointTypes:Array = null):void
Send metadata to the AdPlayer in order to show overlays, midrolls and postrolls.
VpAdPlayerWrapper
  
setNewItem(itemInfo:ItemInfo, excludeInsertionPointTypes:Array = null):void
Informs the AdPlayer that a new item has been activated, initiating the ad session.
VpAdPlayerWrapper
  
setPlayerState(state:String):void
Informs the AdPlayer about the current state of the video player.
VpAdPlayerWrapper
  
setSize(w:Number, h:Number, viewMode:String):void
Sets the size of the AdPlayer.
VpAdPlayerWrapper
  
setVolume(value:Number):void
Sets the AdPlayer volume.
VpAdPlayerWrapper
  
start():void
Starts the AdPlayer.
After having received the VpEventType.AD_PLAYER_READY event from the AdPlayer, run this function to start it.
VpAdPlayerWrapper
  
triggerInsertionPoint(insertionPointType:String, cuePoint:Object = null):void
Triggers an insertion point.
VpAdPlayerWrapper
Property detail
afterLinearCallbackproperty
afterLinearCallback:Function  [write-only]

Adds a callback function the Adplayer will trigger after linear ads are shown. To let the Adplayer know when to resume, trigger the provided resume callback.

Implementation
    public function set afterLinearCallback(value:Function):void

Example
afterLinear callback signature:
   function afterLinear(ads:Array, resume:function):void
   

beforeLinearCallbackproperty 
beforeLinearCallback:Function  [write-only]

Adds a callback function the Adplayer will trigger before linear ads are shown. To let the Adplayer know when to start linear ad playback again, trigger the provided startLinear callback.

Implementation
    public function set beforeLinearCallback(value:Function):void

Example
beforeLinear callback signature:
   function beforeLinear(ads:Array, startLinear:function):void
   

betweenSponsorAndAdCallbackproperty 
betweenSponsorAndAdCallback:Function  [write-only]

Adds a callback function the Adplayer will trigger in between showing a sponsor ad and a normal ad. To let the Adplayer know when to resume, trigger the provided resume callback.

Implementation
    public function set betweenSponsorAndAdCallback(value:Function):void

Example
betweenSponsorAndAdCallback callback signature:
   function betweenSponsorAndAdCallback(resume:function):void
   

deviceContainerproperty 
deviceContainer:String  [read-write]Implementation
    public function get deviceContainer():String
    public function set deviceContainer(value:String):void
heightproperty 
height:Number  [read-write]Implementation
    public function get height():Number
    public function set height(value:Number):void
maxBitRateproperty 
maxBitRate:Number  [read-write]Implementation
    public function get maxBitRate():Number
    public function set maxBitRate(value:Number):void
persistentIDproperty 
persistentID:String  [read-write]Implementation
    public function get persistentID():String
    public function set persistentID(value:String):void
widthproperty 
width:Number  [read-write]Implementation
    public function get width():Number
    public function set width(value:Number):void
xproperty 
x:Number  [read-write]Implementation
    public function get x():Number
    public function set x(value:Number):void
yproperty 
y:Number  [read-write]Implementation
    public function get y():Number
    public function set y(value:Number):void
Constructor detail
VpAdPlayerWrapper()constructor
public function VpAdPlayerWrapper(adPlayerObject:Object)

Constructor. Creates a new instance of the VpAdPlayerWrapper.

Parameters
adPlayerObject:Object — This required parameter sets up the actual AdPlayer. The adPlayerObject is retrieved from the bootloader callback after calling the createAdPlayer function.

See also


Example
The following code illustrates the loading of the bootloader, and via the callback return object constructing the VpAdPlayerWrapper:
  private var videoplaza:Object;
  private var adPlayer:VpAdPlayerWrapper;
   
  private function loadBootloader():void {
   loader.contentLoaderInfo.addEventListener(Event.INIT, onBootloadInit);
   //Load the bootloader:
   loader.load(new URLRequest(URLToBootloader));
    
  }
  // Loader callback:
  private function onBootloadInit(ev:Event) {
    videoplaza = Object(ev.target.content);
   addChild(DisplayObject(videoplaza));
   // Setup bootloader callback by first casting the bootloader to an EventDispatcher object:
   EventDispatcher(videoplaza).addEventListener(Event.INIT, function(evt:Event):void {
    // Setup the Pulse ad player
    setupAdPlayer();
   });
  }
  
  //Bootloader callback:
  private function setupAdPlayer():void {
   // Create a config object   
   var adPlayerConf:Object = new Object();
   adPlayerConf.x = myVideoPlayer.x;
   adPlayerConf.y = myVideoPlayer.x;
   adPlayerConf.width = myVideoPlayer.width;
   adPlayerConf.height = myVideoPlayer.height;
   // Compose and add the VpAdPlayerWrapper to the stage by running the "createAdPlayer" method on the bootloader (recasted to an object),
   // passing the adPlayerConf object to the method:
   var vpObject:DisplayObject = Object(videoplaza).createAdPlayer( adPlayerConf );
   adPlayer = new VpAdPlayerWrapper( vpObject);
   addChild(vpObject);
  }
   

Method detail
addEventListener()method
public override function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):voidParameters
type:String
 
listener:Function
 
useCapture:Boolean (default = false)
 
priority:int (default = 0)
 
useWeakReference:Boolean (default = false)
addInsertionPoints()method 
public function addInsertionPoints(requestSettings:RequestSettings, tags:Array = null, customParameters:Dictionary = null):void

Adds an insertion point to the current session. Supported insertion points to add are:


   InsertionPointType.ON_CUE_POINT
   InsertionPointType.ON_CONTENT_END
   

Note! You cannot ask for InsertionPointType.ON_CUE_POINT on the exact same RequestSettings.cuePoints (cue point time) more than once.

Parameters
requestSettings:RequestSettings
 
tags:Array (default = null)
 
customParameters:Dictionary (default = null)

See also

disable()method 
public function disable():void

Disables all ads, turns visibility off.

enable()method 
public function enable():void

Enables all ads, turns visibility on.

getAdModule()method 
public function getAdModule(name:String):Object

Returns a specific AdModule.

Parameters
name:String — The name of the AdModule to get. All supported AdModules' names are available in the class VpAdModuleName.

Returns
Object

See also


Example
The following code illustrates how to get an AdModule.
   
   private var adPlayer:VpAdPlayerWrapper;
   private var spotModule:VpAdModule;
   
   // Setup AdPlayer listener
   private function setupAdPlayerListeners(evt:Event) {
    adPlayer.addEventListener(VpEventType.AD_MODULE_CREATED, onAdPlayerEvent);
   }
   
   // AdPlayer event handler that gets the spot AdModule and wraps it.
   private function onAdPlayerEvent( event:Event ):void {
   switch( event.type ) {
    case VpEventType.AD_MODULE_CREATED:
     var moduleName:String = Object( event ).getData() as String;
     if( moduleName == VpAdModuleName.SPOT_ADMODULE ) {
      spotModule = new VpAdModule( adPlayer.getAdModule( VpAdModuleName.SPOT_ADMODULE ) );
      }
      break;
    }
   }
   

getAdModules()method 
public function getAdModules():Object

Returns
Object
getCurrentItem()method 
public function getCurrentItem():ItemInfo

Retrieves the current itemInfo object.

Returns
ItemInfo — ItemInfo object

See also

getInsertionPointPreparationTimeout()method 
public function getInsertionPointPreparationTimeout(insertionPointType:String, cuePoint:Object = null):Number

Returns the maximum amount of time in seconds it will take to prepare the insertion point with prepareInsertionPoint.

Parameters
insertionPointType:String — The insertion point type. Possible values: InsertionPointType.ON_CUE_POINT and InsertionPointType.ON_CONTENT_END
 
cuePoint:Object (default = null) — Needed for insertionPointType:InsertionPointType.ON_CUE_POINT

Returns
Number — The maximum amount of time in seconds it will take to prepare the insertion point

See also

getVolume()method 
public function getVolume():Number

Retrieves the current AdPlayer volume.

Returns
Number — Number ranging from 0 to 1.
hasEventListener()method 
public override function hasEventListener(type:String):BooleanParameters
type:String

Returns
Boolean
isEnabled()method 
public function isEnabled():Boolean

Returns true if the AdPlayer is currently enabled.

Returns
Boolean
mute()method 
public function mute(doMute:Boolean):void

Mutes or unmutes the AdPlayer.

Parameters
doMute:Boolean — Boolean.
prepareInsertionPoint()method 
public function prepareInsertionPoint(insertionPointType:String, cuePoint:Object = null):void

Prepares an insertion point. It is only needed to prepare insertion points that are lazy loaded and manually triggered. You should prepare InsertionPointType.ON_CONTENT_END (postrolls). You should also prepare InsertionPointType.ON_CUE_POINT (midrolls) if setAutoTriggerCuePoints is set to false. Check when you need to prepare the insertion point by calling getInsertionPointPreparationTimeout

Parameters
insertionPointType:String — The insertion point type to prepare, possible values:InsertionPointType.ON_CONTENT_END and InsertionPointType.ON_CUE_POINT
 
cuePoint:Object (default = null) — Needed for insertionPointType:InsertionPointType.ON_CUE_POINT

See also

getInsertionPointPreparationTimeout()
se.videoplaza.kit.api.constants.InsertionPointType
registerTarget()method 
public function registerTarget(config:Object):void

Register a target for displaying ads.

Parameters
config:Object — An object with these parameters:
  • name: Unique name for this target
  • view: The sprite you want use as a target.
removeEventListener()method 
public override function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):voidParameters
type:String
 
listener:Function
 
useCapture:Boolean (default = false)
reset()method 
public function reset():void

Resets the AdPlayer completely.

setAdModuleSize()method 
public function setAdModuleSize(adModuleName:String, dim:Rectangle):voidParameters
adModuleName:String
 
dim:Rectangle
setAutoTriggerCuePoints()method 
public function setAutoTriggerCuePoints(b:Boolean):void

Instructs the AdPlayer whether to check for and trigger cue points on it's own, or leave this responsibility to the bridge / video player.

Parameters
b:Boolean — If set to true, the AdPlayer will handle all triggering of cue points, provided it will be updated correctly via the time reference object.
If set to false, the bridge / video player will update the AdPlayer (trigger ads) when cue points occur.

See also

setTimeReference()
setMetaData()method 
public function setMetaData(metaData:Object, excludeInsertionPointTypes:Array = null):void

Send metadata to the AdPlayer in order to show overlays, midrolls and postrolls. Use this function if meta information about the current video hasn't already been defined in setNewItem(iteminfo:ItemInfoObject).

Parameters
metaData:Object — object from the video.
 
excludeInsertionPointTypes:Array (default = null) — Excludes the passed insertion point types in the following ad request. When using this you have to make sure, those insertionPoints are added later.

Note!

  • Excluding insertion point types is highly discouraged. Make sure you know why you are doing so before introducing this behavior, as this affects ad delivery and Pulse account setup.
  • Calling setMetaData before setNewItem is not allowed and will generate an Event of type VpEventType.SESSION_ERROR_EVENT.
  • Calling setMetaData more than once is not allowed and will generate an Event of type VpEventType.SESSION_ERROR_EVENT.

See also

setNewItem()method 
public function setNewItem(itemInfo:ItemInfo, excludeInsertionPointTypes:Array = null):void

Informs the AdPlayer that a new item has been activated, initiating the ad session.

Parameters
itemInfo:ItemInfo — Required itemInfo object describing the current item.
 
excludeInsertionPointTypes:Array (default = null) — Excludes the passed insertion point types in the following initial ad request. When using this you have to make sure those insertionPoints are added later.

Note! Excluding insertion point types is highly discouraged. Make sure you know why you are doing so before introducing this behavior, as this affects ad delivery and Pulse account setup.

See also

setPlayerState()method 
public function setPlayerState(state:String):void

Informs the AdPlayer about the current state of the video player.

Parameters
state:String — The current video player state.

See also

setSize()method 
public function setSize(w:Number, h:Number, viewMode:String):void

Sets the size of the AdPlayer.

Parameters
w:Number — width in pixels
 
h:Number — height in pixels
 
viewMode:String — Can be one of ViewMode.NORMAL or ViewMode.FULLSCREEN to indicate the mode to which the AdPlayer should resize to.
setVolume()method 
public function setVolume(value:Number):void

Sets the AdPlayer volume.

Parameters
value:Number — Number ranging from 0 to 1.
start()method 
public function start():void

Starts the AdPlayer.
After having received the VpEventType.AD_PLAYER_READY event from the AdPlayer, run this function to start it.

See also

triggerInsertionPoint()method 
public function triggerInsertionPoint(insertionPointType:String, cuePoint:Object = null):void

Triggers an insertion point.

Parameters
insertionPointType:String — The insertion point type to trigger. Triggerable insertion points:
  • InsertionPointType.ON_SEEK
  • InsertionPointType.ON_PAUSE
  • InsertionPointType.ON_CUE_POINT You can only trigger InsertionPointType.ON_CUE_POINT if setAutoTriggerCuePoints is set to false.
 
cuePoint:Object (default = null) — Needed for InsertionPointType.ON_CUE_POINT

See also