示例#1
0
        public Attachment VideoAttachment()
        {
            var videoCard = new VideoCard
            {
                Title    = mediaCardPropertiesObj.CardTitle,
                Subtitle = mediaCardPropertiesObj.CardSubtitle,

                Text  = mediaCardPropertiesObj.CardText,
                Image = new ThumbnailUrl
                {
                    Url = mediaCardPropertiesObj.ImageURL,
                },
                Media = new List <MediaUrl>
                {
                    new MediaUrl()
                    {
                        Url = mediaCardPropertiesObj.MediaURL,
                    },
                },
                Buttons = new List <CardAction>
                {
                    new CardAction()
                    {
                        Title = mediaCardPropertiesObj.ButtonTitle,
                        Type  = ActionTypes.OpenUrl,
                        Value = mediaCardPropertiesObj.ButtonTitle,
                    },
                },
            };

            return(videoCard.ToAttachment());
        }
示例#2
0
        private static Attachment GetVideoCard()
        {
            var videoCard = new VideoCard
            {
                Title    = "Заголовок Video Card",
                Subtitle = "Может воспроизводить видео",
                Text     = "Текст для Video Card",
                Image    = new ThumbnailUrl
                {
                    Url = "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Big_buck_bunny_poster_big.jpg/220px-Big_buck_bunny_poster_big.jpg"
                },
                Media = new List <MediaUrl>
                {
                    new MediaUrl()
                    {
                        Url = "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4"
                    }
                },
                Buttons = new List <CardAction>
                {
                    new CardAction()
                    {
                        Title = "Открыть ссылку",
                        Type  = ActionTypes.OpenUrl,
                        Value = "https://peach.blender.org/"
                    }
                }
            };

            return(videoCard.ToAttachment());
        }
        public async Task SendActivityAsync(ITurnContext context, CancellationToken cancellationToken, string message)
        {
            Activity reply = context.Activity.CreateReply();

            try
            {
                VideoCardEntity videoCardEntity = JsonConvert.DeserializeObject <VideoCardEntity>(message);

                List <MediaUrl> mediaList = new List <MediaUrl>();
                foreach (string s in videoCardEntity.Media)
                {
                    mediaList.Add(new MediaUrl(s));
                }

                VideoCard videoCard = new VideoCard
                {
                    Title     = videoCardEntity.Title,
                    Text      = videoCardEntity.Text,
                    Autostart = false,
                    Media     = mediaList
                };
                reply.Attachments.Add(videoCard.ToAttachment());
                await context.SendActivityAsync(reply);
            }
            catch
            {
                await context.SendActivityAsync("There was an error parsing the message", cancellationToken : cancellationToken);
            }
        }
示例#4
0
        private static Attachment GetVideoCard()
        {
            var videoCard = new VideoCard
            {
                Title    = StringResources.Video_Card_Title,
                Subtitle = StringResources.Video_Card_Sub,
                Text     = StringResources.Video_Card_Text,
                Image    = new ThumbnailUrl
                {
                    Url = "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Big_buck_bunny_poster_big.jpg/220px-Big_buck_bunny_poster_big.jpg"
                },
                Media = new List <MediaUrl>
                {
                    new MediaUrl()
                    {
                        Url = "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4"
                    }
                },
                Buttons = new List <CardAction>
                {
                    new CardAction()
                    {
                        Title = StringResources.Open_Link,
                        Type  = ActionTypes.OpenUrl,
                        Value = "https://peach.blender.org/"
                    }
                }
            };

            return(videoCard.ToAttachment());
        }
        private static Attachment GetVideoCard()
        {
            var videoCard = new VideoCard
            {
                Title    = "Big Buck Bunny",
                Subtitle = "by the Blender Institute",
                Text     = "Big Buck Bunny (code-named Peach) is a short computer-animated comedy film by the Blender Institute, part of the Blender Foundation. Like the foundation's previous film Elephants Dream, the film was made using Blender, a free software application for animation made by the same foundation. It was released as an open-source film under Creative Commons License Attribution 3.0.",
                Image    = new ThumbnailUrl
                {
                    Url = "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Big_buck_bunny_poster_big.jpg/220px-Big_buck_bunny_poster_big.jpg"
                },
                Media = new List <MediaUrl>
                {
                    new MediaUrl()
                    {
                        Url = "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4"
                    }
                },
                Buttons = new List <CardAction>
                {
                    new CardAction()
                    {
                        Title = "Learn More",
                        Type  = ActionTypes.OpenUrl,
                        Value = "https://peach.blender.org/"
                    }
                }
            };

            return(videoCard.ToAttachment());
        }
示例#6
0
        private Attachment GetVideoCard()
        {
            var video = new VideoCard
            {
                Title     = "Um filme",
                Subtitle  = "Mais um filme fofo",
                Image     = new ThumbnailUrl("https://www.imortaisdofutebol.com/wp-content/uploads/2012/12/pele-1.jpg"),
                Autostart = true,
                Autoloop  = true,
                Media     = new List <MediaUrl>
                {
                    new MediaUrl("http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4")
                },
                Buttons = new List <CardAction>
                {
                    new CardAction
                    {
                        Title = "Ver em full screen",
                        Value = "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4"
                    }
                }
            };

            return(video.ToAttachment());
        }
        /// <summary>
        /// create video type card
        /// </summary>
        /// <param name="response"></param>
        /// <returns></returns>
        private Attachment GetVideoCard(Response response)
        {
            try
            {
                var video = response.Video;

                var videoCard = new VideoCard();

                if (!string.IsNullOrEmpty(video.Title))
                {
                    videoCard.Title = video.Title;
                }

                videoCard.Media = new List <MediaUrl>
                {
                    new MediaUrl()
                    {
                        Url = video.Url
                    }
                };

                return(videoCard.ToAttachment());
            }
            catch (Exception ex) { return(null); }
        }
示例#8
0
        public static Attachment GetHawaMahal()
        {
            var video = new VideoCard
            {
                Title    = "Hawa Mahal",
                Subtitle = $"Pink/red sandstone 'Palace of the Winds'     \r\r  ratings (4.4)",
                Text     = "Hawa Mahal is a palace in Jaipur, India. It is constructed of red and pink sandstone. The palace sits on the edge of the City Palace, Jaipur, and extends to the zenana, or women's chambers",
                Image    = new ThumbnailUrl
                {
                    Url = "https://lh4.googleusercontent.com/-GPqPsuQWNH8/V5hpba-Ig_I/AAAAAAAAU8s/gWbpJwLHVOYlFhSXcintcjX5AbWLr_ITACLIBGAYYCw/w100-h134-n-k-no/"
                },
                Media = new List <MediaUrl>
                {
                    new MediaUrl()
                    {
                        Url = "https://www.youtube.com/watch?v=nKlhbd79g_c"
                    }
                },
                Buttons = new List <CardAction>
                {
                    new CardAction()
                    {
                        Title = "More Info",
                        Type  = ActionTypes.OpenUrl,
                        Value = "https://en.wikipedia.org/wiki/Hawa_Mahal"
                    }
                }
            };

            return(video.ToAttachment());
        }
示例#9
0
        private static Attachment GetVideoCard()
        {
            var videoCard = new VideoCard
            {
                Title = "Mixer Basics Video",
                //Subtitle = "by the Blender Institute",
                Text  = "In this video Doug Jorgesen explains the motivations, basic operations, and some applications of IQ, image reject, and single sideband mixers.",
                Image = new ThumbnailUrl
                {
                    Url = ""
                },
                Media = new List <MediaUrl>
                {
                    new MediaUrl()
                    {
                        Url = "https://www.youtube.com/embed/_DQ24Sj0ArA?rel=0"
                    }
                }
                //,
                //Buttons = new List<CardAction>
                //{
                //    new CardAction()
                //    {
                //        Title = "Learn More",
                //        Type = ActionTypes.OpenUrl,
                //        Value = "https://peach.blender.org/"
                //    }
                //}
            };

            return(videoCard.ToAttachment());
        }
示例#10
0
        private static Microsoft.Bot.Connector.Attachment GetVideoCard(string title, string subtitle, string text, string image, string trailer_url)
        {
            var card = new VideoCard()
            {
                Title    = title,
                Subtitle = subtitle,
                Text     = text,
                Media    = new List <MediaUrl>()
                {
                    new MediaUrl(trailer_url)
                },
                Autostart = false,
                Shareable = true,
                Autoloop  = false,
                Image     = new ThumbnailUrl(image),
                Buttons   = new List <CardAction>()
                {
                    new CardAction(ActionTypes.PlayVideo, "Ver trailer", trailer_url, trailer_url),
                    new CardAction(ActionTypes.OpenUrl, "Ver horarios", string.Empty, "https://moviesrecombot.azurewebsites.net"),
                    new CardAction(ActionTypes.OpenUrl, "Comprar boletos", string.Empty, "https://moviesrecombot.azurewebsites.net")
                }
            };

            return(card.ToAttachment());
        }
示例#11
0
        public static Attachment GetVideoCard(string title, string subtitle, string text, MediaUrl cardImage)
        {
            var heroCard = new VideoCard
            {
                Title    = title,
                Subtitle = subtitle,
                Text     = text,
                Media    = new List <MediaUrl>()
            };

            return(heroCard.ToAttachment());
        }
        private Attachment CreateVideoCard()
        {
            var videoCard = new VideoCard();

            videoCard.Title     = "Um video";
            videoCard.Subtitle  = "Dois video - subtitulo";
            videoCard.Autostart = true;
            videoCard.Autoloop  = false;
            videoCard.Media     = new List <MediaUrl>
            {
                new MediaUrl("http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4")
            };
            return(videoCard.ToAttachment());
        }
示例#13
0
        private Attachment CreateVideoCard()
        {
            var videocard = new VideoCard();

            videocard.Title     = "A importancia do Dipirona";
            videocard.Subtitle  = "(:";
            videocard.Autoloop  = false;
            videocard.Autostart = true;
            videocard.Media     = new List <MediaUrl>
            {
                new MediaUrl("https://www.youtube.com/watch?v=JCAdbKa3t1w")
            };
            return(videocard.ToAttachment());
        }
示例#14
0
        private Attachment CreateVideoCard()
        {
            var videoCard = new VideoCard();

            videoCard.Title     = "Um video Qualquer";
            videoCard.Subtitle  = "Outro titulo";
            videoCard.Autostart = true;
            videoCard.Autoloop  = false;
            videoCard.Media     = new List <MediaUrl> {
                new MediaUrl("http://techslides.com/demos/sample-videos/small.mp4")
            };

            return(videoCard.ToAttachment());
        }
示例#15
0
        private Attachment CreateVideoCard()
        {
            var videoCard = new VideoCard();

            videoCard.Title     = "Vídeo qualquer";
            videoCard.Subtitle  = "Subtitulo";
            videoCard.Autostart = true;
            videoCard.Autoloop  = false;
            videoCard.Media     = new List <MediaUrl>
            {
                new MediaUrl("https://youtu.be/Fy6tIMRyuhg?list=RDFy6tIMRyuhg")
            };
            return(videoCard.ToAttachment());
        }
示例#16
0
 private async Task ShowKBResponse(List <ApiClient.Model.WebhookMessage> results, ITurnContext context, CancellationToken cancellationToken)
 {
     //TODO: Standadize rasa messaging format
     //var results = await _messagingApi.SendMessageAsync(context.Activity.Conversation.Id, context.Activity.Text);
     foreach (var r in results)
     {
         if (!string.IsNullOrEmpty(r.Text))
         {
             await context.SendActivityAsync(r.Text, cancellationToken : cancellationToken);
         }
         if (r.Custom != null)
         {
             foreach (var c in r.Custom)
             {
                 if (c.Videos != null)
                 {
                     IMessageActivity activity = context.Activity.CreateReply();
                     var attachments           = new List <Attachment>();
                     if (c.Videos.Count > 1)
                     {
                         foreach (var item in c.Videos)
                         {
                             var vCard = new VideoCard(item.Title, media: new List <MediaUrl>()
                             {
                                 new MediaUrl {
                                     Url = item.Url
                                 }
                             });
                             attachments.Add(vCard.ToAttachment());
                         }
                         activity = MessageFactory.Carousel(attachments);
                     }
                     else if (c.Videos.Count == 1)
                     {
                         var vCard = new VideoCard(c.Videos.First().Title, media: new List <MediaUrl>()
                         {
                             new MediaUrl {
                                 Url = c.Videos.First().Url
                             }
                         });
                         attachments.Add(vCard.ToAttachment());
                         activity.Attachments = attachments;
                     }
                     await context.SendActivityAsync(activity, cancellationToken : cancellationToken);
                 }
             }
         }
     }
 }
        private Attachment CreateVideoCard()
        {
            var videoCard = new VideoCard();

            videoCard.Title     = "Algum video ai man";
            videoCard.Subtitle  = "Subtitulo do video";
            videoCard.Autostart = true;
            videoCard.Autoloop  = false;
            videoCard.Media     = new List <MediaUrl>
            {
                new MediaUrl("https://www.youtube.com/watch?v=sNPBN3zlIwo")
            };

            return(videoCard.ToAttachment());
        }
示例#18
0
        private Attachment CreateVideoCard()
        {
            var videocard = new VideoCard();

            videocard.Title     = "R2D2";
            videocard.Subtitle  = "R2D2 always save the world";
            videocard.Autostart = true;
            videocard.Autoloop  = false;
            videocard.Media     = new List <MediaUrl>
            {
                new MediaUrl("https://www.youtube.com/watch?v=JLmOteqmDYc")
            };

            return(videocard.ToAttachment());
        }
示例#19
0
        private Attachment CreateVideoCard()
        {
            var videoCard = new VideoCard();

            videoCard.Title     = "Video do bolo";
            videoCard.Subtitle  = "Aqui vai um subtitulo";
            videoCard.Autoloop  = false;
            videoCard.Autostart = true;

            videoCard.Media = new List <MediaUrl>
            {
                new MediaUrl("https://www.youtube.com/watch?v=ieukcNWempc")
            };

            return(videoCard.ToAttachment());
        }
        private Attachment GetVideoCard()
        {
            var videoCard = new VideoCard()
            {
                Title = "Splatoon 2 Soundtrack",
                Media = new List <MediaUrl>()
                {
                    new MediaUrl("https://youtu.be/rZaT-PpDAl8")
                },
                Subtitle  = "Videmo Demo, by Puck",
                Autoloop  = true,
                Autostart = true,
            };

            return(videoCard.ToAttachment());
        }
示例#21
0
        private Attachment GetVideoCard()
        {
            var videoCard = new VideoCard
            {
                Title    = "Video",
                Subtitle = "Video Development",
                Media    = new List <MediaUrl>
                {
                    new MediaUrl()
                    {
                        Url = "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4"
                    }
                }
            };

            return(videoCard.ToAttachment());
        }
示例#22
0
 async Task HandleVideoAsync(IDialogContext context)
 {
     string contentUrl = GetBinaryUrl("cortana.mp4");
     var videoCard = new VideoCard(
         "Chatbot Video",
         "Calling With the Cortana Channel",
         "This demonstrates how to speak with a chatbot via Cortana.",
         media: new List<MediaUrl> { new MediaUrl(contentUrl) });
     Activity activity = context.Activity as Activity;
     Activity reply = activity.CreateReply();
     reply.Attachments.Add(videoCard.ToAttachment());
     await
         new ConnectorClient(new Uri(reply.ServiceUrl))
             .Conversations
             .SendToConversationAsync(reply);
     context.Wait(MessageReceivedAsync);
 }
示例#23
0
        public async Task <bool> ExcuteAsync()
        {
            Activity replyToConversation = (Activity)Context.MakeMessage();

            replyToConversation.Recipient = replyToConversation.Recipient;
            replyToConversation.Type      = "message";

            //replyToConversation.Text = WebUtility.HtmlDecode(Message);
            replyToConversation.TextFormat = TextFormatTypes.Markdown;

            Attachment cardAttachment = null;

            VideoCard videoCard = new VideoCard()
            {
                //Title = "Breaking Bad",
                //Subtitle = "Breaking Bad is an American crime drama television series created and produced by Vince Gilligan.",
                //Image = new ThumbnailUrl()
                //{
                //    Url = "https://upload.wikimedia.org/wikipedia/en/thumb/6/61/Breaking_Bad_title_card.png/250px-Breaking_Bad_title_card.png"
                //},
                Media = new List <MediaUrl>()
                {
                    new MediaUrl()
                    {
                        Url = $"{Message}"
                    }
                },
                Buttons = new List <CardAction>()
                {
                    new CardAction()
                    {
                        Title = "Watch All Episodes",
                        Type  = ActionTypes.OpenUrl,
                        Value = $"{Message}"
                    }
                }
            };

            cardAttachment = videoCard.ToAttachment();
            replyToConversation.Attachments.Add(cardAttachment);

            await Context.PostAsync(replyToConversation);

            return(false);
        }
        private static Attachment GetVideoCard()
        {
            var videoCard = new VideoCard
            {
                Title    = "Watch An Automation Script In Action",
                Subtitle = "Process Automation Demo",
                Media    = new List <MediaUrl>()
                {
                    new MediaUrl()
                    {
                        // Url = "https://youtu.be/a02i_Ik4GGM"
                        Url = "https://blobstoragechatbot.blob.core.windows.net/autobotmedia/sample.mp4"
                    }
                },
            };

            return(videoCard.ToAttachment());
        }
示例#25
0
        public async Task None(IDialogContext context, LuisResult result)
        {
            var message = context.MakeMessage();

            var videoCard = new VideoCard();

            videoCard.Title     = "Desculpe, não entendi.";
            videoCard.Subtitle  = "";
            videoCard.Autostart = true;
            videoCard.Autoloop  = false;
            videoCard.Media     = new List <MediaUrl>
            {
                new MediaUrl("https://www.youtube.com/watch?v=gBGOldt3zqM")
            };
            message.Attachments.Add(videoCard.ToAttachment());


            await context.PostAsync(message);
        }
示例#26
0
        private async Task SelectedCategory(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var activityValue = (Activity)context.Activity;
            var response      = JsonConvert.DeserializeObject <AnswerHandler>(activityValue.Value.ToString());

            var reply = context.MakeMessage();

            await GetMainOptions(reply);

            switch (response.id)
            {
            case "acerca":
                var       videoMsg = context.MakeMessage();
                VideoCard myCard   = await VideoCardCreation("Acerca de nosotros", "Si una imagen vale más que mil palabras, imagina lo que un video puede explicar de nosotros. ¡Te invitamos a conocernos!");

                videoMsg.Attachments.Add(myCard.ToAttachment());
                await context.PostAsync(videoMsg);

                break;

            case "correo":
                var receivedQuestion = String.Format("Hola administrador, el usuario {0} ha pedido un proceso de seguimiento personalizado", ConfigurationManager.AppSettings["UserName"].ToString());
                var postBody         = $"{{\"message\": \"{receivedQuestion}\"}}";
                var logicAppUrl      = "https://prod-14.southcentralus.logic.azure.com:443/workflows/78720171b08842efb0e7c0c76a9b84a1/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=d5-qPi-wkrxP3TiqBo5E115vJCdO28oLUe7mWmRbZRM";

                using (WebClient client = new WebClient())
                {
                    client.Encoding = System.Text.Encoding.UTF8;
                    client.Headers.Add("Content-Type", "application/json");
                    client.UploadString(logicAppUrl, postBody);
                }

                await context.PostAsync("Muchas gracias por seleccionar esta opción, ahora te contactaremos por correo electrónico.");

                break;

            default:
                context.PostAsync("Lo siento no sé que hacer con esta respuesta");
                break;
            }

            await context.PostAsync(reply);
        }
示例#27
0
        /// <summary>
        /// 미용실 소개 동영상 메시지 처리
        /// </summary>
        /// <param name="context"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        private async Task WelcomeVideoMessageAsync(IDialogContext context, IAwaitable <object> beforeActivity)
        {
            var reply = context.MakeMessage();

            var videoCard = new VideoCard
            {
                Title    = "비긴메이트 헤어살롱",
                Subtitle = "스타트업 종사분들만 모시는 스타트업 O2O 헤어살롱입니다.\n\n  커피공짜,사무실 공짜, 언제든 머리고 복잡할때 찾아주세요.\n\n 시원하게 밀어드립니다.",
                Text     = "",
                Image    = new ThumbnailUrl
                {
                    Url = "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Big_buck_bunny_poster_big.jpg/220px-Big_buck_bunny_poster_big.jpg"
                },
                Media = new List <MediaUrl>
                {
                    new MediaUrl()
                    {
                        Url = "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4"
                    }
                },
                Buttons = new List <CardAction>
                {
                    new CardAction()
                    {
                        Title = "자세히 보기",
                        Type  = ActionTypes.OpenUrl,
                        Value = "http://www.beginmate.com"
                    },
                    new CardAction()
                    {
                        Title = "이전으로",
                        Type  = ActionTypes.ImBack,
                        Value = "이전으로"
                    }
                }
            };

            reply.Attachments.Add(videoCard.ToAttachment());
            await context.PostAsync(reply);

            context.Wait(this.OnWelcomMsgSelected);
        }
示例#28
0
        private void GenerateVideoCard(ITurnContext context, string[] responseArray)
        {
            Activity  reply  = context.Activity.CreateReply();
            VideoCard myCard = new VideoCard
            {
                Title     = responseArray[1],
                Text      = responseArray[2],
                Autostart = true,
                Media     = new List <MediaUrl>
                {
                    new MediaUrl()
                    {
                        Url = responseArray[3].Trim()
                    }
                }
            };

            reply.Attachments.Add(myCard.ToAttachment());
            context.SendActivityAsync(reply);
        }
示例#29
0
        //6
        private static Attachment GetVideoCard()
        {
            var heroCard = new VideoCard()
            {
                Title    = "VideoCard",
                Subtitle = "Может воспроизводить видео",
                Text     = "Текст видео",
                Image    = new ThumbnailUrl
                {
                    Url = "https://scontent-lga3-1.cdninstagram.com/vp/831d2e6d09e74ca73d9f12ce5cbfe8a1/5BE9E8D1/t51.2885-15/e35/p320x320/26868302_155746251873719_748056957910253568_n.jpg?ig_cache_key=MTY5ODc2NjU4NjgwODEyODUwMQ%3D%3D.2"
                },
                Media = new List <MediaUrl> {
                    new MediaUrl()
                    {
                        Url = "https://youtu.be/31j4DIpgY9U"
                    }
                }
            };

            return(heroCard.ToAttachment());
        }
        private static Attachment GetVideoCard(string answer)
        {
            string[] qnaAnswerData = answer.Split(';');
            string   title         = qnaAnswerData[0];
            string   subtitle      = qnaAnswerData[1];
            string   description   = qnaAnswerData[2];
            string   thumbimageurl = qnaAnswerData[3];
            string   mediaUrl      = qnaAnswerData[4];
            string   url           = qnaAnswerData[5];

            VideoCard card = new VideoCard
            {
                Title    = title,
                Subtitle = subtitle,
                Text     = description,
            };

            card.Image = new ThumbnailUrl
            {
                Url = thumbimageurl
            };
            card.Media = new List <MediaUrl>
            {
                new MediaUrl()
                {
                    Url = mediaUrl
                }
            };

            card.Buttons = new List <CardAction>
            {
                new CardAction()
                {
                    Title = "Learn More",
                    Type  = ActionTypes.OpenUrl,
                    Value = url
                }
            };
            return(card.ToAttachment());
        }