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_FORM
string shortForm Short form content. Typically used for news summaries, game highlights and the like.
LONG_FORM
string 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_CONTENT
string onBeforeContent Request ads to be played before the content, or 'preroll' ads.
PLAYBACK_POSITION
string 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_END
string onContentEnd Request ads to be played after the content, or 'postroll' ads.
ON_PAUSE
string onPause Request ads to be played when the content is paused.
PLAYBACK_TIME
string 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 logCallback
videoplaza.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 failedItem
videoplaza.adresponse.Ad | videoplaza.adresponse.LinearCreative The videoplaza.adresponse.Ad or videoplaza.adresponse.LinearCreative that failed.
errorString
string An error string describing why the previous item failed; valid errors are available in videoplaza.tracking.Tracker.AdErrors and videoplaza.tracking.Tracker.CreativeErrors
onComplete
videoplaza.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 contentMetadata
ContentMetadata Information about the content that is making the ad request.
requestSettings
RequestSettings Settings about the environment in which the ad will play.
onSuccess
videoplaza.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.onFail
videoplaza.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 session
videoplaza.adresponse.Session Required. The Session object to extend with additional videoplaza.adresponse.InsertionPoints.
contentMetadata
ContentMetadata Information about the content that is making the ad request.
requestSettings
RequestSettings Settings about the environment in which the ad will play.
onComplete
function 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 thirdPartyContainer
videoplaza.adresponse.Ad | videoplaza.adresponse.InsertionPoint The videoplaza.adresponse.Ad or videoplaza.adresponse.InsertionPoint to load.
onComplete
videoplaza.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 error
string Message describing the reason for canceling
-
onCompleteLazy(container)
-
Callback passed into requestThirdParty() to notify that the request succeeded.
Parameters:
Name Type Description container
videoplaza.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 ad
videoplaza.adresponse.Ad Ready to use Ad object
-
onCompleteSession(session)
-
Callback passed into requestSession() to notify that a session is available.
Parameters:
Name Type Description session
videoplaza.adresponse.Session Ready to use session object
-
onFailSession(message)
-
Callback passed into requestSession() to notify that the session request failed.
Parameters:
Name Type Description message
string Error message explaining the failure