Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameters $speed and $time will always 0 when we use callback for uploadTo* methods! #1553

Open
mtalaeii opened this issue Sep 15, 2024 · 0 comments

Comments

@mtalaeii
Copy link
Contributor

Description

When we use parameter callback (or cb with messages.sendMedia) with uploadTo* or send* (for media methods only !sendVideo sendAudio and ...)
The parameters $speed and $time will always eqauls to 0 and doesn't changed on upload progress
Its happen about FileCallback class to!!! (and remember it was only affect on upload proccess its ok for downloadTo* methods)

Reproduce

use the code below

$videoUrl  = 'http://t1.dl150m.ir/filmjadid/Talk.to.Me.2022.480p.WEB-DL.PAHE.Farsi.Sub.Film2Media.mkv';
$sent      = $message->sendText('Start');
$this->sendVideo(
    peer   : $message->chatId,
    file   : $message->getReply()->media,
    callback: static function (float $progress,float $speed,float $time) use ($sent): void {
        static $prev = 0;
        $now = time();
        if ($now - $prev < 3 && $progress < 100) {
            return;
        }

        $prev = $now;
        try {
            $sent->editText("[$progress%]\n[$time s]\n[$speed Mb/s]");
        } catch (danog\MadelineProto\RPCErrorException $e) {

        }
    }
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant