Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#inhmethods)

# TvTrackInfo.Builder

*** ** * ** ***


`
public
static
final

class
TvTrackInfo.Builder
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.media.tv.TvTrackInfo.Builder |

<br />

*** ** * ** ***

A builder class for creating `https://developer.android.com/reference/android/media/tv/TvTrackInfo` objects.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#Builder(int,%20java.lang.String)(int type, https://developer.android.com/reference/java/lang/String id) ` Create a `https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder`. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/media/tv/TvTrackInfo` | ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#build()() ` Creates a `https://developer.android.com/reference/android/media/tv/TvTrackInfo` instance with the specified fields. |
| ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#setAudioChannelCount(int)(int audioChannelCount) ` Sets the audio channel count. |
| ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#setAudioDescription(boolean)(boolean audioDescription) ` Sets the audio description attribute of the audio. |
| ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#setAudioSampleRate(int)(int audioSampleRate) ` Sets the audio sample rate, in the unit of Hz. |
| ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#setDescription(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence description) ` Sets a user readable description for the current track. |
| ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#setEncoding(java.lang.String)(https://developer.android.com/reference/java/lang/String encoding) ` Sets the encoding of the track. |
| ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#setEncrypted(boolean)(boolean encrypted) ` Sets the encryption status of the track. |
| ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#setExtra(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle extra) ` Sets the extra information about the current track. |
| ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#setHardOfHearing(boolean)(boolean hardOfHearing) ` Sets the hard of hearing attribute of the track. |
| ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#setLanguage(java.lang.String)(https://developer.android.com/reference/java/lang/String language) ` Sets the language information of the current track. |
| ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#setSpokenSubtitle(boolean)(boolean spokenSubtitle) ` Sets the spoken subtitle attribute of the audio. |
| ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#setVideoActiveFormatDescription(byte)(byte videoActiveFormatDescription) ` Sets the Active Format Description (AFD) code of the video. |
| ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#setVideoFrameRate(float)(float videoFrameRate) ` Sets the frame rate of the video, in the unit fps (frames per rate). |
| ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#setVideoHeight(int)(int videoHeight) ` Sets the height of the video, in the unit of pixels. |
| ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#setVideoPixelAspectRatio(float)(float videoPixelAspectRatio) ` Sets the pixel aspect ratio (the ratio of a pixel's width to its height) of the video. |
| ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | ` https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder#setVideoWidth(int)(int videoWidth) ` Sets the width of the video, in the unit of pixels. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||

## Public constructors

### Builder

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Builder (int type, 
                String id)
```

Create a `https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder`. Any field that should be included in the `https://developer.android.com/reference/android/media/tv/TvTrackInfo`
must be added.

<br />

| Parameters ||
|---|---|
| `type` | `int`: The type of the track. Value is one of the following: - `https://developer.android.com/reference/android/media/tv/TvTrackInfo#TYPE_AUDIO` - `https://developer.android.com/reference/android/media/tv/TvTrackInfo#TYPE_VIDEO` - `https://developer.android.com/reference/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`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the type is not any of `https://developer.android.com/reference/android/media/tv/TvTrackInfo#TYPE_AUDIO`, `https://developer.android.com/reference/android/media/tv/TvTrackInfo#TYPE_VIDEO` and `https://developer.android.com/reference/android/media/tv/TvTrackInfo#TYPE_SUBTITLE` |

## Public methods

### build

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TvTrackInfo build ()
```

Creates a `https://developer.android.com/reference/android/media/tv/TvTrackInfo` instance with the specified fields.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/tv/TvTrackInfo` | The new `https://developer.android.com/reference/android/media/tv/TvTrackInfo` instance. This value cannot be `null`. <br /> |

### setAudioChannelCount

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TvTrackInfo.Builder setAudioChannelCount (int audioChannelCount)
```

Sets the audio channel count. Valid only for `https://developer.android.com/reference/android/media/tv/TvTrackInfo#TYPE_AUDIO` tracks.

<br />

| Parameters ||
|---|---|
| `audioChannelCount` | `int`: The audio channel count. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if not called on an audio track |

### setAudioDescription

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TvTrackInfo.Builder setAudioDescription (boolean audioDescription)
```

Sets the audio description attribute of the audio. Valid only for `https://developer.android.com/reference/android/media/tv/TvTrackInfo#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).

<br />

| Parameters ||
|---|---|
| `audioDescription` | `boolean`: The audio description attribute of the audio. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if not called on an audio track |

### setAudioSampleRate

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TvTrackInfo.Builder setAudioSampleRate (int audioSampleRate)
```

Sets the audio sample rate, in the unit of Hz. Valid only for `https://developer.android.com/reference/android/media/tv/TvTrackInfo#TYPE_AUDIO`
tracks.

<br />

| Parameters ||
|---|---|
| `audioSampleRate` | `int`: The audio sample rate. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if not called on an audio track |

### setDescription

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TvTrackInfo.Builder setDescription (CharSequence description)
```

Sets a user readable description for the current track.

<br />

| Parameters ||
|---|---|
| `description` | `CharSequence`: The user readable description. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | This value cannot be `null`. <br /> |

### setEncoding

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TvTrackInfo.Builder setEncoding (String encoding)
```

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).

<br />

| Parameters ||
|---|---|
| `encoding` | `String`: The encoding of the track in the form of mime type. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | This value cannot be `null`. <br /> |

### setEncrypted

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TvTrackInfo.Builder setEncrypted (boolean encrypted)
```

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.

<br />

| Parameters ||
|---|---|
| `encrypted` | `boolean`: The encryption status of the track. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | This value cannot be `null`. <br /> |

### setExtra

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TvTrackInfo.Builder setExtra (Bundle extra)
```

Sets the extra information about the current track.

<br />

| Parameters ||
|---|---|
| `extra` | `Bundle`: The extra information. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | This value cannot be `null`. <br /> |

### setHardOfHearing

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TvTrackInfo.Builder setHardOfHearing (boolean hardOfHearing)
```

Sets the hard of hearing attribute of the track. Valid only for `https://developer.android.com/reference/android/media/tv/TvTrackInfo#TYPE_AUDIO` and
`https://developer.android.com/reference/android/media/tv/TvTrackInfo#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).

<br />

| Parameters ||
|---|---|
| `hardOfHearing` | `boolean`: The hard of hearing attribute of the track. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if not called on an audio track or a subtitle track |

### setLanguage

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TvTrackInfo.Builder setLanguage (String language)
```

Sets the language information of the current track.

<br />

| Parameters ||
|---|---|
| `language` | `String`: The language string encoded by either ISO 639-1 or ISO 639-2/T. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | This value cannot be `null`. <br /> |

### setSpokenSubtitle

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TvTrackInfo.Builder setSpokenSubtitle (boolean spokenSubtitle)
```

Sets the spoken subtitle attribute of the audio. Valid only for `https://developer.android.com/reference/android/media/tv/TvTrackInfo#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).

<br />

| Parameters ||
|---|---|
| `spokenSubtitle` | `boolean`: The spoken subtitle attribute of the audio. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if not called on an audio track |

### setVideoActiveFormatDescription

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TvTrackInfo.Builder setVideoActiveFormatDescription (byte videoActiveFormatDescription)
```

Sets the Active Format Description (AFD) code of the video.
Valid only for `https://developer.android.com/reference/android/media/tv/TvTrackInfo#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.

<br />

| Parameters ||
|---|---|
| `videoActiveFormatDescription` | `byte`: The AFD code of the video. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if not called on a video track |

### setVideoFrameRate

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TvTrackInfo.Builder setVideoFrameRate (float videoFrameRate)
```

Sets the frame rate of the video, in the unit fps (frames per rate). Valid only for
`https://developer.android.com/reference/android/media/tv/TvTrackInfo#TYPE_VIDEO` tracks.

<br />

| Parameters ||
|---|---|
| `videoFrameRate` | `float`: The frame rate of the video. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if not called on a video track |

### setVideoHeight

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TvTrackInfo.Builder setVideoHeight (int videoHeight)
```

Sets the height of the video, in the unit of pixels. Valid only for `https://developer.android.com/reference/android/media/tv/TvTrackInfo#TYPE_VIDEO`
tracks.

<br />

| Parameters ||
|---|---|
| `videoHeight` | `int`: The height of the video. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if not called on a video track |

### setVideoPixelAspectRatio

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TvTrackInfo.Builder setVideoPixelAspectRatio (float videoPixelAspectRatio)
```

Sets the pixel aspect ratio (the ratio of a pixel's width to its height) of the video.
Valid only for `https://developer.android.com/reference/android/media/tv/TvTrackInfo#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.

<br />

| Parameters ||
|---|---|
| `videoPixelAspectRatio` | `float`: The pixel aspect ratio of the video. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if not called on a video track |

### setVideoWidth

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TvTrackInfo.Builder setVideoWidth (int videoWidth)
```

Sets the width of the video, in the unit of pixels. Valid only for `https://developer.android.com/reference/android/media/tv/TvTrackInfo#TYPE_VIDEO`
tracks.

<br />

| Parameters ||
|---|---|
| `videoWidth` | `int`: The width of the video. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/tv/TvTrackInfo.Builder` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if not called on a video track |