MediaQueueItem.Builder

public static classMediaQueueItem.BuilderextendsObject

A builder forMediaQueueItem objects.

Public Constructor Summary

Builder(MediaInfo media)
Constructs a new Builder with the givenMediaInfo.
Builder(JSONObjectjson)
Constructs a new Builder from the givenJSONObject.
Builder(MediaQueueItem item)
Copy constructor, reads defaults from providedMediaQueueItem.

Public Method Summary

MediaQueueItem
build()
Builds and returns theMediaQueueItem 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
setItemId(int itemId)
Sets the item ID.
MediaQueueItem.Builder
setPlaybackDuration(double playbackDuration)
Optional.
MediaQueueItem.Builder
setPreloadTime(double preloadTime)
Optional.
MediaQueueItem.Builder
setStartTime(double startTime)
Optional.

Inherited Method Summary

Public Constructors

publicBuilder(MediaInfo media)

Constructs a new Builder with the givenMediaInfo.

Throws
IllegalArgumentException If theMediaInfo isnull.

publicBuilder(JSONObject json)

Constructs a new Builder from the givenJSONObject.

Throws
JSONException if any JSON parsing error.

publicBuilder(MediaQueueItem item)

Copy constructor, reads defaults from providedMediaQueueItem.

Public Methods

publicMediaQueueItem build()

Builds and returns theMediaQueueItem object.

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

publicMediaQueueItem.Builder clearItemId()

Optional. Sets the item ID TOMediaQueueItem.INVALID_ITEM_ID.

publicMediaQueueItem.Builder setActiveTrackIds(long[] activeTrackIds)

Optional. Sets the list of active track IDs.

publicMediaQueueItem.Builder setAutoplay(boolean autoplay)

Optional. Sets the autoplay preference.

publicMediaQueueItem.Builder setCustomData(JSONObject customData)

Optional. Sets the custom application-specific data.

publicMediaQueueItem.Builder setItemId(int itemId)

Sets the item ID. This should not be called on the sender side.

publicMediaQueueItem.Builder setPlaybackDuration(double playbackDuration)

Optional. Sets the playback duration, in seconds.

publicMediaQueueItem.Builder setPreloadTime(double preloadTime)

Optional. Sets the preload hint, in seconds.

Throws
IllegalArgumentException If the preload time is negative.

publicMediaQueueItem.Builder setStartTime(double startTime)

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

The default value is NaN, meaning unspecified.

If the value is NaN, the receiver will load the media from different positions depending on the stream type:

  • Non-live streams: loaded from 0
  • Live streams: loaded from the most recent position
Throws
IllegalArgumentException If the start time is negative.