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()
This method is deprecated. Use
MediaContent.getAspectRatio() .
|
abstract MediaContent |
getMediaContent()
Get the
MediaContent
associated with this ad.
|
abstract VideoController |
getVideoController()
This method is deprecated. Use
MediaContent.getVideoController() .
|
abstract float |
getVideoCurrentTime()
This method is deprecated. Use
MediaContent.getCurrentTime() .
|
abstract float |
getVideoDuration()
This method is deprecated. Use
MediaContent.getDuration() .
|
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 ()
This method is deprecated.
Use MediaContent.getAspectRatio()
.
Gets the aspect ratio (the ratio of width to height) of the loaded instream ad.
public abstract MediaContent getMediaContent ()
Get the MediaContent
associated with this ad.
public abstract VideoController getVideoController ()
This method is deprecated.
Use MediaContent.getVideoController()
.
Gets the VideoController
of the ad.
public abstract float getVideoCurrentTime ()
This method is deprecated.
Use MediaContent.getCurrentTime()
.
Gets the current time of the instream video in seconds.
public abstract float getVideoDuration ()
This method is deprecated.
Use MediaContent.getDuration()
.
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
MediaAspectRatio.LANDSCAPE
and MediaAspectRatio.PORTRAIT
aspect ratio types. MediaAspectRatio.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. |