如何在 google 家庭中心启用音乐操作的下一按钮

How to enable next button of music actions in google home hub

我正在开发音乐动作。我使用 MediaObject 来 return 并播放音频。 当我在 google 家庭中心尝试操作时,屏幕底部有 2 个按钮用于下一个和上一个。虽然有更多的音频,我可以说 'Next' 另一个音频,但两个按钮都被禁用了。我怎样才能启用它? 提前致谢!

app.intent('Default Welcome Intent', async (conv) => {
    console.log(`Welcome: ${conv.user.last.seen}`);
    // Check if the device supports media playback
    if (!conv.surface.capabilities.has('actions.capability.MEDIA_RESPONSE_AUDIO')) {
        conv.close('Sorry, this device does not support audio playback.');
        return;
    }

    let audioData = await fetchData()

    // Initialize the index of first audioData
    console.log('Initialize the index for first time')
    conv.user.storage.track = 1
    conv.user.storage.audioData = audioData

    conv.ask(getRandomPrompt(conv, 'welcome'));
    // conv.ask(getRandomPrompt(conv, 'intro'));
    nextTrack(conv);
});

const nextTrack = (conv) => {
    console.log(`nextTrack: ${conv.user.storage.track}`);
    let audioData = conv.user.storage.audioData
    let track = audioData[0];
    // Persist the selected track in user storage
    if (conv.user.storage.track) {
        conv.user.storage.track = parseInt(conv.user.storage.track, 10);
        conv.user.storage.track++;
        if (conv.user.storage.track > audioData.length) {
            // Loop the tracks
            conv.user.storage.track = 1;
        }
        track = audioData[conv.user.storage.track - 1];
    } else {
        conv.user.storage.track = 1;
    }

    let hasScreen = conv.surface.capabilities.has('actions.capability.SCREEN_OUTPUT')
    console.log(`Current news: ${util.inspect(track)}`)
    if (hasScreen) {
        conv.ask('Has screen')
        // Create a media response
        // https://developers.google.com/actions/assistant/responses#media_responses
        conv.ask(new MediaObject({
            name: track.name,
            url: track.titleLink,
            icon: new Image({
                url: 'https://storage.googleapis.com/automotive-media/album_art.jpg',
                alt: 'Media icon'
            })
        }));
        // Add suggestions to continue the conversation
        if (supportsMore) {
            // Set the context to allow matching agent intents
            conv.contexts.set('more', 5);
            conv.ask(conv.user.storage.track === 1 ? suggestions1 : suggestions2);
        } else {
            conv.ask(suggestions3);
        }
    } else {
        conv.ask('There is no screen')
        // Create a media response
        // https://developers.google.com/actions/assistant/responses#media_responses
        conv.ask(new MediaObject({
            name: track.name,
            url: track.titleLink
        }));
    }
};

按钮始终处于禁用状态,因为 third-party 开发人员无法提供存在另一首或上一首曲目的元数据。开发人员在他们的 Action 中构建媒体响应应该预料到这种行为,因为它是 API.

的当前状态