Packagecom.brightcove.fl.advertising.rules
Classpublic class AdRules
InheritanceAdRules Inheritance flash.display.MovieClip

The abstract base class that all ad rules SWFs must extend. This provides properties and functions for getting the APIs, setting up a translator, calling a translator, and other pieces needed to customize when ads are delivered. See the Example ad rules SWF for an example implementation.



Public Methods
 MethodDefined By
  
Tells the player that the ad rules SWF is initialized and ready to used.
AdRules
  
Called when the currently specified ad translator is ready to be used.
AdRules
  
callAdTranslator(pKeyValuePairs:String, pRequestQueue:Boolean = false):void
Calls fetchAd in the currently specified ad translator if no ad is currently playing.
AdRules
  
loadAdTranslator(pAdTranslatorURL:String):void
Tells the player to load an ad translator to be used when callAdTranslator is triggered.
AdRules
  
Called whenever a midroll ad can be played.
AdRules
  
This function must be called when done checking for a midroll ad.
AdRules
  
Called when an onload ad can be played.
AdRules
  
This function must be called when done checking for an onload ad.
AdRules
  
Called whenever a postroll ad can be played.
AdRules
  
This function must be called when done checking for a postroll ad.
AdRules
  
Called whenever a preroll ad can be played.
AdRules
  
This function must be called when done checking for a preroll ad.
AdRules
  
setAdRulesContext(pAdRulesContext:AdRulesContext):void
Called when the AdRulesContext is ready to be used and the player API is ready to be loaded.
AdRules
  
setAdTranslator(pAdTranslator:AdTranslation):void
Set an ad translator instance to be used when callAdTranslator is triggered.
AdRules
  
useDefaultDFPTranslator(pUseDFP:Boolean):void
Sets whether or not the player should use the Brightcove default DFP ad translator as its current translator.
AdRules
Property Detail
configproperty
config:AdRulesConfig  [read-only]

Configuration of the ad rules SWF.


Implementation
    player_internal function get config():AdRulesConfig
Method Detail
adRulesReady()method
public final function adRulesReady():void

Tells the player that the ad rules SWF is initialized and ready to used. This should typically be called once all necessary player API modules have been loaded in via the AdRulesContext. This must be called in an ad rules implementation to tell the player to move forward, otherwise, the player will appear to hang while it is waiting for the ad rules SWF.

adTranslatorLoaded()method 
public function adTranslatorLoaded():void

Called when the currently specified ad translator is ready to be used. This function must be overidden if a new translator has been loaded or set.

See also

callAdTranslator()method 
public final function callAdTranslator(pKeyValuePairs:String, pRequestQueue:Boolean = false):void

Calls fetchAd in the currently specified ad translator if no ad is currently playing. If an ad is currently playing, the call is ignored. If the specified ad translator can't be found, then the default DFP translator will be used.

Parameters

pKeyValuePairs:String — A string specifying key-value pairs to append to the ad call when fetchAd is triggered.
 
pRequestQueue:Boolean (default = false) — Indicates whether an ad request is kept in a queue to retry later if an ad is currently playing. The ad request queue gets cleared when the media changes. The default value is false.

See also

loadAdTranslator()method 
public final function loadAdTranslator(pAdTranslatorURL:String):void

Tells the player to load an ad translator to be used when callAdTranslator is triggered. This can be called at any time to load a new ad translator SWF and will always trigger adTranslatorLoaded when the translator is loaded and ready to be used.

Parameters

pAdTranslatorURL:String — The URL of the translator to be loaded.

See also

midrollCheck()method 
public function midrollCheck():void

Called whenever a midroll ad can be played. A midroll ad happens whenever there is an ad cuepoint. To play a midroll ad, override this function and call callAdTranslator(). A midroll ad does not need to be played if you override this function, and this function just provides the opportunity for this type of ad to be played. Whether an ad is played or not, midrollCheckComplete() must be called when done checking for a midroll ad.

See also

midrollCheckComplete()method 
public final function midrollCheckComplete():void

This function must be called when done checking for a midroll ad. If it isn't called, the player will not move forward in playing videos, as the player is waiting for this check to complete.

See also

onloadCheck()method 
public function onloadCheck():void

Called when an onload ad can be played. An onload ad happens after the player has loaded. To play a onload ad, override this function and calling callAdTranslator(). An onload ad does not need to be played if you override this function, and this function just provides the opportunity for this type of ad to be played. Whether an ad is played or not, onloadCheckComplete() must be called when done checking for an onload ad.

See also

onloadCheckComplete()method 
public final function onloadCheckComplete():void

This function must be called when done checking for an onload ad. If it isn't called, the player will not move forward in playing videos, as the player is waiting for this check to complete.

See also

postrollCheck()method 
public function postrollCheck():void

Called whenever a postroll ad can be played. A postroll happens after a video has completed. To play a postroll ad, override this function and call callAdTranslator(). A postroll ad does not need to be played if you override this function, and this function just provides the opportunity for this type of ad to be played. Whether an ad is played or not, postrollCheckComplete() must be called when done checking for a postroll ad.

See also

postrollCheckComplete()method 
public final function postrollCheckComplete():void

This function must be called when done checking for a postroll ad. If it isn't called, the player will not move forward in playing videos, as the player is waiting for this check to complete.

See also

prerollCheck()method 
public function prerollCheck():void

Called whenever a preroll ad can be played. A preroll ad happens before a video plays. To play a preroll ad, override this function and call callAdTranslator(). A preroll ad does not need to be played if you override this function, and this function just provides the opportunity for this type of ad to be played. Whether an ad is played or not, prerollCheckComplete() must be called when done checking for an preroll ad.

See also

prerollCheckComplete()method 
public final function prerollCheckComplete():void

This function must be called when done checking for a preroll ad. If it isn't called, the player will not move forward in playing videos, as the player is waiting for this check to complete.

See also

setAdRulesContext()method 
public function setAdRulesContext(pAdRulesContext:AdRulesContext):void

Called when the AdRulesContext is ready to be used and the player API is ready to be loaded. This is called right after the Ad Rules SWF is loaded and initialized. This function must be overridden to gain access to the ad rules context and to load or get a reference to the player API.

Parameters

pAdRulesContext:AdRulesContext — The current context of the player to be used for setting ad rules.

setAdTranslator()method 
public final function setAdTranslator(pAdTranslator:AdTranslation):void

Set an ad translator instance to be used when callAdTranslator is triggered. This can be called at any time to specify a new ad translator instance and will always trigger adTranslatorLoaded when the translator is loaded and ready to be used. This allows translators to be compiled in to ad rules SWFs.

Parameters

pAdTranslator:AdTranslation — The translator instance to set.

See also

useDefaultDFPTranslator()method 
public final function useDefaultDFPTranslator(pUseDFP:Boolean):void

Sets whether or not the player should use the Brightcove default DFP ad translator as its current translator. The DFP translator is compiled into the player if the player has advertising. This method allows toggling between the DFP translator and other translators specified using loadAdTranslator and setAdTranslator.

Parameters

pUseDFP:Boolean — Whether or not to use the default DFP translator. If true, the player will use the DFP translator when callAdTranslator is triggered.

See also