google.ima. AdPodInfo
An ad may be part of a pod of ads. This object exposes metadata related to that pod, such as the number of ads in the pod and ad position within the pod.
The getTotalAds
API contained within this object is often
correct, but in certain scenarios, it represents the SDK's best guess. See
that method's documentation for more information.
Methods
getAdPosition
getAdPosition() returns number
Returns the position of the ad.
- Returns
-
number
The position of the ad within the pod. The value returned is one-based, for example, 1 of 2, 2 of 2, and more.
getIsBumper
getIsBumper() returns boolean
Returns true if the ad is a bumper ad. Bumper ads are short linear ads that can indicate to a user when the user is entering into or exiting from an ad break.
- Returns
-
boolean
Whether the ad is a bumper ad.
getMaxDuration
getMaxDuration() returns number
The maximum duration of the pod in seconds. For unknown duration, -1 is returned.
- Returns
-
number
The maximum duration of the ads in this pod in seconds.
getPodIndex
getPodIndex() returns number
Client side and DAI VOD: Returns the index of the ad pod. For a preroll pod, returns 0. For midrolls, returns 1, 2,..., N. For a postroll pod, returns -1. Defaults to 0 if this ad is not part of a pod, or this pod is not part of a playlist.
DAI live stream: Returns the index of the ad pod. For a preroll pod, returns 0. For midrolls, returns the break ID. Returns -2 if pod index cannot be determined (internal error).
- Returns
-
number
The index of the pod in the ad playlist.
getTimeOffset
getTimeOffset() returns number
Returns the content time offset at which the current ad pod was scheduled. For pods in VOD streams with dynamically inserted ads, stream time is returned.
For preroll pod, 0 is returned. For midrolls, the scheduled time is returned. For postroll, -1 is returned.
Defaults to 0 if this ad is not part of a pod, or the pod is not part of an ad playlist.
- Returns
-
number
The time offset for the current ad pod.
getTotalAds
getTotalAds() returns number
The total number of ads contained within this pod, including bumpers. Bumper ads are short linear ads that can indicate to a user when the user is entering into or exiting from an ad break.
Defaults to 1 if this ad is not part of a pod.
In certain scenarios, the SDK does not know for sure how many ads are contained within this ad pod. These scenarios include ad pods, which are multiple ads within a single ad tag. In these scenarios, the first few AdEvents fired (AD_METADATA, LOADED, and more.) may have just the total number of ad tags from the playlist response. We recommend using the FIRST_QUARTILE event as the event in which publishers pull information from this object and update the visual elements of the player, if any.
- Returns
-
number
Total number of ads in the pod.