MediaContent

public interface MediaContent


Provides media content information.

Summary

Public methods

abstract float

Returns the aspect ratio of the media content.

abstract float

Gets the current time of the video in seconds.

abstract float

Returns the duration of the video in seconds.

abstract @Nullable Drawable

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

abstract VideoController

Returns the media content's video controller.

abstract boolean

Indicates whether the media content has video content.

abstract void

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

Public methods

getAspectRatio

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.

getCurrentTime

abstract float getCurrentTime()

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

getDuration

abstract float getDuration()

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

getMainImage

abstract @Nullable Drawable getMainImage()

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

The API is for native ads only.

getVideoController

abstract VideoController getVideoController()

Returns the media content's video controller.

hasVideoContent

abstract boolean hasVideoContent()

Indicates whether the media content has video content.

setMainImage

abstract void setMainImage(@Nullable 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 shouldReturnUrlsForImageAssets when loading native ads.