Class: shaka.ads.LayoutRenderer

Constructor

new LayoutRenderer()

Source:

Members

Methods

clear(videonon-null, containernullable, layoutopt, nullable)

Undoes what shaka.ads.LayoutRenderer.render did for the layout, or for any layout if none is given.
Parameters:
Name Type Attributes Description
video HTMLElement The primary video.
container HTMLElement <nullable>
The container of the assets.
layout shaka.ads.LayoutRenderer.Layout <optional>
<nullable>
Source:

fromInterstitial(interstitial) → {shaka.ads.LayoutRenderer.Layout}

Converts the position fields of an interstitial into a layout.
Parameters:
Name Type Description
interstitial shaka.extern.AdInterstitial
Source:
Returns:
Type
shaka.ads.LayoutRenderer.Layout

isPrimaryOnTop_(layoutnon-null) → {boolean}

Parameters:
Name Type Description
layout shaka.ads.LayoutRenderer.Layout
Source:
Returns:
Type
boolean

placeAsset(elementnon-null, assetnon-null)

Places an asset element within its container.
Parameters:
Name Type Description
element HTMLElement
asset shaka.ads.LayoutRenderer.Asset
Source:

render(videonon-null, containernullable, layoutnon-null)

Applies the layout to the primary video and to the container of the assets.
Parameters:
Name Type Attributes Description
video HTMLElement The primary video.
container HTMLElement <nullable>
The container of the assets.
layout shaka.ads.LayoutRenderer.Layout
Source:

toViewport_(positionnon-null) → {shaka.ads.LayoutRenderer.Viewport}

Parameters:
Name Type Description
position shaka.extern.AdPositionInfo
Source:
Returns:
Type
shaka.ads.LayoutRenderer.Viewport

Type Definitions

Asset

Type:
Properties:
Name Type Attributes Description
viewport shaka.ads.LayoutRenderer.Viewport <nullable>
Where the asset is placed. If null, the asset is a banner of its intrinsic size across the bottom.
width number The intrinsic width of the asset in pixels, used without viewport.
height number The intrinsic height of the asset in pixels, used without viewport.
zDepth number The stacking order of the asset. Elements with a higher value are drawn on top.
Source:

Layout

Type:
Properties:
Name Type Attributes Description
primary shaka.ads.LayoutRenderer.Primary The layout of the primary video.
assets Array<!shaka.ads.LayoutRenderer.Asset> The layout of each asset presented.
background string <nullable>
The CSS background of the container of the assets.
Source:

Primary

Type:
Properties:
Name Type Attributes Description
viewport shaka.ads.LayoutRenderer.Viewport <nullable>
Where the primary video is placed, or null to leave it where it is.
zDepth number The stacking order of the primary video. Elements with a higher value are drawn on top.
Source:

Viewport

Insets of each edge of an element from the same edge of its container, as a percentage of the size of the container.
Type:
  • {top: number, right: number, bottom: number, left: number}
Source: