Android APIs
public static final class

TvTrackInfo.Builder

extends Object
java.lang.Object
   ↳ android.media.tv.TvTrackInfo.Builder

Class Overview

A builder class for creating TvTrackInfo objects.

Summary

Public Constructors
TvTrackInfo.Builder(int type, String id)
Public Methods
TvTrackInfo build()
Creates a TvTrackInfo instance with the specified fields.
final TvTrackInfo.Builder setAudioChannelCount(int audioChannelCount)
Sets the audio channel count.
final TvTrackInfo.Builder setAudioSampleRate(int audioSampleRate)
Sets the audio sample rate, in the unit of Hz.
final TvTrackInfo.Builder setDescription(CharSequence description)
Sets a user readable description for the current track.
final TvTrackInfo.Builder setExtra(Bundle extra)
Sets the extra information about the current track.
final TvTrackInfo.Builder setLanguage(String language)
Sets the language information of the current track.
final TvTrackInfo.Builder setVideoFrameRate(float videoFrameRate)
Sets the frame rate of the video, in the unit fps (frames per rate).
final TvTrackInfo.Builder setVideoHeight(int videoHeight)
Sets the height of the video, in the unit of pixels.
final TvTrackInfo.Builder setVideoPixelAspectRatio(float videoPixelAspectRatio)
Sets the pixel aspect ratio (the ratio of a pixel's width to its height) of the video.
final TvTrackInfo.Builder setVideoWidth(int videoWidth)
Sets the width of the video, in the unit of pixels.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public TvTrackInfo.Builder (int type, String id)

Added in API level 21

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

Parameters
type The type of the track.
id The ID of the track that uniquely identifies the current track among all the other tracks in the same TV program.

Public Methods

public TvTrackInfo build ()

Added in API level 21

Creates a TvTrackInfo instance with the specified fields.

Returns

public final TvTrackInfo.Builder setAudioChannelCount (int audioChannelCount)

Added in API level 21

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

Parameters
audioChannelCount The audio channel count.

public final TvTrackInfo.Builder setAudioSampleRate (int audioSampleRate)

Added in API level 21

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

Parameters
audioSampleRate The audio sample rate.

public final TvTrackInfo.Builder setDescription (CharSequence description)

Added in API level 23

Sets a user readable description for the current track.

Parameters
description The user readable description.

public final TvTrackInfo.Builder setExtra (Bundle extra)

Added in API level 21

Sets the extra information about the current track.

Parameters
extra The extra information.

public final TvTrackInfo.Builder setLanguage (String language)

Added in API level 21

Sets the language information of the current track.

Parameters
language The language string encoded by either ISO 639-1 or ISO 639-2/T.

public final TvTrackInfo.Builder setVideoFrameRate (float videoFrameRate)

Added in API level 21

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

Parameters
videoFrameRate The frame rate of the video.

public final TvTrackInfo.Builder setVideoHeight (int videoHeight)

Added in API level 21

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

Parameters
videoHeight The height of the video.

public final TvTrackInfo.Builder setVideoPixelAspectRatio (float videoPixelAspectRatio)

Added in API level 23

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 The pixel aspect ratio of the video.

public final TvTrackInfo.Builder setVideoWidth (int videoWidth)

Added in API level 21

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

Parameters
videoWidth The width of the video.