TVSDK supports displaying linear Video Player-Ad Interface Definition (VPAID) ads in an ad break. VPAID version 1.0 requires Flash, while version 2.0 also works with Browser TVSDK and JavaScript.
To display VPAID ads correctly, you must provide an ad container ( AdContainerView
) within the MediaPlayerContext
instance.
Limitations for VPAID ads:
To set up an ad container for displaying VPAID ads (version 1.0 or 2.0) within an ad break:
Use the following sample code to set up an ad container that can show VPAID ads.
var context:MediaPlayerContext =
new MediaPlayerContext(_authorizedFeatureHelper.authorizedFeatures);
adContainer = new AdContainerView();
adContainer.x = adContainer.y = 0;
adContainer.setSize(videoContainer.width, videoContainer.height);
addChild(adContainer);
context.adContainer = adContainer;
_player = new DefaultMediaPlayer(context);
When the view resizes, reset the size on the ad container.
adContainer.setSize(stage.stageWidth, stage.stageHeight);
When you get a full-screen-change event and you set the new size on the ad container, pass the stage display state as follows to ensure that the player resizes correctly:
private function onFullScreenChange(event:FullScreenEvent):void {
if (_adContainer)
{ _adContainer.setSize(stage.stageWidth, stage.stageHeight, stage.displayState); }
}