stream¶
Publish a live source to an RTMP(S) livestream, reconnecting on drops. :param source: A file-like object (a path, an open file, or a live byte stream handle), an iterable of byte chunks, or a callable returning chunks until b"". :param url: The RTMP application, e.g. rtmps://dc4-1.rtmp.t.me/s/. :param stop: An optional zero-argument callable; when it returns True the publishing stops. :param log: An optional callable(message: str) for connection notices. :return: The :class:Publisher, for its statistics. The container of the source is auto-detected (MPEG-TS, MP4 faststart/fragmented, MKV/WebM); its H.264 video and AAC audio are published untouched, paced to real time. Sources in other codecs are rejected: Telegram's RTMP server accepts H.264 and AAC only.
stream()(
source: ,
url: ,
key: ,
verify_tls: = True,
connect_timeout: = 15.0,
command_timeout: = 10.0,
reconnect_delay: = 1.0,
max_reconnect_delay: = 30.0,
lookahead_ms: = 1000,
stop: = None,
log: = None
)