MediaQueueItem.Builder

public static class MediaQueueItem.Builder extends Object

A builder for MediaQueueItem objects.

Public Constructor Summary

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

Public Method Summary

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

public Builder (MediaInfo media)

Constructs a new Builder with the given MediaInfo.

Throws
IllegalArgumentException If the MediaInfo is null.

public Builder (JSONObject json)

Constructs a new Builder from the given JSONObject.

Throws
JSONException if any JSON parsing error.

public Builder (MediaQueueItem item)

Copy constructor, reads defaults from provided MediaQueueItem.

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 MediaQueueItem.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 setItemId (int itemId)

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

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.

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.