new AdRequester(vpHost, adRequesterSettings)
The AdRequester is used to make ad requests to Pulse; create an instance and then use
videoplaza.adrequest.AdRequester.requestSession method to send information about the ads
that you want to request.
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
vpHost |
string | Full hostname of the Invidi account being used. |
||||||||||||
adRequesterSettings |
object | Optional settings. Properties
|
Members
-
<static> ContentForm :string
-
Potential content form values passed to videoplaza.adrequest.AdRequester.requestSession, used to
determine the ad insertion policy.Type:
- string
Properties:
Name Type Default Description SHORT_FORMstring shortForm Short form content. Typically used for news summaries, game highlights and the like.
LONG_FORMstring longForm Long form content. Typically used for feature films, TV series, complete games, and the like.
-
<static> InsertionPointType :string
-
All valid types you can pass in the insertionPointFilter list in requestSettings, as an argument to videoplaza.adrequest.AdRequester.requestSession.
These will determine when the received ads are to be played.Type:
- string
Properties:
Name Type Default Description ON_BEFORE_CONTENTstring onBeforeContent Request ads to be played before the content, or 'preroll' ads.
PLAYBACK_POSITIONstring playbackPosition Request ads to be played during the content, or 'midroll' ads; don't forget to specify which positions the ads are to be played at, in the linearPlaybackPositions field.
Additionality, specifying positions in the nonLinearPlaybackPositions field will request overlay ads.ON_CONTENT_ENDstring onContentEnd Request ads to be played after the content, or 'postroll' ads.
ON_PAUSEstring onPause Request ads to be played when the content is paused.
PLAYBACK_TIMEstring playbackTime Request ads to be displayed based on the content duration.
Methods
-
addLogListener(logCallback)
-
Registers a handler function to be called when important information is available.
Parameters:
Name Type Description logCallbackvideoplaza.LogItem~logItemCallback A callback which will receive logging information.
-
requestPassback(failedItem, errorString, onComplete)
-
If an ad fails to play, use this method to report the error and receive a new ad in turn. You can check if the ad has more passback candidates available with videoplaza.adresponse.Ad.hasPassback, to avoid getting an error if this is not the case.
Parameters:
Name Type Description failedItemvideoplaza.adresponse.Ad | videoplaza.adresponse.LinearCreative The videoplaza.adresponse.Ad or videoplaza.adresponse.LinearCreative that failed.
errorStringstring An error string describing why the previous item failed; valid errors are available in videoplaza.tracking.Tracker.AdErrors and videoplaza.tracking.Tracker.CreativeErrors
onCompletevideoplaza.adrequest.AdRequester~onCompletePassback Callback providing the next ad candidate
Returns:
-
requestSession(contentMetadata, requestSettings, onSuccess, onFail)
-
The requestSession method is used to make an ad request to Invidi.
Parameters:
Name Type Description contentMetadataContentMetadata Information about the content that is making the ad request.
requestSettingsRequestSettings Settings about the environment in which the ad will play.
onSuccessvideoplaza.adrequest.AdRequester~onCompleteSession Required. Function that gets called when the request completes successfully. A videoplaza.adresponse.Session object
representing the response is passed into this function as its only argument.onFailvideoplaza.adrequest.AdRequester~onFailSession Required. Function that gets called in case the request fails, with a string describing the request error as its only argument.
Returns:
-
requestSessionExtension(session, contentMetadata, requestSettings, onComplete)
-
The requestSessionExtension method is used to make an ad request to Invidi, extending the provided Session with additional insertionPoints.
Parameters:
Name Type Description sessionvideoplaza.adresponse.Session Required. The Session object to extend with additional videoplaza.adresponse.InsertionPoints.
contentMetadataContentMetadata Information about the content that is making the ad request.
requestSettingsRequestSettings Settings about the environment in which the ad will play.
onCompletefunction Required. Function that gets called when the request completes, success or not. The extended videoplaza.adresponse.Session object
representing the passed Session object merged with the response is passed into this function as its only argument.Returns:
-
requestThirdParty(thirdPartyContainer, onComplete)
-
Sends a request to complete loading of an unloaded/'lazy' Ad or Insertion Point
Parameters:
Name Type Description thirdPartyContainervideoplaza.adresponse.Ad | videoplaza.adresponse.InsertionPoint The videoplaza.adresponse.Ad or videoplaza.adresponse.InsertionPoint to load.
onCompletevideoplaza.adrequest.AdRequester~onCompleteLazy Callback providing the container passed in once it is ready to play
Returns:
Type Definitions
-
cancelCallback(error)
-
Callback returned by requestPassback(), requestThirdParty() and requestSession().
Parameters:
Name Type Description errorstring Message describing the reason for canceling
-
onCompleteLazy(container)
-
Callback passed into requestThirdParty() to notify that the request succeeded.
Parameters:
Name Type Description containervideoplaza.adresponse.Ad | videoplaza.adresponse.InsertionPoint Ready to use Ad or InsertionPoint object
-
onCompletePassback(ad)
-
Callback passed into requestPassback() to notify that the request succeeded.
Parameters:
Name Type Description advideoplaza.adresponse.Ad Ready to use Ad object
-
onCompleteSession(session)
-
Callback passed into requestSession() to notify that a session is available.
Parameters:
Name Type Description sessionvideoplaza.adresponse.Session Ready to use session object
-
onFailSession(message)
-
Callback passed into requestSession() to notify that the session request failed.
Parameters:
Name Type Description messagestring Error message explaining the failure
Core SDK API Documentation