Added in API level 33

AdRequest


class AdRequest : Parcelable
kotlin.Any
   ↳ android.media.tv.AdRequest

An advertisement request which can be sent to TV input to request AD operations.

Summary

Constants
static Int

Request to start an advertisement.

static Int

Request to stop an advertisement.

Inherited constants
Public constructors
AdRequest(id: Int, requestType: Int, uri: Uri?, startTime: Long, stopTime: Long, echoInterval: Long, metadata: Bundle)

AdRequest(id: Int, requestType: Int, fileDescriptor: ParcelFileDescriptor?, startTime: Long, stopTime: Long, echoInterval: Long, mediaFileType: String?, metadata: Bundle)

Public methods
Int

Long

Gets the echo interval in milliseconds.

ParcelFileDescriptor?

Gets the file descriptor of the AD media.

Int

Gets the ID of AD request.

String?

Gets the media file type such as mp4, mob, avi.

Bundle

Gets the metadata of the media file.

Int

Gets the request type.

Long

Gets the start time of the AD media in milliseconds.

Long

Gets the stop time of the AD media in milliseconds.

Uri?

Gets the URI of the AD media.

Unit
writeToParcel(dest: Parcel, flags: Int)

Flatten this object in to a Parcel.

Properties
static Parcelable.Creator<AdRequest!>

Constants

REQUEST_TYPE_START

Added in API level 33
static val REQUEST_TYPE_START: Int

Request to start an advertisement.

Value: 1

REQUEST_TYPE_STOP

Added in API level 33
static val REQUEST_TYPE_STOP: Int

Request to stop an advertisement.

Value: 2

Public constructors

AdRequest

Added in API level 34
AdRequest(
    id: Int,
    requestType: Int,
    uri: Uri?,
    startTime: Long,
    stopTime: Long,
    echoInterval: Long,
    metadata: Bundle)
Parameters
requestType Int: Value is android.media.tv.AdRequest#REQUEST_TYPE_START, or android.media.tv.AdRequest#REQUEST_TYPE_STOP
uri Uri?: This value may be null.
metadata Bundle: This value cannot be null.

AdRequest

Added in API level 33
AdRequest(
    id: Int,
    requestType: Int,
    fileDescriptor: ParcelFileDescriptor?,
    startTime: Long,
    stopTime: Long,
    echoInterval: Long,
    mediaFileType: String?,
    metadata: Bundle)
Parameters
requestType Int: Value is android.media.tv.AdRequest#REQUEST_TYPE_START, or android.media.tv.AdRequest#REQUEST_TYPE_STOP
fileDescriptor ParcelFileDescriptor?: This value may be null.
mediaFileType String?: This value may be null.
metadata Bundle: This value cannot be null.

Public methods

describeContents

Added in API level 33
fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

getEchoIntervalMillis

Added in API level 33
fun getEchoIntervalMillis(): Long

Gets the echo interval in milliseconds.

The interval TV input needs to echo and inform TV interactive app service the video playback elapsed time.

getFileDescriptor

Added in API level 33
fun getFileDescriptor(): ParcelFileDescriptor?

Gets the file descriptor of the AD media.

Return
ParcelFileDescriptor? The file descriptor of the AD media. Can be null for REQUEST_TYPE_STOP or a URI is used.

getId

Added in API level 33
fun getId(): Int

Gets the ID of AD request.

getMediaFileType

Added in API level 33
fun getMediaFileType(): String?

Gets the media file type such as mp4, mob, avi.

Return
String? The media file type. Can be null for REQUEST_TYPE_STOP.

getMetadata

Added in API level 33
fun getMetadata(): Bundle

Gets the metadata of the media file.

This includes additional information the TV input needs to play the AD media. This may include fields in android.media.MediaFormat like android.media.MediaFormat#KEY_SAMPLE_RATE, or integrity information like SHA. What data is included depends on the format of the media file.

Return
Bundle The metadata of the media file. Can be an empty bundle for REQUEST_TYPE_STOP. This value cannot be null.

getRequestType

Added in API level 33
fun getRequestType(): Int

Gets the request type.

Return
Int Value is android.media.tv.AdRequest#REQUEST_TYPE_START, or android.media.tv.AdRequest#REQUEST_TYPE_STOP

getStartTimeMillis

Added in API level 33
fun getStartTimeMillis(): Long

Gets the start time of the AD media in milliseconds.

0 means start immediately

getStopTimeMillis

Added in API level 33
fun getStopTimeMillis(): Long

Gets the stop time of the AD media in milliseconds.

-1 means until the end

getUri

Added in API level 34
fun getUri(): Uri?

Gets the URI of the AD media.

Return
Uri? The URI of the AD media. Can be null for REQUEST_TYPE_STOP or a file descriptor is used.

writeToParcel

Added in API level 33
fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 33
static val CREATOR: Parcelable.Creator<AdRequest!>