简体   繁体   English

使用C#在电报bot上上传视频?

[英]upload video on telegram bot using c#?

I want to upload a video on a telegram bot using c#. 我想使用C#在电报机器人上上传视频。 i have tried the one API for sending videos but i couldn't upload anything using this method. 我已经尝试过一种用于发送视频的API,但是我无法使用此方法上传任何内容。 is there any limits for video uploading in bots ? 在漫游器中上传视频有什么限制吗? please any one tell me where is my mistake.and duration is necessary to pass in the API but how can i get the video duration ? 请有人告诉我我的错误在哪里。传递API的时间是必需的,但是我如何得到视频的时间? i have first downloaded the video from url using web client and then i convert it in to stream and send on bot. 我首先使用网络客户端从url下载了视频,然后将其转换为流并在bot上发送。

here is my code => 这是我的代码=>

byte[] videoDate;
using (var wc = new WebClient())
videoDate = wc.DownloadData(videoUrl);

var response = await
_api.SendVideo(update.Message.Chat.Id,new FileToSend(videoUrl, new MemoryStream(videoDate)), 15, myBotAdMsg);

here i have pass 15 duration fi right now but here my video duration is 00:10 second so how can also fix it. 在这里,我现在已经通过了15个持续时间,但是在这里,我的视频持续时间是00:10秒,因此如何进行修复。

您可以尝试这样=>

Bot.SendVideoAsync(update.Message.Chat.Id, video: VideoUrl, caption: myBotAdMsg);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM