irazasyed / telegram-bot-sdk

🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.

Home Page:https://telegram-bot-sdk.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sendMediaGroup can't send video without sound

tahola opened this issue · comments

commented

PHP version

7.1.3

irazasyed/telegram-bot-sdk version

^3.0

Laravel version (if any)

5.8

Code To Reproduce the bug

When I am trying to send a mp4 without sound (like a gif) with sendMediaGroup I get this error :
"Bad Request: failed to send message #1 with the error message "Wrong file i (truncated...)"

And it work fine if the video has sound.

This is the code I am using :

$telegram = new Telegram\Bot\Api(api_key);
        $telegram
			->setAsyncRequest(true)
			->sendMediaGroup(['chat_id' => channel_id, 'media' => json_encode([
                ['type'=>'video' ,'media' => 'https://i.imgur.com/qAxrsIG.mp4', 'caption' => "Album caption"],
                ['type' => 'photo' ,'media' => 'http://www.alcan5000.com/JPG/64Caliente.jpg'],
                ['type' => 'photo' ,'media' => 'http://www.alcan5000.com/JPG/64Caliente.jpg']
            ])]); 

And the same code with a video with sound (and this one work):

$telegram = new Telegram\Bot\Api(api_key);
        $telegram
			->setAsyncRequest(true)
			->sendMediaGroup(['chat_id' => channel_id, 'media' => json_encode([
                ['type'=>'video' ,'media' => 'https://figtreefoundation.org/wp-content/uploads/2021/01/Video-Placeholder.mp4, 'caption' => "Album caption"],
                ['type' => 'photo' ,'media' => 'http://www.alcan5000.com/JPG/64Caliente.jpg'],
                ['type' => 'photo' ,'media' => 'http://www.alcan5000.com/JPG/64Caliente.jpg']
            ])]); 

I guess the telegram api see it as animation or something but is there a trick to bypass that ?

Error stacktrace (if any)

No response

Not sure if this is resolved but I believe short videos with no sounds are generally converted into a GIF, anything big should work and sent as video. I haven't tested this theory tho.

Hope it's resolved already.