Enabling sender-side statistics

To receive sender-side statistics, enable them for the stream’s publisher by passing the publishSenderStats property set to true in the OT.initPublisher call:

If publishSenderStats is not enabled, no sender statistics channel will be published for this publisher. The default value is false.

When initializing the Publisher object, set the audioFallback property of the option you pass into the OT.initPublisher() method:

Subscribing to sender-side statistics

Subscribers automatically receive sender statistics only if the publisher has enabled them and if the user calls Subscriber.getStats() at least once. Note that due to network latency, the first call to getStats may not include sender statistics. Subsequent calls are more likely to return this data.

No additional events or methods are required; the sender statistics are included in the existing stats object returned by getStats().

Receiving statistics events

Sender-side statistics are included as an optional senderStats object inside the stats object passed to the Subscriber.getStats() callback. The senderStats object contains two properties:

  • connectionMaxAllocatedBitrate — The maximum bitrate that can be estimated for the connection (in bits per second)

  • connectionEstimatedBandwidth — The current estimated bandwidth for the connection (in bits per second)

These two metrics are calculated per audio-video bundle, so the same values appear in both video and audio statistics. Because they reflect the transport rather than individual tracks, the metrics are shared across both audio and video.

Known issues

In some cases, when the session is relayed —or in certain routed setups with only two participants— and the Publisher uses Firefox, sender-side statistics may not be available due to browser limitations.