MediaTrack.Builder | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Language
close

- - About
  - Wear
  - TV
  - Auto
- - Get Started
  - Devices
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
  - Google Services
  - Samples
- - Google Play
  - Essentials
  - Get Users
  - Engage & Retain
  - Monetize
  - Tools & Reference
  - Developer Stories

## Results

Loading...
Summary: Ctors | Methods | Inherited Methods | [Expand All]
public static class

# MediaTrack.Builder

extends Object

java.lang.Object
↳ | com.google.android.gms.cast.MediaTrack.Builder

## Class Overview

A builder for `MediaTrack` objects.

## Summary

Public Constructors
| MediaTrack.Builder(long trackId, int trackType) Constructs a new Builder with the given track ID and type.

Public Methods
MediaTrack | build() Builds and returns the `MediaTrack` object.
MediaTrack.Builder | setContentId(String contentId) Sets the track content ID.
MediaTrack.Builder | setContentType(String contentType) Sets the track content type.
MediaTrack.Builder | setCustomData(JSONObject customData) Sets the track's custom data object.
MediaTrack.Builder | setLanguage(Locale locale) Sets the track language from a Locale in `RFC-5464` format.
MediaTrack.Builder | setLanguage(String language) Sets the `RFC-5464` formatted track language.
MediaTrack.Builder | setName(String trackName) Sets the track name.
MediaTrack.Builder | setSubtype(int subtype) Sets the track subtype with one of the `SUBTYPE_` constants.

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)

## Public Constructors

#### public MediaTrack.Builder (long trackId, int trackType)

Constructs a new Builder with the given track ID and type.

##### Parameters

trackId | The unique ID of the media track.
trackType | The type of the track; one of the `TYPE_` constants.

##### Throws

IllegalArgumentException | If the track type is invalid.

## Public Methods

#### public MediaTrack build ()

Builds and returns the `MediaTrack` object.

#### public MediaTrack.Builder setContentId (String contentId)

Sets the track content ID.

#### public MediaTrack.Builder setContentType (String contentType)

Sets the track content type.

#### public MediaTrack.Builder setCustomData (JSONObject customData)

Sets the track's custom data object.

#### public MediaTrack.Builder setLanguage (Locale locale)

Sets the track language from a Locale in `RFC-5464` format.

#### public MediaTrack.Builder setLanguage (String language)

Sets the `RFC-5464` formatted track language.

#### public MediaTrack.Builder setName (String trackName)

Sets the track name.

#### public MediaTrack.Builder setSubtype (int subtype)

Sets the track subtype with one of the `SUBTYPE_` constants.

##### Throws

IllegalArgumentException | If the subtype is invalid.