2

我无法让 CAF 框架处理排队 jpeg 图像。我使用 SDK v3 将 QueueItem 数组发送到接收器。我希望演员框架能够一张一张地向我展示图像,而不仅仅是一张图像。在我的测试中,输入“loadRequestData”有 4 张图像。但是演员表接收器(在电视上)只显示一个图像(以 queueData.startIndex 所指向的为准)。这是用于初始化队列的 javascript 代码:

  /**
    * Initializes the queue.
    * @param {!cast.framework.messages.LoadRequestData}  loadRequestData
    * @return {!cast.framework.messages.QueueData}
    * or non-null Promise containing nullable cast.framework.messages.QueueData
    * THE loadRequestData (input parameter to initialize) ALREADY CONTAINS 4 ITEMS (jpeg images)
    * BUT IT SHOWS **ONLY ONE IMAGE** DEFINED BY queueData.startIndex.
    * IT DOES NOT SHOW OTHER IMAGES AT ALL (PLAYBACK DURATION ETC DO NOT SEEM TO HAVE ANY EFFECT)        
    */
    initialize( loadRequestData) {
        const queueData = new cast.framework.messages.QueueData();
        const items = [];
        for (const requestItem of loadRequestData.queueData.items) {
           const item = new cast.framework.messages.QueueItem();
           item.media = new cast.framework.messages.MediaInformation();
           item.media.contentId = requestItem.media.contentId;
           item.media.contentUrl = requestItem.media.contentUrl;
           item.media.contentType  = requestItem.media.contentType ;
           item.media.metadata   = requestItem.media.metadata;
           item.autoplay = true;
           item.playbackDuration = 2;
           item.preloadTime = 10;
           item.startTime = 0;
           items.push(item);
        }
        queueData.startIndex = 2;
        queueData.items = items;
        queueData.repeatMode = cast.framework.messages.RepeatMode.REPEAT_ALL;

        return queueData;
    }
4

0 回答 0