【问题标题】:How to include Product video in adaptive card ? - Bot Framework V4, Node.js如何在自适应卡中包含产品视频? - 机器人框架 V4,Node.js
【发布时间】:2019-06-25 05:04:09
【问题描述】:

我在产品视频自适应卡的模拟器中收到错误“无法渲染卡”。

我正在尝试使用 node.js 在 Microsoft bot 框架 V4 的自适应卡中包含产品视频。下面给出的是用于包含自适应卡的 json。

我已经单独保存了json内容,

{

"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.1",
"fallbackText": "This card requires Media to be viewed. Ask your platform to update to Adaptive Cards v1.1 for this and more!",
"body": [
    {
        "type": "Media",
        "poster": "given the image url which resides in Blobs",
        "sources": [
            {
                "mimeType": "video/mp4",
                "url": "given the video url which resides in Blobs"
            }
        ]
    }
],
"actions": [
    {
        "type": "Action.OpenUrl",
        "title": "Learn more",
        "url": "https://adaptivecards.io"
    }
]
}

node.js 代码

const { CardFactory } = require('botbuilder');
const productContentPath = '/path/to/json/content';
await turnContext.sendActivity({
                text: 'Product Video',
                attachments: [CardFactory.adaptiveCard([productContentPath])]
            });

我不知道代码有什么问题,是权限问题还是其他问题。我什至无法在模拟器中进行测试。json 示例的文档来自以下链接。 https://adaptivecards.io/samples/ProductVideo.html

【问题讨论】:

    标签: node.js visual-studio-code botframework


    【解决方案1】:

    WebChat - 模拟器的底层 - 目前不支持 AdaptiveCards v1.1,这就是模拟器无法呈现您的卡片的原因。您可以将卡的版本从 v1.1 更改为 v1.0,或者等待 2 月 14 日的 WebChat 更新以使用 v1.1。

    GitHub 上的这个 issue 提供了有关 WebChat 更新的更多详细信息。

    【讨论】:

    • 我现在会尝试使用V1.0版本的自适应卡。谢谢@tdurnford
    • 那么当我将我的解决方案部署到服务器并使用 v1.1 在网站中检查我的 Microsoft 机器人时它会起作用吗?
    • 网络聊天现在支持 AdaptiveCards v1.1,所以它应该可以正常工作了。
    猜你喜欢
    • 2017-10-18
    • 2019-08-26
    • 2020-03-21
    • 2021-02-08
    • 2021-05-01
    • 2019-12-02
    • 1970-01-01
    • 2017-01-07
    • 2020-03-01
    相关资源
    最近更新 更多