InstreamAd

public abstract class InstreamAd extends Object

Instream ads are video ads that are shown over an existing video player of the host app. They can be shown before, after, or at any point during video content with a seamless transition to or from video content.

Nested Class Summary

class InstreamAd.InstreamAdLoadCallback An object for receiving event notifications of loading an instream ad. 

Public Constructor Summary

Public Method Summary

abstract void
destroy()
Destroys the InstreamAd.
abstract float
getAspectRatio()
Gets the aspect ratio (the ratio of width to height) of the loaded instream ad.
abstract VideoController
getVideoController()
Gets the VideoController of the ad.
abstract float
getVideoCurrentTime()
Gets the current time of the instream video in seconds.
abstract float
getVideoDuration()
Gets the duration of the instream video in seconds.
static void
load(Context context, String adUnitId, AdRequest adRequest, int mediaAspectRatio, InstreamAd.InstreamAdLoadCallback loadCallback)
Loads an InstreamAd from AdMob.
static void
load(Context context, String adTagUrl, InstreamAd.InstreamAdLoadCallback loadCallback)
Loads an InstreamAd from Google Ad Manager.

Inherited Method Summary

Public Constructors

public InstreamAd ()

Public Methods

public abstract void destroy ()

Destroys the InstreamAd. No other methods should be called on the ad object after destroy() is called.

public abstract float getAspectRatio ()

Gets the aspect ratio (the ratio of width to height) of the loaded instream ad.

public abstract VideoController getVideoController ()

Gets the VideoController of the ad.

public abstract float getVideoCurrentTime ()

Gets the current time of the instream video in seconds.

public abstract float getVideoDuration ()

Gets the duration of the instream video in seconds.

public static void load (Context context, String adUnitId, AdRequest adRequest, int mediaAspectRatio, InstreamAd.InstreamAdLoadCallback loadCallback)

Loads an InstreamAd from AdMob.

Parameters
context The context.
adUnitId The AdMob ad unit ID.
adRequest An AdRequest object containing request information.
mediaAspectRatio The type of MediaAspectRatio that the loaded instream ad should have. Instream ad requests only support the LANDSCAPE and PORTRAIT aspect ratio types. LANDSCAPE is used by default if an unsupported MediaAspectRatio is provided.
loadCallback An object that handles instream ad loading events.

public static void load (Context context, String adTagUrl, InstreamAd.InstreamAdLoadCallback loadCallback)

Loads an InstreamAd from Google Ad Manager.

Parameters
context The context.
adTagUrl The Ad Manager ad tag URL.
loadCallback An object that handles instream ad loading events.