Skip to content

Monitoring

Everything the session does is readable while it runs.

stats, one call

player.stats
# {'position': 6.1, 'paused': False, 'muted': False, 'connected': True,
#  'stopped': False, 'loops': 0, 'bitrate_kbps': 116.1, 'frames_sent': 428,
#  'video_frames_sent': 51, 'bytes_sent': 90211, 'frames_dropped': 0,
#  'window_bytes': None, 'av_skew_ms': 0, 'error': None}

av_skew_ms is the wire skew of the audio timeline against the video one; near 0 and constant is healthy.

Throughput

player.bitrate_kbps   # ~10 s rolling average of the stream

It self-samples: poll it once a second and it is current.

Warnings

player.warnings lists everything the server will not accept: wrong dimensions, non-16:9 aspect ratio, unusual sample rates. Nothing fails silently; each warning is also pushed to your log callback prefixed with warning:.

player = tgrtmp.publish(source, url, key, log=print)

The log narrates the session: connects, drops and retries, pause-outlived-window, end-of-stream holds, loop restarts.

Periodic dashboard

while not player.stopped:
    print(player.stats)
    time.sleep(1)

Or drive it from on_connection plus your own timer; the player never blocks on readers.