Callback definitions for custom ad player behaviour.
Type Definitions
-
Callbacks
-
Callbacks which can be passed to OO.Pulse#createAdPlayer in order to customize the ad player behaviour.
Type:
- Object
Properties:
Name Type Description setVideoSource
OO.Pulse.CustomBehaviours~setVideoSource If assigned, the function will be called when the ad player needs to play an HTML5 video. If not provided, the ad player will directly set the
src
attribute of the element used. -
setVideoSource(mediaFile, videoElement)
-
Customize how media sources are assigned to the video element used for HTML5 video playback.
For more information, please refer to OO.Pulse#createAdPlayer.
Parameters:
Name Type Description mediaFile
videoplaza.adresponse.MediaFile The media file which the ad player is trying to play.
videoElement
HTMLVideoElement The video element in which the ad player is trying to play the video.
Example
// For videojs, we can use the player's own API to set both the source URL and MIME-type of the ad asset. // Assume "player" refers to a videojs player instance and that we are playing our ads in it, as on mobile. var customBehaviours = { setVideoSource: function(mediaFile, element) { player.src({ src: mediaFile.url, type: mediaFile.mimeType }); } }; var adPlayer = OO.Pulse.createAdPlayer(adContainerDiv, null, null, customBehaviours);