MediaContent

public interface MediaContent

Provides media content information.

Public Method Summary

abstract float
getAspectRatio()
Returns the aspect ratio of the media content.
abstract float
getCurrentTime()
Gets the current time of the video in seconds.
abstract float
getDuration()
Returns the duration of the video in seconds.
abstract Drawable
getMainImage()
Returns the main image to be displayed if the media content doesn't contain video.
abstract VideoController
getVideoController()
Returns the media content's video controller.
abstract boolean
hasVideoContent()
Indicates whether the media content has video content.
abstract void
setMainImage(Drawable drawable)
Sets the optional main image to be displayed if the media content doesn't contain video.

Public Methods

public abstract float getAspectRatio ()

Returns the aspect ratio of the media content.

Returns the aspect ratio of the video if hasVideoContent() is true.

Returns the aspect ratio of the main image if hasVideoContent() is false.

public abstract float getCurrentTime ()

Gets the current time of the video in seconds. Returns 0 if the media content does not contain video.

public abstract float getDuration ()

Returns the duration of the video in seconds. Returns 0 if media content does not contain video.

public abstract Drawable getMainImage ()

Returns the main image to be displayed if the media content doesn't contain video.

The API is for native ads only.

public abstract VideoController getVideoController ()

Returns the media content's video controller.

public abstract boolean hasVideoContent ()

Indicates whether the media content has video content.

public abstract void setMainImage (Drawable drawable)

Sets the optional main image to be displayed if the media content doesn't contain video.

The API is for native ads only. Use this method if you set NativeAdOptions.shouldReturnUrlsForImageAssets() when loading native ads.