td icon indicating copy to clipboard operation
td copied to clipboard

downloadFile, offset and limit problem

Open dev4ever888 opened this issue 10 months ago • 1 comments

Hello,

I've been testing the functionality of tdLib on nodejs with tdl for a few days now. But for a few days now I've been having trouble with the downloadFile method. There's something I don't understand about this method.

I do a first download with an offset that starts at 0 and I limit it to 4,000,000, so 4mo. For the second download, I change the offset to 4,000,000 and set the limit to 0 to take the rest of the video. For the first part, no playback problems because I had put the vital playback files at the beginning of the video. In the second video, however, the entire beginning is empty by the length of the first video.

Why does it behave like this when downloaded with offset? Has anyone managed to put two parts back together and make it viewable?

I'm very interested, I've learned a lot in the last few days about ffmpeg and all that revolves around it, but I must admit that I'm stumped ;)

dev4ever888 avatar Mar 02 '25 11:03 dev4ever888

Both downloaded parts are stored within the same file. TDLib provides local.downloadedPrefixSize with the number of available to use bytes from the offset and the method getFileDownloadedPrefixSize to get the number of bytes from an arbitrary position.

levlam avatar Mar 03 '25 12:03 levlam