This interface is used to interact with an ad session.
You must notify this object of the following events:
- The content has started: OO.Pulse.Session#contentStarted
- The content position has changed: OO.Pulse.Session#contentPositionChanged(position)
- The content has played to completion: OO.Pulse.Session#contentFinished
The session notifies you through the listener provided to OO.Pulse.Session#startSession.
Methods
-
contentFinished()
-
The content has finished playing.
-
contentPaused()
-
The content playback was paused by the user. If a pause ad is available in the session, you will receive it through OO.Pulse.SessionListener#showPauseAd.
-
contentPositionChanged(position)
-
The content playback position has changed.
Parameters:
Name Type Description position
number The position, in seconds, where the content playback is at.
-
contentStarted()
-
The content playback has started (meaning, it has displayed the first frame) or resumed.
-
extendSession(contentMetadata, requestSettings, onComplete)
-
Request additional ads for the ad session.
Parameters:
Name Type Description contentMetadata
OO.Pulse.ContentMetadata Information about the content which a requested ad session is to be played with, as well as information targeting the desired campaign(s).
requestSettings
OO.Pulse.RequestSettings Information about the environment in which the requested ad(s) will play.
onComplete
function A function which, if provided, will be called when the session extension completes.
-
preload(ready)
-
Load all third party ads contained in the session.
Normally, third party ads are loaded when their respective ad break starts, provided that your account has lazy loading enabled. This method allows you to preload third party ads before starting the session.
Note: use with caution, because impressions may be tracked by the third party as soon as they are loaded.
Parameters:
Name Type Description ready
function A function which is called when all third party ads have been loaded.
-
startSession(sessionListener)
-
Start the ad session event flow. The provided listener implementation is notified when to play the content/ads.
This may trigger an ad break through OO.Pulse.SessionListener#startAdBreak if any prerolls ads are available, or if not it may trigger the start of the content through OO.Pulse.SessionListener#startContentPlayback.
Parameters:
Name Type Description sessionListener
OO.Pulse.SessionListener The listener that is notified of session events.
-
stopSession()
-
Notify the session that you wish to forcefully stop it. This may be called at any time during a session, even during ad playback.
No further listener methods are called.