自适应卡媒体元素未显示视频

时间:2019-05-16 08:32:55

标签: c# botframework chatbot adaptive-cards

我正在制作聊天机器人应用程序,需要在聊天窗口中播放视频,因此我在其中使用了自适应卡和媒体元素。我从https://adaptivecards.io/designer复制了json并制作了卡片,并将其作为messageactivity的附件发送给客户端。以下是我的代码 杰森代码

{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "Media",
            "poster": "https://adaptivecards.io/content/poster-video.png",
            "sources": [
                {
                    "mimeType": "video/mp4",
                    "url": "https://adaptivecardsblob.blob.core.windows.net/assets/AdaptiveCardsOverviewVideo.mp4"
                }
            ]
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "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!"
}

在C#中,我像这样使用它

 string 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': 'https://adaptivecards.io/content/poster-video.png',            'sources': [                {                    'mimeType': 'video/mp4',                    'url': 'https://adaptivecardsblob.blob.core.windows.net/assets/AdaptiveCardsOverviewVideo.mp4'                }            ]        }    ]}";
                    AdaptiveCard adaptiveCards = new AdaptiveCard();
                        adaptiveCards = AdaptiveCard.FromJson(json).Card;

                    IMessageActivity messageActivity = context.MakeMessage();
                    var Attach = new Attachment()
                    {
                        ContentType = AdaptiveCard.ContentType,
                        Content = adaptiveCards

                    };
                    messageActivity.Attachments.Add(Attach);
                    List<CardAction> lstCard = GetSuggestedActions();

                    messageActivity.SuggestedActions = new SuggestedActions()
                    {
                        Actions = lstCard
                    };
                    await context.PostAsync(messageActivity);

但是当我在机器人仿真器上以及在部署后对其进行测试时,它什么也没显示。 我在bot emulatot上注意到的一件事给我错误

** [err-client]未捕获的TypeError:无法读取空C:\ Users \ amit.yadav \ AppData \ Local \ botframework \ app-3.5.29 \ resources \ app \ node_modules \ rxjs \的属性'querySelectorAll' Subscriber.js 227 13 {} ** 输出结果如下所示:

enter image description here

请在错误的地方帮助我。

1 个答案:

答案 0 :(得分:0)