telegramwtelegramclient

How to send a video message


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);

Solution

  • 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);