add thumbnail when upload video #1555
-
How can i set thumbnail when i upload video ? I've uploaded but thumbnail not auto generated in telegram.. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You should create and upload thumbnail manually. up := uploader.NewUploader(api)
thumb, err := up.Upload(ctx, uploader.NewUpload("thumb.jpg", thumbReadCloser, thumbSIze))
if err != nil {
return errors.Wrap(err, "upload thumbnail")
}
displayDate := rec.CreatedAt.Format("02.01.06 15:04")
caption := []message.StyledTextOption{
styling.Italic(displayDate),
}
uploadedDocument := message.UploadedDocument(inputClass, caption...).
Filename(fileName).
MIME("video/mp4").
Thumb(thumb).
Video().
Duration(durationFromFloatSeconds(rec.Duration)).
Resolution(rec.Width, rec.Height).
SupportsStreaming()
msg := message.NewSender(api).
To(target).
NoWebpage() |
Beta Was this translation helpful? Give feedback.
-
Hello, @ernado I’ve spent the last two days comparing tdl’s upload implementation to the example code above, and I haven’t found any substantive differences—yet the thumbnail still fails to upload correctly. I’ve checked every potential edge case in tdl that might cause this, but the problem persists. I’m not very familiar with C++, but from a quick look at the Telegram Desktop source it appears they first send the file, and then the server generates (and returns) the thumbnail asynchronously. In tdl, however, we try to upload a thumbnail alongside the main file upload, which seems to be where things break. Could you give me some advice or instruction with more detail? Thank you for your time. |
Beta Was this translation helpful? Give feedback.
You should create and upload thumbnail manually.