MediaContent

interface MediaContent 

Provides media content information.

Summary

Public functions

Float

Returns the aspect ratio of the media content.

Float

Gets the current time of the video in seconds.

Float

Returns the duration of the video in seconds.

Drawable ?

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

VideoController !

Returns the media content's video controller.

Boolean

Indicates whether the media content has video content.

Unit
setMainImage (drawable:  Drawable ?)

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

Public functions

getAspectRatio

fun  getAspectRatio 
():  Float 

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

fun  getCurrentTime 
():  Float 

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

getDuration

fun  getDuration 
():  Float 

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

getMainImage

fun  getMainImage 
():  Drawable 
?

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

The API is for native ads only.

getVideoController

fun  getVideoController 
():  VideoController 
!

Returns the media content's video controller.

hasVideoContent

fun  hasVideoContent 
():  Boolean 

Indicates whether the media content has video content.

setMainImage

fun  setMainImage 
(drawable:  Drawable 
?):  Unit 

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.

Design a Mobile Site
View Site in Mobile | Classic
Share by: