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

# MediaQueueItem.Builder

extends Object

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

## Class Overview

A builder for `MediaQueueItem` objects.

## Summary

Public Constructors
| MediaQueueItem.Builder(MediaInfo media) Constructs a new Builder with the given `MediaInfo`.
| MediaQueueItem.Builder(JSONObject json) Constructs a new Builder from the given `JSONObject`.
| MediaQueueItem.Builder(MediaQueueItem item) Copy constructor, reads defaults from provided `MediaQueueItem`.

Public Methods
MediaQueueItem | build() Builds and returns the `MediaQueueItem` object.
MediaQueueItem.Builder | clearItemId() Optional.
MediaQueueItem.Builder | setActiveTrackIds(long[] activeTrackIds) Optional.
MediaQueueItem.Builder | setAutoplay(boolean autoplay) Optional.
MediaQueueItem.Builder | setCustomData(JSONObject customData) Optional.
MediaQueueItem.Builder | setPlaybackDuration(double playbackDuration) Optional.
MediaQueueItem.Builder | setPreloadTime(double preloadTime) Optional.
MediaQueueItem.Builder | setStartTime(double startTime) Optional.

[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(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()

## Public Constructors

#### public MediaQueueItem.Builder (MediaInfo media)

Constructs a new Builder with the given `MediaInfo`.

##### Throws

IllegalArgumentException | If the `MediaInfo` is `null`.

#### public MediaQueueItem.Builder (JSONObject json)

Constructs a new Builder from the given `JSONObject`.

##### Throws

JSONException | if any JSON parsing error.

#### public MediaQueueItem.Builder (MediaQueueItem item)

Copy constructor, reads defaults from provided `MediaQueueItem`.

##### Throws

IllegalArgumentException | If the `getMedia()` is `null`.

## Public Methods

#### public MediaQueueItem build ()

Builds and returns the `MediaQueueItem` object.

##### Throws

IllegalArgumentException | If all required fields have not been populated with valid values.

#### public MediaQueueItem.Builder clearItemId ()

Optional. Sets the item ID TO `INVALID_ITEM_ID`.

#### public MediaQueueItem.Builder setActiveTrackIds (long[] activeTrackIds)

Optional. Sets the list of active track IDs.

#### public MediaQueueItem.Builder setAutoplay (boolean autoplay)

Optional. Sets the autoplay preference.

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

Optional. Sets the custom application-specific data.

#### public MediaQueueItem.Builder setPlaybackDuration (double playbackDuration)

Optional. Sets the playback duration, in seconds.

#### public MediaQueueItem.Builder setPreloadTime (double preloadTime)

Optional. Sets the preload hint, in seconds.

##### Throws

IllegalArgumentException | If the preload time is negative.

#### public MediaQueueItem.Builder setStartTime (double startTime)

Optional. Sets the start position of the stream, in seconds.

##### Throws

IllegalArgumentException | If the start time is negative.