Added in API level 21

Builder

class Builder
kotlin.Any
   ↳ android.media.tv.TvTrackInfo.Builder

A builder class for creating TvTrackInfo objects.

Summary

Public constructors
Builder(type: Int, id: String)

Create a Builder.

Public methods
TvTrackInfo

Creates a TvTrackInfo instance with the specified fields.

TvTrackInfo.Builder
setAudioChannelCount(audioChannelCount: Int)

Sets the audio channel count.

TvTrackInfo.Builder
setAudioDescription(audioDescription: Boolean)

Sets the audio description attribute of the audio.

TvTrackInfo.Builder
setAudioSampleRate(audioSampleRate: Int)

Sets the audio sample rate, in the unit of Hz.

TvTrackInfo.Builder

Sets a user readable description for the current track.

TvTrackInfo.Builder
setEncoding(encoding: String?)

Sets the encoding of the track.

TvTrackInfo.Builder
setEncrypted(encrypted: Boolean)

Sets the encryption status of the track.

TvTrackInfo.Builder
setExtra(extra: Bundle)

Sets the extra information about the current track.

TvTrackInfo.Builder
setHardOfHearing(hardOfHearing: Boolean)

Sets the hard of hearing attribute of the track.

TvTrackInfo.Builder
setLanguage(language: String)

Sets the language information of the current track.

TvTrackInfo.Builder
setSpokenSubtitle(spokenSubtitle: Boolean)

Sets the spoken subtitle attribute of the audio.

TvTrackInfo.Builder
setVideoActiveFormatDescription(videoActiveFormatDescription: Byte)

Sets the Active Format Description (AFD) code of the video.

TvTrackInfo.Builder
setVideoFrameRate(videoFrameRate: Float)

Sets the frame rate of the video, in the unit fps (frames per rate).

TvTrackInfo.Builder
setVideoHeight(videoHeight: Int)

Sets the height of the video, in the unit of pixels.

TvTrackInfo.Builder
setVideoPixelAspectRatio(videoPixelAspectRatio: Float)

Sets the pixel aspect ratio (the ratio of a pixel's width to its height) of the video.

TvTrackInfo.Builder
setVideoWidth(videoWidth: Int)

Sets the width of the video, in the unit of pixels.

Public constructors

Builder

Added in API level 21
Builder(
    type: Int,
    id: String)

Create a Builder. Any field that should be included in the TvTrackInfo must be added.

Parameters
type Int: The type of the track. Value is android.media.tv.TvTrackInfo#TYPE_AUDIO, android.media.tv.TvTrackInfo#TYPE_VIDEO, or android.media.tv.TvTrackInfo#TYPE_SUBTITLE
id String: The ID of the track that uniquely identifies the current track among all the other tracks in the same TV program. This value cannot be null.
Exceptions
java.lang.IllegalArgumentException if the type is not any of TYPE_AUDIO, TYPE_VIDEO and TYPE_SUBTITLE

Public methods

build

Added in API level 21
fun build(): TvTrackInfo

Creates a TvTrackInfo instance with the specified fields.

Return
TvTrackInfo The new TvTrackInfo instance This value cannot be null.

setAudioChannelCount

Added in API level 21
fun setAudioChannelCount(audioChannelCount: Int): TvTrackInfo.Builder

Sets the audio channel count. Valid only for TYPE_AUDIO tracks.

Parameters
audioChannelCount Int: The audio channel count.
Return
TvTrackInfo.Builder This value cannot be null.
Exceptions
java.lang.IllegalStateException if not called on an audio track

setAudioDescription

Added in API level 30
fun setAudioDescription(audioDescription: Boolean): TvTrackInfo.Builder

Sets the audio description attribute of the audio. Valid only for TYPE_AUDIO tracks.

For example of broadcast, audio description information may be referred to broadcast standard (e.g. ISO 639 Language Descriptor of ISO/IEC 13818-1, Supplementary Audio Language Descriptor, AC-3 Descriptor, Enhanced AC-3 Descriptor, AAC Descriptor of ETSI EN 300 468).

Parameters
audioDescription Boolean: The audio description attribute of the audio.
Return
TvTrackInfo.Builder This value cannot be null.
Exceptions
java.lang.IllegalStateException if not called on an audio track

setAudioSampleRate

Added in API level 21
fun setAudioSampleRate(audioSampleRate: Int): TvTrackInfo.Builder

Sets the audio sample rate, in the unit of Hz. Valid only for TYPE_AUDIO tracks.

Parameters
audioSampleRate Int: The audio sample rate.
Return
TvTrackInfo.Builder This value cannot be null.
Exceptions
java.lang.IllegalStateException if not called on an audio track

setDescription

Added in API level 23
fun setDescription(description: CharSequence): TvTrackInfo.Builder

Sets a user readable description for the current track.

Parameters
description CharSequence: The user readable description. This value cannot be null.
Return
TvTrackInfo.Builder This value cannot be null.

setEncoding

Added in API level 30
fun setEncoding(encoding: String?): TvTrackInfo.Builder

Sets the encoding of the track.

For example of broadcast, codec information may be referred to broadcast standard (e.g. Component Descriptor of ETSI EN 300 468). In the case that track type is subtitle, mime type could be defined in broadcast standard (e.g. "text/dvb.subtitle" or "text/dvb.teletext" in ETSI TS 102 812 V1.3.1 section 7.6).

Parameters
encoding String?: The encoding of the track in the form of mime type. This value may be null.
Return
TvTrackInfo.Builder This value cannot be null.

setEncrypted

Added in API level 30
fun setEncrypted(encrypted: Boolean): TvTrackInfo.Builder

Sets the encryption status of the track.

For example: ISO/IEC 13818-1 defines a CA descriptor that can be used to determine the encryption status of some broadcast streams.

Parameters
encrypted Boolean: The encryption status of the track.
Return
TvTrackInfo.Builder This value cannot be null.

setExtra

Added in API level 21
fun setExtra(extra: Bundle): TvTrackInfo.Builder

Sets the extra information about the current track.

Parameters
extra Bundle: The extra information. This value cannot be null.
Return
TvTrackInfo.Builder This value cannot be null.

setHardOfHearing

Added in API level 30
fun setHardOfHearing(hardOfHearing: Boolean): TvTrackInfo.Builder

Sets the hard of hearing attribute of the track. Valid only for TYPE_AUDIO and TYPE_SUBTITLE tracks.

For example of broadcast, hard of hearing information may be referred to broadcast standard (e.g. ISO 639 Language Descriptor of ISO/IEC 13818-1, Supplementary Audio Language Descriptor, AC-3 Descriptor, Enhanced AC-3 Descriptor, AAC Descriptor of ETSI EN 300 468).

Parameters
hardOfHearing Boolean: The hard of hearing attribute of the track.
Return
TvTrackInfo.Builder This value cannot be null.
Exceptions
java.lang.IllegalStateException if not called on an audio track or a subtitle track

setLanguage

Added in API level 21
fun setLanguage(language: String): TvTrackInfo.Builder

Sets the language information of the current track.

Parameters
language String: The language string encoded by either ISO 639-1 or ISO 639-2/T. This value cannot be null.
Return
TvTrackInfo.Builder This value cannot be null.

setSpokenSubtitle

Added in API level 30
fun setSpokenSubtitle(spokenSubtitle: Boolean): TvTrackInfo.Builder

Sets the spoken subtitle attribute of the audio. Valid only for TYPE_AUDIO tracks.

For example of broadcast, spoken subtitle information may be referred to broadcast standard (e.g. Supplementary Audio Language Descriptor of ETSI EN 300 468).

Parameters
spokenSubtitle Boolean: The spoken subtitle attribute of the audio.
Return
TvTrackInfo.Builder This value cannot be null.
Exceptions
java.lang.IllegalStateException if not called on an audio track

setVideoActiveFormatDescription

Added in API level 24
fun setVideoActiveFormatDescription(videoActiveFormatDescription: Byte): TvTrackInfo.Builder

Sets the Active Format Description (AFD) code of the video. Valid only for TYPE_VIDEO tracks.

This is needed for applications to be able to scale the video properly based on the information about where in the coded picture the active video is. The complete list of values are defined in ETSI TS 101 154 V1.7.1 Annex B, ATSC A/53 Part 4 and SMPTE 2016-1-2007.

Parameters
videoActiveFormatDescription Byte: The AFD code of the video.
Return
TvTrackInfo.Builder This value cannot be null.
Exceptions
java.lang.IllegalStateException if not called on a video track

setVideoFrameRate

Added in API level 21
fun setVideoFrameRate(videoFrameRate: Float): TvTrackInfo.Builder

Sets the frame rate of the video, in the unit fps (frames per rate). Valid only for TYPE_VIDEO tracks.

Parameters
videoFrameRate Float: The frame rate of the video.
Return
TvTrackInfo.Builder This value cannot be null.
Exceptions
java.lang.IllegalStateException if not called on a video track

setVideoHeight

Added in API level 21
fun setVideoHeight(videoHeight: Int): TvTrackInfo.Builder

Sets the height of the video, in the unit of pixels. Valid only for TYPE_VIDEO tracks.

Parameters
videoHeight Int: The height of the video.
Return
TvTrackInfo.Builder This value cannot be null.
Exceptions
java.lang.IllegalStateException if not called on a video track

setVideoPixelAspectRatio

Added in API level 23
fun setVideoPixelAspectRatio(videoPixelAspectRatio: Float): TvTrackInfo.Builder

Sets the pixel aspect ratio (the ratio of a pixel's width to its height) of the video. Valid only for TYPE_VIDEO tracks.

This is needed for applications to be able to scale the video properly for some video formats such as 720x576 4:3 and 720x576 16:9 where pixels are not square. By default, applications assume the value of 1.0 (square pixels), so it is not necessary to set the pixel aspect ratio for most video formats.

Parameters
videoPixelAspectRatio Float: The pixel aspect ratio of the video.
Return
TvTrackInfo.Builder This value cannot be null.
Exceptions
java.lang.IllegalStateException if not called on a video track

setVideoWidth

Added in API level 21
fun setVideoWidth(videoWidth: Int): TvTrackInfo.Builder

Sets the width of the video, in the unit of pixels. Valid only for TYPE_VIDEO tracks.

Parameters
videoWidth Int: The width of the video.
Return
TvTrackInfo.Builder This value cannot be null.
Exceptions
java.lang.IllegalStateException if not called on a video track