Class: QueueBase

Constructor

QueueBase

new QueueBase()

Methods

fetchItems

fetchItems(itemId, nextCount, prevCount) returns (non-null Array of non-null cast.framework.messages.QueueItem or non-null Promise containing non-null Array of non-null cast.framework.messages.QueueItem)

Fetches a window of items using the specified itemID as reference. This method is called by MediaManager when it needs more queue items, often stemming from a sender request. If either nextCount or prevCount are set, fetchItems will only return items after or before the reference item. If both nextCount and prevCount are set, a window of items including itemId will be returned.

Parameter

itemId

number

The ID of the reference item.

nextCount

number

Number of items after the reference item.

prevCount

number

Number of items before the reference item.

Returns

(non-null Array of non-null cast.framework.messages.QueueItem or non-null Promise containing non-null Array of non-null cast.framework.messages.QueueItem) 

initialize

initialize(requestData) returns (cast.framework.messages.QueueData or non-null Promise containing nullable cast.framework.messages.QueueData)

Initializes the queue with requestData. Called when the receiver gets a new LOAD request. If this returns or resolves to null, the default queueing implementation will create a queue based on queueData.items or on the single media item in the LOAD request data.

Parameter

requestData

cast.framework.messages.LoadRequestData

Value must not be null.

Returns

(nullable cast.framework.messages.QueueData or non-null Promise containing nullable cast.framework.messages.QueueData) 

nextItems

nextItems(itemId) returns (nullable Array of non-null cast.framework.messages.QueueItem or non-null Promise containing nullable Array of non-null cast.framework.messages.QueueItem)

Returns all items in the queue following itemID. Called by MediaManager.

Parameter

itemId

Optional

number

The ID of the reference item.

Returns

(nullable Array of non-null cast.framework.messages.QueueItem or non-null Promise containing nullable Array of non-null cast.framework.messages.QueueItem) 

onCurrentItemIdChanged

onCurrentItemIdChanged(itemId)

Sets the current item to itemId. Called by MediaManager when it changes the currently playing item.

Parameter

itemId

number

The unique ID for the item.

onItemsInserted

onItemsInserted(items, insertBefore)

A callback for informing the following items have been inserted into the receiver queue in this session. A cloud-based implementation can choose to update its queue based on the new information.

Parameter

items

Array of non-null cast.framework.messages.QueueItem

Items to insert.

Value must not be null.

insertBefore

Optional

number

ID of the item that was located immediately after the inserted list. If the ID is not provided, the inserted list was appended to the end of the queue.

onItemsRemoved

onItemsRemoved(itemIds)

A callback for informing the following items have been removed from the receiver queue in this session. A cloud-based implementation can choose to update its queue based on the new information.

Parameter

itemIds

Array of number

Item IDs to remove.

Value must not be null.

onItemsReordered

onItemsReordered(items, insertBefore)

A callback for informing the following items have been reordered.

Parameter

items

Array of non-null cast.framework.messages.QueueItem

Items to reorder.

Value must not be null.

insertBefore

Optional

number

ID of the item that will be located immediately after the reordered list. If not supplied, the reordered list will be appended to the end of the queue.

prevItems

prevItems(itemId) returns (nullable Array of non-null cast.framework.messages.QueueItem or non-null Promise containing nullable Array of non-null cast.framework.messages.QueueItem)

Returns all items before itemID, often at the beginning of the queue, called by MediaManager.

Parameter

itemId

Optional

number

The ID of the reference item.

Returns

(nullable Array of non-null cast.framework.messages.QueueItem or non-null Promise containing nullable Array of non-null cast.framework.messages.QueueItem) 

shuffle

shuffle() returns (nullable Array of non-null cast.framework.messages.QueueItem or non-null Promise containing nullable Array of non-null cast.framework.messages.QueueItem)

Shuffles the queue and returns new queue items. Returns null if the operation is not supported.

Returns

(nullable Array of non-null cast.framework.messages.QueueItem or non-null Promise containing nullable Array of non-null cast.framework.messages.QueueItem) 

unshuffle

unshuffle() returns (nullable Array of non-null cast.framework.messages.QueueItem or non-null Promise containing nullable Array of non-null cast.framework.messages.QueueItem)

Unshuffles the queue and returns new queue items. Returns null if the operation is not supported.

Returns

(nullable Array of non-null cast.framework.messages.QueueItem or non-null Promise containing nullable Array of non-null cast.framework.messages.QueueItem)