I want to send a video through the API, there are functions to send text, images, audio and documents. Is there a function to send videos or should I use this function to do so?
bot.send_document(chat_id=chat_id, document=open('tests/test.zip', 'rb'))
Is there an easier/more correct way?
1 Answer 1
The same as with documents
bot.send_video(chat_id=update.message.chat_id, video=open('output.mp4', 'rb'), supports_streaming=True)
send_document can sometimes send video as an actual document file, unplayable in TG
send_video will always send video, playable in TG and also, passing supports_streaming=True will make TG allow to stream before downloading.
More references about send_video and other send_* you can look up at
https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/bot.py
To avoid timeout for sending use updater = Updater(token='TOKEN', request_kwargs={'read_timeout': 1000, 'connect_timeout': 1000})
timeout=20to the same method to override the default timeout, or even increase the number more