Skip to content

add thumbnail when upload video #1555

Closed Answered by ernado
mahbubmaruf178 asked this question in Q&A
Discussion options

You must be logged in to vote

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

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by mahbubmaruf178
Comment options

You must be logged in to vote
1 reply
@ernado
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants