Извлекает окно элементов, используя указанный itemID в качестве ссылки. Этот метод вызывается MediaManager , когда ему требуется больше элементов очереди, часто по запросу отправителя. Если установлены значения nextCount или prevCount , fetchItems будет возвращать элементы только после или до ссылочного элемента. Если установлены оба параметра nextCount и prevCount , будет возвращено окно элементов, включая itemId .
Инициализирует очередь с помощью requestData . Вызывается, когда получатель получает новый запрос cast.framework.messages.Command.LOAD . Если это возвращает или разрешает значение null , реализация организации очереди по умолчанию создаст очередь на queueData.items или на основе одного элемента мультимедиа в данных запроса LOAD .
Устанавливает текущий элемент в itemId . Вызывается MediaManager при изменении воспроизводимого в данный момент элемента.
Параметр
идентификатор элемента
число
Уникальный идентификатор элемента.
onItemsInserted
onItemsInserted (элементы, вставкаBefore)
Обратный вызов, указывающий, что в очередь получателя в этом сеансе были вставлены следующие элементы. Облачная реализация может обновить свою очередь на основе этой новой информации.
Идентификатор элемента, который находился сразу после вставленного списка. Если идентификатор не указан, вставленный список добавляется в конец очереди.
onItemsRemoved
onItemsRemoved (itemIds)
Обратный вызов, указывающий, что следующие элементы были удалены из очереди получателя в этом сеансе. Облачная реализация может обновить свою очередь на основе этой новой информации.
Параметр
идентификаторы предметов
Массив чисел
Идентификаторы удаленных элементов.
Значение не должно быть нулевым.
onItemsReordered
onItemsReordered (элементы, вставкаBefore)
Обратный вызов, указывающий, что порядок следующих элементов был изменен.
Идентификаторы элементов, которые были переупорядочены.
Значение не должно быть нулевым.
вставитьперед
Необязательный
число
Идентификатор элемента, расположенного сразу после переупорядоченного списка. Если insertBefore не указан, переупорядоченный список будет добавлен в конец очереди.
[[["Прост для понимания","easyToUnderstand","thumb-up"],["Помог мне решить мою проблему","solvedMyProblem","thumb-up"],["Другое","otherUp","thumb-up"]],[["Отсутствует нужная мне информация","missingTheInformationINeed","thumb-down"],["Слишком сложен/слишком много шагов","tooComplicatedTooManySteps","thumb-down"],["Устарел","outOfDate","thumb-down"],["Проблема с переводом текста","translationIssue","thumb-down"],["Проблемы образцов/кода","samplesCodeIssue","thumb-down"],["Другое","otherDown","thumb-down"]],["Последнее обновление: 2025-07-24 UTC."],[[["\u003cp\u003e\u003ccode\u003eQueueBase\u003c/code\u003e provides a foundational structure for managing media queues within the Cast framework.\u003c/p\u003e\n"],["\u003cp\u003eIt offers methods to initialize, fetch, and manipulate queue items, including shuffling and unshuffling.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can extend this base class to implement custom queueing logic for their Cast receiver applications.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eQueueBase\u003c/code\u003e interacts with \u003ccode\u003eMediaManager\u003c/code\u003e to handle queue updates and playback transitions.\u003c/p\u003e\n"],["\u003cp\u003eCallbacks are provided to inform developers about queue modifications like insertions, removals, and reordering.\u003c/p\u003e\n"]]],["The `QueueBase` class manages a media queue, fetching, initializing, and modifying items. Key actions include `fetchItems` to retrieve a range of items based on a reference ID, `initialize` to set up the queue upon a load request, and `nextItems`/`prevItems` to get items following or preceding a given item. Other methods handle updates like `onItemsInserted`, `onItemsRemoved`, `onItemsReordered`, and also manage playback order using `shuffle` and `unshuffle`. The `onCurrentItemIdChanged` method is called when an item is playing.\n"],null,["cast.[framework](/cast/docs/reference/web_receiver/cast.framework).QueueBase \nclass static\n\nBase implementation of a queue.\n\nConstructor\n\nQueueBase\n\nnew\nQueueBase()\n\nMethods\n\nfetchItems\n\nfetchItems(itemId, nextCount, prevCount) returns (non-null Array of non-null [cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem) or non-null Promise containing non-null Array of non-null [cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem))\n\nFetches a window of items using the specified `itemID` as reference. This\nmethod is called by `MediaManager` when it needs more queue items, often\nstemming from a sender request. If either `nextCount` or `prevCount` are\nset, `fetchItems` will only return items after or before the reference\nitem. If both `nextCount` and `prevCount` are set, a window of items\nincluding `itemId` will be returned.\n\n| Parameter ||\n|-----------|---------------------------------------------------|\n| itemId | number The ID of the reference item. |\n| nextCount | number Number of items after the reference item. |\n| prevCount | number Number of items before the reference item. |\n\nReturns\n\n: `(non-null Array of non-null `[cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem)` or non-null Promise containing non-null Array of non-null `[cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem)`)`\n\ninitialize\n\ninitialize(requestData) returns ([cast.framework.messages.QueueData](/cast/docs/reference/web_receiver/cast.framework.messages.QueueData) or non-null Promise containing nullable [cast.framework.messages.QueueData](/cast/docs/reference/web_receiver/cast.framework.messages.QueueData))\n\nInitializes the queue with `requestData`. Called when the receiver\ngets a new `cast.framework.messages.Command.LOAD` request. If this returns or\nresolves to `null`, the default queueing implementation will create a queue\nbased on `queueData.items` or on the single media item in the `LOAD`\nrequest data.\n\n| Parameter ||\n|-------------|----------------------------------------------------------------------------------------------------------------------------------------------|\n| requestData | [cast.framework.messages.LoadRequestData](/cast/docs/reference/web_receiver/cast.framework.messages.LoadRequestData) Value must not be null. |\n\nReturns\n\n: `(nullable `[cast.framework.messages.QueueData](/cast/docs/reference/web_receiver/cast.framework.messages.QueueData)` or non-null Promise containing nullable `[cast.framework.messages.QueueData](/cast/docs/reference/web_receiver/cast.framework.messages.QueueData)`)`\n\nnextItems\n\nnextItems(itemId) returns (nullable Array of non-null [cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem) or non-null Promise containing nullable Array of non-null [cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem))\n\nReturns all items in the queue following `itemID`. This is called by\n`MediaManager`.\n\n| Parameter ||\n|--------|-----------------------------------------------|\n| itemId | Optional number The ID of the reference item. |\n\nReturns\n\n: `(nullable Array of non-null `[cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem)` or non-null Promise containing nullable Array of non-null `[cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem)`)`\n\nonCurrentItemIdChanged\n\nonCurrentItemIdChanged(itemId)\n\nSets the current item to `itemId`. Called by `MediaManager`\nwhen it changes the currently-playing item.\n\n| Parameter ||\n|--------|------------------------------------|\n| itemId | number The unique ID for the item. |\n\nonItemsInserted\n\nonItemsInserted(items, insertBefore)\n\nA callback that indicates that the following items have been inserted into\nthe receiver queue in this session. A cloud-based implementation might\nupdate its queue based on this new information.\n\n| Parameter ||\n|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| items | Array of non-null [cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem) The items that were inserted. Value must not be null. |\n| 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. |\n\nonItemsRemoved\n\nonItemsRemoved(itemIds)\n\nA callback that indicates that the following items have been removed from\nthe receiver queue in this session. A cloud-based implementation might\nupdate its queue based on this new information.\n\n| Parameter ||\n|---------|---------------------------------------------------------------------------------|\n| itemIds | Array of number The IDs of the items that were removed. Value must not be null. |\n\nonItemsReordered\n\nonItemsReordered(items, insertBefore)\n\nA callback that indicates that the following items have been reordered.\n\n| Parameter ||\n|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| items | Array of non-null [cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem) The IDs of the items that were reordered. Value must not be null. |\n| insertBefore | Optional number ID of the item that is located immediately after the reordered list. If `insertBefore` is not provided, the reordered list will be appended to the end of the queue. |\n\nSee also\n: [cast.framework.messages.QueueReorderRequestData#itemIds](/cast/docs/reference/web_receiver/cast.framework.messages.QueueReorderRequestData#itemIds) for more details.\n\nprevItems\n\nprevItems(itemId) returns (nullable Array of non-null [cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem) or non-null Promise containing nullable Array of non-null [cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem))\n\nReturns all items before `itemID`. This is called by `MediaManager`.\n\n| Parameter ||\n|--------|-----------------------------------------------|\n| itemId | Optional number The ID of the reference item. |\n\nReturns\n\n: `(nullable Array of non-null `[cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem)` or non-null Promise containing nullable Array of non-null `[cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem)`)`\n\nshuffle\n\nshuffle() returns (nullable Array of non-null [cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem) or non-null Promise containing nullable Array of non-null [cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem))\n\nShuffles the queue and returns new queue items. Returns `null` if the\noperation is not supported.\n\nReturns\n\n: `(nullable Array of non-null `[cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem)` or non-null Promise containing nullable Array of non-null `[cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem)`)`\n\nunshuffle\n\nunshuffle() returns (nullable Array of non-null [cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem) or non-null Promise containing nullable Array of non-null [cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem))\n\nUnshuffles the queue and returns new queue items. Returns `null` if the\noperation is not supported.\n\nReturns\n\n: `(nullable Array of non-null `[cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem)` or non-null Promise containing nullable Array of non-null `[cast.framework.messages.QueueItem](/cast/docs/reference/web_receiver/cast.framework.messages.QueueItem)`)`"]]