使用Microsoft Botbuilder将GIF动画和视频发送到Skype端点

时间:2017-03-30 15:54:50

标签: node.js botframework skype

我正在构建一个bot服务来与各个端点进行通信。我在Nodejs中通过Microsoft Botbuilder运行Skype基本通信。我可以很好地向Skype客户端发送文本,但是当我想发送包含图像(GIF动画)或视频的丰富消息时,事情就开始变得混乱。

1)发送动画gif:

function createAnimationCard(session) {
    return new builder.AnimationCard(session)
        .title('Microsoft Bot Framework')
        .subtitle('Animation Card')
        .image(builder.CardImage.create(session, 'https://docs.botframework.com/en-us/images/faq-overview/botframework_overview_july.png'))
        .media([
        { url: 'http://i.giphy.com/Ki55RUbOV5njy.gif' }
    ]);
}

我从另一个函数调用此代码:

exports.sendGif = function sendGif(chatBotUserSession, picUrl, contentType) {
    var card = createAnimationCard(chatBotUserSession);
    var reply = new builder.Message(chatBotUserSession).addAttachment(card);
    _bot.send(reply);
};

当我这样做时,我会看到带有播放按钮的图像(在桌面Skype中,移动客户端根本不显示图像),但是按下该按钮会显示错误“无法打开”。我在url字段中尝试了不同的gif源,但似乎都没有。还尝试了https for source。

2)然后我开始尝试显示视频:

function createVideoCard(session) {
    return new builder.VideoCard(session)
        .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(builder.CardImage.create(session, 'https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Big_buck_bunny_poster_big.jpg/220px-Big_buck_bunny_poster_big.jpg'))
        .media([
            { url: 'http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4' }
         ])
        .buttons([
            builder.CardAction.openUrl(session, 'https://peach.blender.org/',    'Learn More')
    ]);
}

当我用这个来打电话时:

exports.sendMovie = function sendMovie(chatBotUserSession, picUrl, contentType) {
    var card = createVideoCard(chatBotUserSession);
    var reply = new builder.Message(chatBotUserSession).addAttachment(card);
    _bot.send(reply);
};

一切正常......至少在我的桌面Skype上。我的移动Skype(iOS)现在每次打开与我的机器人聊天时都会崩溃...

所以有两个问题: 1)有谁知道为什么我似乎无法发送实际播放的GIF动画? 2)任何人都有移动Skype上的机器人的经验,发送丰富的内容,从而导致应用程序崩溃?

感谢。

0 个答案:

没有答案