Articles → MICROSOFT BOT FRAMEWORK → Video Card, Audio Card And Animation Card In Bot Framework
Video Card, Audio Card And Animation Card In Bot Framework
Video Card
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Connector;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Bot_Application1.Dialogs { [Serializable]
public class HeroCardDemo: IDialog < object > {
public async Task StartAsync(IDialogContext context) {
context.Wait(MessageReceivedAsync);
}
private async Task MessageReceivedAsync(IDialogContext context, IAwaitable < IMessageActivity > result) {
var message = context.MakeMessage();
var activity = await result;
message.Attachments.Add(GetCard(activity.Text));
await context.PostAsync(message);
}
private Attachment GetCard(string title) {
string imageUrl = "http://gyansangrah.com/ArticleImages/basic_silverlight_example_one.jpg";
var card = new VideoCard() {
Title = "Gyansangrah Videos",
Subtitle = "Range input element in HTML5",
Text = "Subscribe",
Image = new ThumbnailUrl {
Url = imageUrl
},
Media = new List < MediaUrl > {
new MediaUrl("https://www.youtube.com/watch?v=XqqFeRQHG1c")
}
};
return card.ToAttachment();
}
}
}
Click to Enlarge
Audio Card
private Attachment GetCard(string title) {
string imageUrl = "http://gyansangrah.com/ArticleImages/basic_silverlight_example_one.jpg";
var card = new AudioCard() {
Title = "My Audio",
Subtitle = "Sample Audio",
Text = "Subscribe",
Image = new ThumbnailUrl {
Url = imageUrl
},
Media = new List < MediaUrl > {
new MediaUrl("https://www.ee.columbia.edu/~dpwe/sounds/music/africa-toto.wav")
}
};
return card.ToAttachment();
}
Click to Enlarge
Animation Card
private Attachment GetCard(string title) {
string imageUrl = "http://gyansangrah.com/ArticleImages/basic_silverlight_example_one.jpg";
var card = new AnimationCard() {
Title = "My Audio",
Subtitle = "Sample Audio",
Text = "Subscribe",
Image = new ThumbnailUrl {
Url = imageUrl
},
Media = new List < MediaUrl > {
new MediaUrl("http://gyansangrah.com/ArticleImages/marquee_tag_html_two.gif")
}
};
return card.ToAttachment();
}
Click to Enlarge