admin管理员组

文章数量:1401167

I can't find how can I send a video message(round), not like a simple video

var inputFile = await Client.UploadFileAsync(filePath);

await Client.SendMediaAsync(peer, "Here's a round video:", inputFile);

I can't find how can I send a video message(round), not like a simple video

var inputFile = await Client.UploadFileAsync(filePath);

await Client.SendMediaAsync(peer, "Here's a round video:", inputFile);
Share Improve this question asked Mar 23 at 23:08 Rafael ChasmanRafael Chasman 32 bronze badges 1
  • What format is the video in? Does the recipient have support for the video format? Can you show details of the video in question? – Charles Henington Commented Mar 23 at 23:35
Add a comment  | 

1 Answer 1

Reset to default 0

Your MPEG4 source video must have square dimensions, up to 1 minute long.
Then you can use the following code (adjusted for correct duration/width/height)

var inputFile = await Client.UploadFileAsync("video.mp4");
var media = new InputMediaUploadedDocument
{
    file = inputFile,
    mime_type = "video/mp4",
    attributes =
    [
        new DocumentAttributeVideo
        {
            flags = DocumentAttributeVideo.Flags.round_message,
            duration = 56, // fill duration here 
            w = 454, // fill width / height
            h = 454
        }
    ]
};
var msg = await Client.SendMessageAsync(peer, null, media);

本文标签: telegramHow to send a video messageStack Overflow