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();
    }
  }
}




Picture showing the output of the Video card in the Microsoft Bot Framework

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();
}




Picture showing the output of the Audio card in the Microsoft Bot Framework

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();
}




Picture showing the output of the Animation card in the Microsoft Bot Framework

Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Friday, October 23, 2020

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250