botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

[Node.js] How to send video

Open Avartarus-Testicus opened this issue 10 years ago • 3 comments

Hi, how is it possible to send videos, indipendent of the channel (skype, telegram) with nodeJS. For images there is already a common way for implementing, but what about videos!!!:

var msg = new builder.Message(session) .attachments([{ contentType: "image/jpeg", contentUrl: "http://www.theoldrobots.com/images62/Bender-18.JPG" }]); session.send(msg);

I tried to change "contentType" but this didn't worked. I tried also another way via Herocard-->Card Actions, but this wasn't successfull too. Has anybody a clue what to do. Have I to use a rich-card-object or can I achieve it via builder.Message. Whats the best way ?? Thanks

Avartarus-Testicus avatar Aug 16 '16 14:08 Avartarus-Testicus

Hi, The way to send videos is using the contentType: "video/{format}".

Here it is an example of sending video/mp4 video:

var msg = new builder.Message(session).attachments([{
    contentType: "video/mp4",
    name: "Big Buck Bunny 240p 1mb.mp4",
    contentUrl: "http://www.sample-videos.com/video/mp4/240/big_buck_bunny_240p_1mb.mp4"
}]);
session.send(msg);  

The supported formats depend on the channel that you want to deploy your bot. Here it is a link with the Skype video supported formats: https://docs.botframework.com/en-us/skype/getting-started/#messages

reyesrico avatar Aug 16 '16 21:08 reyesrico

Hi, thanks a lot for your fast answer. The fault was on my side...anyway....your example is working fine :+1:

Avartarus-Testicus avatar Aug 17 '16 08:08 Avartarus-Testicus

@reyesrico According to the attachments documentation, an attachment can have contentType, contentUrl and contentType (but not name). In the source code, the interface IAttachment also declares those fields. Why do you use name instead?

palmerabollo avatar Sep 21 '16 14:09 palmerabollo