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 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 cast.framework.messages.Command.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
. This is 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 that indicates that the following items have been inserted into the receiver queue in this session. A cloud-based implementation might update its queue based on this new information.
Parameter |
|
---|---|
items |
Array of non-null cast.framework.messages.QueueItem The items that were inserted. 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 that indicates that the following items have been removed from the receiver queue in this session. A cloud-based implementation might update its queue based on this new information.
Parameter |
|
---|---|
itemIds |
Array of number The IDs of the items that were removed. Value must not be null. |
onItemsReordered
onItemsReordered(items, insertBefore)
A callback that indicates that the following items have been reordered.
Parameter |
|
---|---|
items |
Array of non-null cast.framework.messages.QueueItem The IDs of the items that were reordered. Value must not be null. |
insertBefore |
Optional number ID of the item that is located
immediately after the reordered list. If |
- See also
- cast.framework.messages.QueueReorderRequestData#itemIds for more details.
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
. This is 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)