我正在研究机器人框架技术,在我的一个项目中,我实现了一个概念,比如显示音频文件和视频文件,为此我必须在我的 MessagesController 中编写下面的代码行。
ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl));
Activity replyToConversation = activity.CreateReply("Welcome to **Marriott Hotels**." + "(Hi)");
replyToConversation.Recipient = activity.From;
replyToConversation.Type = "message";
//replyToConversation.AttachmentLayout = AttachmentLayouts.Carousel;
replyToConversation.Attachments = new List<Attachment>();
if (activity != null && activity.GetActivityType() == "message" && activity.Text.ToLower() == "video")
{
replyToConversation.Attachments.Add(new Attachment()
{
ContentUrl = "https://1drv.ms/v/s!At-JUB9_wu9Ct3LEMJtNj_ZP26r6",
ContentType = "video/mp4",
Name = "xxxxx hotel video"
});
var reply = await connector.Conversations.SendToConversationAsync(replyToConversation);
}
else if (activity != null && activity.GetActivityType() == "message" && activity.Text.ToLower() == "file")
{
replyToConversation.Attachments.Add(new Attachment()
{
ContentUrl = "https://codeload.github.com/jeffhollan/BotFrameworkSample/zip/master",
ContentType = "application/zip",
Name = "Download ZIP File"
});
var reply = await connector.Conversations.SendToConversationAsync(replyToConversation);
}
else if (activity != null && activity.GetActivityType() == "message" && activity.Text.ToLower() == "audio")
{
replyToConversation.Attachments.Add(new Attachment()
{
//ContentUrl = "http://gaana.com/song/ulagam-oruvanukka",
ContentUrl = "http://www.zzz.com/eatfood.wav",
ContentType = "audio/wav",
Name = "Play Audio" + "(Music)"
});
var reply = await connector.Conversations.SendToConversationAsync(replyToConversation);
}
添加代码并将我的应用程序发布到 azure 并添加 Skype 频道后,现在我开始与我的机器人聊天,然后显示视频提示,但是当我单击它没有播放它时,显示错误如下图所示。