cast.framework. QueueBase
Base implementation of a queue.
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 item id as reference; called by the receiver MediaManager when it needs more queue items, often as a request from senders. If only one of nextCount and prevCount is non-zero, fetchItems should only return items after or before the reference item; if both nextCount and prevCount are non-zero, a window of items including the reference item should be returned.
Parameter |
|
---|---|
itemId |
number The Id of the specified item. |
nextCount |
number Number of items after the specified item. |
prevCount |
number Number items before the specified 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 the requestData. This is called when a new LOAD request comes in to the receiver. If this returns or resolves to null, our default queueing implementation will create a queue based on queueData.items or the single media 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 next items after the reference item, often the end of the current queue, called by the receiver 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 with the itemId; called by the receiver MediaManager when it changes the current 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 optionally 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 were appended at 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 optionally choose to update its queue based on the new information.
Parameter |
|
---|---|
itemIds |
Array of number Item IDs to remove. Value must not be null. |
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 previous items before the reference item, often at the beginning of the queue, called by the receiver 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)