AdManager()
Initialize an instance of the current class using the new keyword along with this constructor.
Properties:
| Name | Type | Description | 
|---|---|---|
name | 
            
            string | The name of the ad manager. This should match the name used by the server to provide metadata. | 
ready | 
            
            boolean | Should be set to false initially. Should be set to true when the ad manager has loaded all external files and metadata to notify the controller that the ad manager is ready for the user to hit play. | 
videoRestrictions | 
            
            object | Optional property that represents restrictions on the video plugin used. ex. {"technology":OO.VIDEO.TECHNOLOGY.HTML5, "features":[OO.VIDEO.FEATURE.VIDEO_OBJECT_TAKE]} | 
Methods
- 
    
initialize(adManagerController, playerId)
 - 
    
    
    Called by the Ad Manager Controller. Use this function to initialize, create listeners, and load remote JS files.
Parameters:
Name Type Description adManagerControllerobject A reference to the Ad Manager Controller playerIdstring The unique player identifier of the player initializing the class  - 
    
registerUi()
 - 
    
    
    Called by Ad Manager Controller. When this function is called, the ui has been setup and the values in amc.ui are ready to be used.
 - 
    
loadMetadata(adManagerMetadata, backlotBaseMetadata, movieMetadata)
 - 
    
    
    Called by Ad Manager Controller. When this function is called, all movie and server metadata are ready to be parsed. This metadata may contain the adTagUrl and other ad manager and movie specific configuration.
Parameters:
Name Type Description adManagerMetadataobject Ad manager-specific metadata backlotBaseMetadataobject Base metadata from Ooyala Backlot movieMetadataobject Metadata for the main video  - 
    
buildTimeline() → {Array.<OO.AdManagerController#Ad>}
 - 
    
    
    Called once per video by Ad Manager Controller once the ad manager has set its ready flag to true. This function asks the ad manager to return a list of all ads to the controller for addition in the timeline. If the list of ads is not available at this time, return [] or null and call [AdManagerController].appendToTimeline() when the ads become available. The duration and position of each ad should be specified in seconds.
Returns:
timeline A list of the ads to play for the current video- Type
 - Array.<OO.AdManagerController#Ad>
 
 - 
    
playAd(ad, adPodStartedCallback, adPodEndedCallback, adStartedCallback, adEndedCallback)
 - 
    
    
    Called by Ad Manager Controller. The ad manager should play the ad or group of podded ads passed to the function as a parameter.
Parameters:
Name Type Description adobject The ad object to play adPodStartedCallbackfunction Call this function when the ad or group of podded ads have started adPodEndedCallbackfunction Call this function when the ad or group of podded ads have completed adStartedCallbackfunction Call this function each time an ad in the set starts adEndedCallbackfunction Call this function each time an ad in the set completes  - 
    
cancelAd(ad, params)
 - 
    
    
    Called by Ad Manager Controller. The ad manager should cancel the ad passed to the function as a parameter. After cancelling the ad, the ad manager should call the adEndedCallback to indicate that ad cancellation has completed. If the given ad is not currently playing and the adEndedCallback has already been called, then no action is required.
Parameters:
Name Type Description adobject The ad object to cancel paramsobject An object containing information about the cancellation. It will include the following fields: code : The amc.AD_CANCEL_CODE for the cancellation  - 
    
pauseAd(ad)
 - 
    
    
    Called by Ad Manager Controller. The ad manager should pause the ad passed to the function as a parameter. If the given ad is not currently playing, no action is required.
Parameters:
Name Type Description adobject The ad object to pause  - 
    
resumeAd(ad)
 - 
    
    
    Called by Ad Manager Controller. The ad manager should resume the ad passed to the function as a parameter. If the given ad is not currently loaded or not paused, no action is required.
Parameters:
Name Type Description adobject The ad object to resume  - 
    
hideOverlay(currentAd)
 - 
    
    
    Optional.
When the Ad Manager Controller needs to hide the overlay it will call this function. NOTE: This function should only be used by the ad manager if the cancelOverlay function is not being used. NOTE 2: Only implement this function if you plan to hide and reshow the overlay. Otherwise delete it or leave it commented.Parameters:
Name Type Description currentAdobject The overlay ad object to be stored so when it is shown again, we can update the AMC  - 
    
cancelOverlay(currentAd)
 - 
    
    
    Optional.
When the Ad Manager Controller needs to cancel the overlay it will call this function. NOTE: This function should only be used by the ad manager if the hideOverlay function is not being used. NOTE 2: Only implement this function if you plan to cancel and not reshow the overlay. Otherwise leave it commented or delete it.Parameters:
Name Type Description currentAdobject The overlay ad object that the ad manager needs to know is going to be cancelled and removed  - 
    
showOverlay()
 - 
    
    
    This function gets called by the ad Manager Controller when an ad has completed playing. If the main video is finished playing and there was an overlay displayed before the post-roll then it needs to be removed. If the main video hasn't finished playing and there was an overlay displayed before the ad video played, then it will show the overlay again.
 - 
    
playerClicked()
 - 
    
    
    Optional.
Called when player clicks on the tap frame, if tap frame is disabled, then this function will not be called - 
    
adVideoPlaying()
 - 
    
    
    Optional.
Called when the player detects start of ad video playback. - 
    
adVideoFocused()
 - 
    
    
    Optional.
Called when the player focuses the ad video element. - 
    
onVideoTagFound(event, videoId, tagType, metadata)
 - 
    
    
    This is an example callback that interprets video stream tags. The event is subscribed to in the initialize function.
Parameters:
Name Type Description eventstring The event that triggered this callback. videoIdstring The id of the video element that processed a tag. tagTypestring The type of tag that was detected. metadataobject Any metadata attached to the found tag.  - 
    
adVideoError(adWrapper, errorCode)
 - 
    
    
    Optional.
Called when the player detects an error in the ad video playback. If the ad manager did not detect this error itself, it can use this time to end the ad playback.Parameters:
Name Type Description adWrapperobject The current Ad's metadata errorCodenumber The error code associated with the video playback error  - 
    
destroy()
 - 
    
    
    Called by Ad Manager Controller. The ad manager should destroy itself. It will be unregistered by the Ad Manager Controller.
 - 
    
createAdVideoElementOnPlayerInit() → {Array.<string>}
 - 
    
    
    Called by the Ad Manager Controller to determine if an ad video element must be created on player initialization. This is done so that the Video Controller can interface with the Ad's Video Plugin prior to an ad request. A typical use case would be to pass a user click to the ad plugin prior to ad playback so that the ad can start unmuted for browsers that require user interaction for unmuted playback.
Returns:
An array of encoding types corresponding to the video elements that the Video Controller should create. Return an empty array, null, or undefined if this is not required.- Type
 - Array.<string>