mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-10 19:46:36 +03:00
Fix MediaEmptyError error when sending some videos (#3951)
This commit is contained in:
parent
f819593cbf
commit
ef4f9a962c
|
@ -458,7 +458,7 @@ class UploadMethods:
|
||||||
))
|
))
|
||||||
|
|
||||||
fm = utils.get_input_media(
|
fm = utils.get_input_media(
|
||||||
r.document, supports_streaming=supports_streaming)
|
r.document, supports_streaming=supports_streaming)
|
||||||
|
|
||||||
if captions:
|
if captions:
|
||||||
caption, msg_entities = captions.pop()
|
caption, msg_entities = captions.pop()
|
||||||
|
@ -753,13 +753,18 @@ class UploadMethods:
|
||||||
thumb = str(thumb.absolute())
|
thumb = str(thumb.absolute())
|
||||||
thumb = await self.upload_file(thumb, file_size=file_size)
|
thumb = await self.upload_file(thumb, file_size=file_size)
|
||||||
|
|
||||||
|
# setting `nosound_video` to `True` doesn't affect videos with sound
|
||||||
|
# instead it prevents sending silent videos as GIFs
|
||||||
|
nosound_video = True if mime_type.split("/")[0] == 'video' else None
|
||||||
|
|
||||||
media = types.InputMediaUploadedDocument(
|
media = types.InputMediaUploadedDocument(
|
||||||
file=file_handle,
|
file=file_handle,
|
||||||
mime_type=mime_type,
|
mime_type=mime_type,
|
||||||
attributes=attributes,
|
attributes=attributes,
|
||||||
thumb=thumb,
|
thumb=thumb,
|
||||||
force_file=force_document and not is_image,
|
force_file=force_document and not is_image,
|
||||||
ttl_seconds=ttl
|
ttl_seconds=ttl,
|
||||||
|
nosound_video=nosound_video
|
||||||
)
|
)
|
||||||
return file_handle, media, as_image
|
return file_handle, media, as_image
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user