Thông tin về mục trong hàng đợi. Nhà phát triển ứng dụng có thể cần tạo mộtQueueItem để chèn một phần tử hàng đợi bằng cách sử dụng Cast.framework.messages.InsertQueueItems. Trong trường hợp này, chúng không nên cung cấp itemId (vì itemId thực tế sẽ được gán khi mục được chèn vào hàng đợi). Điều này giúp tránh xung đột mã nhận dạng với các mục được thêm từ ứng dụng của người gửi.
Hàm dựng
QueueItem
mới
Hàng đợi(opt_itemId)
Thông số
opt_itemId
Không bắt buộc
number
Mã mặt hàng.
Thuộc tính
activeTrackIds
(Mảng số có giá trị không rỗng hoặc không xác định)
Mảng mã theo dõi đang hoạt động. Nếu bạn không cung cấp mảng, các kênh mặc định sẽ hoạt động.
tự động phát
(Boolean hoặc không xác định)
Nếu tham số tự động phát không được chỉ định hoặc đúng, thì trình phát nội dung đa phương tiện sẽ bắt đầu phát phần tử trong hàng đợi khi mục đó trở thành currentItem.
customData
(Đối tượng rỗng hoặc không xác định)
Ứng dụng có thể xác định mọi thông tin cần thiết về mục trong hàng đợi bổ sung.
itemId
(số hoặc không xác định)
Giá trị nhận dạng duy nhất của mục trong hàng đợi. Thuộc tính này là không bắt buộc vì bạn không nên cung cấp TẢI hoặc CHÈN (vì thuộc tính này sẽ được trình thu chỉ định khi một mục được tạo/chèn lần đầu tiên).
Siêu dữ liệu (bao gồm cả contentId) của thành phần trong danh sách phát.
orderId
(số hoặc không xác định)
Dùng để theo dõi thứ tự ban đầu của một mục trong hàng đợi để huỷ trộn.
preloadTime
(số hoặc không xác định)
Tham số này là gợi ý để trình thu tải tải trước mục nội dung đa phương tiện này trước khi phát. Nhờ vậy, quá trình chuyển đổi giữa các mục được phát trong hàng đợi sẽ diễn ra suôn sẻ. Thời gian được biểu thị bằng giây, tương ứng với thời điểm bắt đầu phát mục này (thường là thời điểm kết thúc phát mục trước đó). Ví dụ: nếu giá trị là 10 giây, mục này sẽ được tải trước 10 giây trước khi mục trước kết thúc. Trình thu nhận sẽ cố gắng tuân thủ giá trị này nhưng không đảm bảo, chẳng hạn như nếu giá trị lớn hơn thời lượng mục trước đó, thì trình thu nhận có thể tải trước mục này ngay sau khi mục trước đó bắt đầu phát (sẽ không bao giờ có hai mục được tải trước song song). Ngoài ra, nếu một mục được chèn vào hàng đợi ngay sau currentItem và thời gian tải trước lâu hơn thời gian còn lại của currentItem, thì quá trình tải trước sẽ diễn ra sớm nhất có thể. Giá trị âm vô hiệu hoá rõ ràng tính năng tải trước. Nếu giá trị là 0 hoặc không xác định, mục nội dung đa phương tiện sẽ bắt đầu tải trước ngay khi mục trước được tải xuống hoàn toàn sau vị trí phát.
startTime
(số hoặc không xác định)
Số giây kể từ khi bắt đầu nội dung. Nếu nội dung là nội dung phát trực tiếp và bạn không chỉ định thời gian bắt đầu, thì sự kiện phát trực tiếp sẽ bắt đầu ở vị trí phát trực tiếp.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[[["\u003cp\u003e\u003ccode\u003eQueueItem\u003c/code\u003e objects represent items within a media queue, holding information like media metadata, playback settings, and custom data.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can create \u003ccode\u003eQueueItem\u003c/code\u003e instances to insert elements into the queue, but should omit the \u003ccode\u003eitemId\u003c/code\u003e for new items to avoid conflicts.\u003c/p\u003e\n"],["\u003cp\u003eKey properties of a \u003ccode\u003eQueueItem\u003c/code\u003e include \u003ccode\u003emedia\u003c/code\u003e for content details, \u003ccode\u003eautoplay\u003c/code\u003e and \u003ccode\u003estartTime\u003c/code\u003e for playback control, and \u003ccode\u003epreloadTime\u003c/code\u003e to optimize transitions.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ecustomData\u003c/code\u003e property allows developers to attach application-specific information to queue items for extended functionality.\u003c/p\u003e\n"],["\u003cp\u003eExisting queue items can be identified and managed using their unique \u003ccode\u003eitemId\u003c/code\u003e, assigned by the receiver upon insertion.\u003c/p\u003e\n"]]],["`QueueItem` stores queue element information. Developers create it for inserting queue elements, omitting `itemId` to prevent collisions. Key properties include: `activeTrackIds` (active track IDs), `autoplay` (automatic playback), `customData` (extra data), `media` (metadata), `orderId` (original order), `preloadTime` (preloading hint), and `startTime` (content start time). `itemId` is assigned by the receiver during creation/insertion, and `preloadTime` helps smooth transitions between queued items.\n"],null,["# Class: QueueItem\n\ncast.[framework](/cast/docs/reference/web_receiver/cast.framework).[messages](/cast/docs/reference/web_receiver/cast.framework.messages).QueueItem\n==================================================================================================================================================\n\nclass static\n\nQueue item information. Application developers may need to create a QueueItem\nto insert a queue element using\ncast.framework.messages.InsertQueueItems. In this case they should\nnot provide an itemId (as the actual itemId will be assigned when the item is\ninserted in the queue). This prevents ID collisions with items added from a\nsender app.\n\nConstructor\n-----------\n\n### QueueItem\n\nnew\nQueueItem(opt_itemId)\n\n| #### Parameter ||\n|------------|------------------------------|\n| opt_itemId | Optional number The item ID. |\n\nProperties\n----------\n\n### activeTrackIds\n\n(non-null Array of number or undefined)\n\nArray of Track trackIds that are active. If the array is not provided,\nthe default tracks will be active.\n\n### autoplay\n\n(boolean or undefined)\n\nIf the autoplay parameter is not specified or is true, the media player\nwill begin playing the element in the queue when the item becomes the\ncurrentItem.\n\n### customData\n\n(nullable Object or undefined)\n\nThe application can define any extra queue item information needed.\n\n### itemId\n\n(number or undefined)\n\nUnique identifier of the item in the queue. The attribute is optional\nbecause for LOAD or INSERT should not be provided (as it will be assigned\nby the receiver when an item is first created/inserted).\n\n### media\n\n(non-null [cast.framework.messages.MediaInformation](/cast/docs/reference/web_receiver/cast.framework.messages.MediaInformation) or undefined)\n\nMetadata (including contentId) of the playlist element.\n\n### orderId\n\n(number or undefined)\n\nUsed to track original order of an item in the queue to undo shuffle.\n\n### preloadTime\n\n(number or undefined)\n\nThis parameter is a hint for the receiver to preload this media item\nbefore it is played. It allows for a smooth transition between items\nplayed from the queue. The time is expressed in seconds, relative to the\nbeginning of this item playback (usually the end of the previous item\nplayback). For example, if the value is 10 seconds, this item will be\npreloaded 10 seconds before the previous item has finished. The receiver\nwill try to honor this value but will not guarantee it, for example if\nthe value is larger than the previous item duration the receiver may just\npreload this item shortly after the previous item has started playing\n(there will never be two items being preloaded in parallel). Also, if an\nitem is inserted in the queue just after the currentItem and the time to\npreload is higher than the time left on the currentItem, the preload will\njust happen as soon as possible. Negative values explicitly disable\npreloading. If the value is 0 or undefined, the media item will start to\npreload as soon as the previous item is fully downloaded after its\nplayback position.\n\n### startTime\n\n(number or undefined)\n\nSeconds since beginning of content. If the content is live content, and\nstartTime is not specified, the stream will start at the live position."]]