Telegram.Bot icon indicating copy to clipboard operation
Telegram.Bot copied to clipboard

How to set thumbnail when using sendvideo method

Open Mohammad-Saheb opened this issue 11 years ago • 30 comments

Hi How can I set thumbnail when using sendvideo method ? 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, 0, new ReplyKeyboardMarkup { Keyboard = _nextVideoCommands, OneTimeKeyboard = true, ResizeKeyboard = true });

http://oi60.tinypic.com/33ml5pj.jpg

Also response.video.thumb is null !!?

Thanks .

Mohammad-Saheb avatar Oct 23 '15 10:10 Mohammad-Saheb

Sorry for the delayed answer but i think there is no way to specify the thumbnail manually:

https://core.telegram.org/bots/api#sendvideo

or am i missing something?

MrRoundRobin avatar Nov 17 '15 16:11 MrRoundRobin

I think so but some bots can do it. https://telegram.me/justvideobot

Thanks

Mohammad-Saheb avatar Nov 19 '15 08:11 Mohammad-Saheb

Hello Sorry to ask, Did you find any way for video thumbnail in SendVideo method ?

msrahmanian avatar Dec 24 '15 02:12 msrahmanian

hi Someone has found an answer to this problem?

abadakhshan avatar Jan 17 '16 06:01 abadakhshan

hi mohammad. i think you are sending video in wrong type. if you send video mpeg(you can see right types in telegram bot documentation) telegram will recognize sending data as video and it will show thumbnail in telegram app. :-)

ahmadi173 avatar Jan 17 '16 07:01 ahmadi173

Hi I contacted Telegram and their response

Hi, currently api doesn't support sending thumbnails with videos. Telegram

evolves quickly and new features are added every month but we can't promise anything or give an exact timeframe.

Thanks.

On Sun, Jan 17, 2016 at 10:56 AM, mohammad ahmady [email protected] wrote:

hi mohammad. i think you are sending video in wrong type. if you send video mpeg(you can see right types in telegram bot documentation) telegram will recognize sending data as video and it will show thumbnail in telegram app. :-)

— Reply to this email directly or view it on GitHub https://github.com/MrRoundRobin/telegram.bot/issues/50#issuecomment-172298268 .

Mohammad-Saheb avatar Jan 17 '16 07:01 Mohammad-Saheb

i think they didn't get you. because i did this long time ago.

ahmadi173 avatar Jan 17 '16 07:01 ahmadi173

Maybe but I think my question was clear enough as well as response. Please if possible share your experience. Sample video file for test sendVideo.mp4 http://fs2.filegir.com/test/178.252.189.93/sendVideo.mp4

On Sun, Jan 17, 2016 at 11:24 AM, mohammad ahmady [email protected] wrote:

i think they didn't get you. because i did this long time ago.

— Reply to this email directly or view it on GitHub https://github.com/MrRoundRobin/telegram.bot/issues/50#issuecomment-172299018 .

Mohammad-Saheb avatar Jan 17 '16 08:01 Mohammad-Saheb

Hi The latest version of the API now supports video thumbnail automatically. Thanks

Mohammad-Saheb avatar Apr 17 '16 09:04 Mohammad-Saheb

Hi I'm wondering do you test videos with sizes near to limit (50MB), because I upload a lot of videos and just those with size less than 10MB(almost) has thumbnail. and others with higher sizes no thumbnail. My videos are mainly mp4 format. what about you?

masoudkazemi avatar Apr 19 '16 12:04 masoudkazemi

I'm wondering do you test videos with sizes near to limit (50MB), because I upload a lot of videos and just those with size less than 10MB(almost) has thumbnail. and others with higher sizes no thumbnail. My videos are mainly mp4 format.

I have exactly same problem.

ehsanecc avatar Dec 25 '16 19:12 ehsanecc

i want also send video on telegram bot but how can do that i have no idea. any one please tell me how can do that. here i have try like this=>

` WebClient webClient = new WebClient();

imageData = webClient.DownloadData(MediaPath + ds.Tables[0].Rows[i]["Url"].ToString()); MemoryStream ms = new MemoryStream(imageData);`

Bot.SendVideoAsync("@abc2017", new FileToSend(ds.Tables[0].Rows[i]["Url"].ToString(), ms), 15, sb.ToString(), replyMarkup: ReplyMarkup);

but here i have no idea how can add size of the video. here i have add size approximately for that video. please tell me how can do that.

Coderwill avatar Sep 08 '17 08:09 Coderwill

also any limit of the size of video send on telegram bot please let me know i need that.

Coderwill avatar Sep 08 '17 09:09 Coderwill

@Coderwill Please read tg docs. This is for questions about only the .NET Client of it https://core.telegram.org/bots/api#sending-files

poulad avatar Sep 08 '17 14:09 poulad

@pouladpld i also visit this link and also visit api doc for the telegram bot and using this link i have make this code but i can't getting success for the send video on telegram bot. and i can't find any example for that. just i look code on this link so can you please give me some hint where is my mistake in my code.

Coderwill avatar Sep 09 '17 05:09 Coderwill

@Mohammad-Saheb can you please give me some hint and help me if possible then

Coderwill avatar Sep 09 '17 05:09 Coderwill

@pouladpld thanks for your replay and give me same example.

Coderwill avatar Sep 09 '17 07:09 Coderwill

@pouladpld can you please give me some hint on this upload muliple videos on same time on telegram bot using c#. i have go 10+ videos send on the bot at a same time in the for loop so that time 2 or 3 videos send successfully and after utility automatically stop. do you know why this type accure with this code. i have not getting any error but my all the videos is not go there just some videos go there.

` public async Task SendCasesOnTelegramBot() {
DataSet ds = DataAccess.ExecuteDataset(Setting.ConnectionString(), "GetPostForTelegramBot"); if (ds != null && ds.Tables.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string VideoUrl = null; VideoUrl = CaseMediaPath + ds.Tables[0].Rows[i]["Url"].ToString();
var sb = new StringBuilder(); sb.Append("abc");

        await Bot.SendVideoAsync("@abc", video: VideoUrl, caption: sb.ToString(), replyMarkup: ReplyMarkup); 

           await Task.Delay(18000);          
    }
}

}`

this my code please see and help me i am facing issue on this task.

Coderwill avatar Sep 11 '17 06:09 Coderwill

@Coderwill code looks OK. Probably tg limits the traffic. Try asking that from @BotSupport on tg.

poulad avatar Sep 16 '17 00:09 poulad