如何使用 node.js 使用 MetaData 定义 Alexa Play 指令

How to define an Alexa Play Directive with MetaData with node.js

我实现了 Alexa Audio Player 技能,可以很好地播放音频,但在 Echo Show 上播放时,歌曲名称没有显示在显示屏上。

我在亚马逊 (https://amzn.to/2xzpH4u) 上看到文档提到了一个播放指令,其中包括背景图像等元数据,但我不确定如何在 node.js.

这是我的播放意图处理程序的代码片段:

if (this.event.request.type === 'IntentRequest' || this.event.request.type === 'LaunchRequest') {
    var cardTitle = streamDynamic.subtitle;
    var cardContent = streamDynamic.cardContent;
    var cardImage = streamDynamic.image;
    this.response.cardRenderer(cardTitle, cardContent, cardImage);
}

this.response.speak('Enjoy.').audioPlayerPlay('REPLACE_ALL', streamDynamic.url, streamDynamic.url, null, 0);
this.emit(':responseReady');

在表示支持视频呈现的 If 语句中,您为在设备上呈现的卡片构建元数据的内容。 因此,按照文档 cardTitle、Content 和 Image 都必须是您正在寻找的设备呈现为卡片的内容。当所有资源都已提供时,您将返回它以在 this.response 语句中呈现。 在来自 Amazon https://github.com/alexa/skill-sample-nodejs-audio-player/blob/mainline/single-stream/lambda/src/audioAssets.js 的示例代码中,请注意卡片资产是如何指定的。按照这个例子,查看整个项目,寻找您可能遗漏的任何其他部分。