question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Best approach for uploading videos?

See original GitHub issue

Hi there,

I’m wondering the best way to upload an mp4 video using gramjs. Right now I can successfully upload a video via:

sendFile(client, entity, { file });

where the entity is a Channel instance and the file is a filepath to the video on my hard drive. However, when the video appears in the channel, it has no thumbnail, and it says the length of the video is 0:00:00.

If I drag and drop the same file through the telegram desktop app, the thumbnail appears and the video length is correct. Are there extra steps or a different approach I need to take when uploading a video using gramjs?

Thank you in advance, and thank you for the great module!

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
painorcommented, Sep 9, 2021

@painor That worked! Thank you so much. Is there a place in the docs where I can send a PR to add the solution to the recipe?

you can add an example to the doc string of sendFile (in this repo) and they will be updated here https://gram.js.org/beta/classes/client_telegramclient.telegramclient.html#sendfile

1reaction
painorcommented, Sep 9, 2021

good luck. it will look something like this

    client.sendFile(entity,{
        file,
        thumb:"path to thumb",
        attributes:[new Api.DocumentAttributeVideo({
            duration:duration,
            h:height,
            w:width,
        })]
    })

Read more comments on GitHub >

github_iconTop Results From Across the Web

7 Best Practices for Uploading Videos to the Web | SproutVideo
7 Best Practices for Uploading Videos to the Web · 1. Capturing the Video · 2. Timeline Settings for Editing the Footage ·...
Read more >
The Video Creating, Transcoding, and Uploading Workflow
This article offers best practices for recording, exporting, uploading and publishing your Video Cloud videos that assures optimum playback ...
Read more >
Best Practices for Client Video Uploading
Best Practices for Client Video Uploading · Be on a Reliable Network · Trim the Videos · Do Not Navigate Away from the...
Read more >
How to upload a video to YouTube: Pre, during, & post checklist
Learn these essential techniques that help your video get found in search rankings and also how to upload videos you Youtube the right...
Read more >
How To Send Large Video Files In 2023 - MASV
Cloud Solutions. Using a cloud solution like MASV, WeTransfer, or Dropbox is by far the most popular method of sending large videos. Cloud ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found