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 | |
|---|---|
| Public methods | |
|---|---|
| Int | |
| Long |
Gets the echo interval in milliseconds. |
| ParcelFileDescriptor? |
Gets the file descriptor of the AD media. |
| Int |
getId()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? |
getUri()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
static val REQUEST_TYPE_START: Int
Request to start an advertisement.
Value: 1REQUEST_TYPE_STOP
static val REQUEST_TYPE_STOP: Int
Request to stop an advertisement.
Value: 2Public constructors
AdRequest
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
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
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
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.
See Also
getFileDescriptor
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. |
getMediaFileType
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
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
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
fun getStartTimeMillis(): Long
Gets the start time of the AD media in milliseconds.
0 means start immediately
getStopTimeMillis
fun getStopTimeMillis(): Long
Gets the stop time of the AD media in milliseconds.
-1 means until the end
getUri
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
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 |