The Vonage Video SDK exposes detailed stream-quality metrics through a high-level statistics API—recommended for most use cases—which provides audio, video, network, and sender-side statistics in a unified, session-aware form that remains stable across peer-connection transitions. For advanced debugging, the SDK also offers access to the raw WebRTC stats report, which reflects unprocessed peer-connection data.

Audio and video statistics API

The Vonage Video Windows SDK sends periodic audio and video network statistics for both publishers and subscribers. These include packet counts, bitrates, frame rate data, pause/freeze metrics, codec information, and optional sender-side network estimation.

Statistics are delivered through the following events:

  • Publisher.AudioStatsUpdated — publisher-side audio stats
  • Publisher.VideoStatsUpdated — publisher-side video stats
  • Publisher.VideoQualityChanged — publisher video quality change notification
  • Subscriber.AudioStatsUpdated — subscriber-side audio stats
  • Subscriber.VideoStatsUpdated — subscriber-side video stats
  • Publisher.VideoQualityChanged — subscriber video quality change notification

To receive them, set the appropriate event handler on the publisher or subscriber.

Enabling statistics for publishers

Set the corresponding event handlers for Publisher.AudioStatsUpdated and Publisher.VideoStatsUpdated:

publisher.AudioStatsUpdated += (sender, args) =>
{
    foreach (var stat in args.Stats)
    {
        Console.WriteLine($"Audio bytes sent: {stat.BytesSent}");
    }
};

publisher.VideoStatsUpdated += (sender, args) =>
{
    foreach (var stat in args.Stats)
    {
        Console.WriteLine($"Video packets sent: {stat.PacketsSent}");
    }
};

These events are sent periodically to report audio and video statistics for the publisher. The event handlers for these are passed in an array of AudioNetworkStats and VideoNetworkStats Each method is passed in two objects: the publisher and an array of stats objects. For a publisher in a routed session (one that uses the OpenTok Media Router), the array includes one object, defining the statistics for the single audio or video media stream that is sent to the Vonage Video Media Router. In a relayed session, the array includes an object for each subscriber to the published stream.

Receiving video quality events on the publishers

If you are also interested in video quality events implement this handler:

publisher.VideoQualityChanged += (sender, args) =>
{
    Console.WriteLine($"Publisher video quality changed: {args.Reason}");
};

Enabling statistics for subscribers

Set the corresponding event handlers for Subscriber.AudioStatsUpdated and Subscriber.VideoStatsUpdated:

subscriber.VideoStatsUpdated += (sender, stats) =>
{
    Console.WriteLine($"Video bytes received: {stats.BytesReceived}");
};

subscriber.AudioStatsUpdated += (sender, stats) =>
{
    Console.WriteLine($"Audio packets received: {stats.PacketsReceived}");
};

Receiving video quality events on the subscribers

If you are also interested in video quality events implement this handler:

subscriber.VideoQualityChanged += (sender, args) =>
{
    Console.WriteLine($"Subscriber video quality event: {args.Reason}");
};

Statistics data structures

This section outlines the structs and fields provided by the Windows Video SDK audio and video statistics API. While all Video SDK platforms expose the same set statistics, there may be minor differences in how each platform structures or names individual fields. These variations reflect platform-specific SDK design conventions rather than differences in the underlying metrics.

TransportStats

Represents transport-level bandwidth estimation.

  • ConnectionEstimatedBandwidth — Estimated available uplink bandwidth (bps)

Publisher.AudioNetworkStats

Provides statistics about a publisher’s audio track.

  • ConnectionId — Subscriber connection ID (relayed only)
  • SubscriberId — Subscriber ID (relayed only)
  • PacketsLost — Total audio packets lost
  • PacketsSent — Total audio packets sent
  • BytesSent — Total audio bytes sent
  • Timestamp — Timestamp when stats were gathered (ms)
  • StartTime — Timestamp when cumulative totals began (ms)
  • Transport — Transport-level stats (TransportStats)

Publisher.VideoNetworkStats

Provides statistics about a publisher’s video track.

  • ConnectionId — Subscriber connection ID (relayed only)
  • SubscriberId — Subscriber ID (relayed only)
  • PacketsLost — Video packets lost
  • PacketsSent — Video packets sent
  • BytesSent — Video bytes sent
  • Timestamp — Timestamp when stats were gathered
  • StartTime — Timestamp when cumulative totals began
  • VideoLayers — List of simulcast/SVC layers (VideoLayerStats)
  • Transport — Transport-level stats

Publisher.VideoLayerStats

Represents a single simulcast or SVC video layer.

  • Width — Encoded frame width
  • Height — Encoded frame height
  • EncodedFrameRate — Encoded frames per second
  • Bitrate — Layer bitrate (bps)
  • TotalBitrate — Bitrate including RTP overhead (bps)
  • ScalabilityMode — SVC/scalability description (e.g., "L3T3")
  • QualityLimitationReason — Reason for quality reduction
  • Codec — Codec used for this layer

Subscriber.AudioNetworkStatsEventArgs

Provides statistics about a subscriber’s audio track.

  • PacketsLost — Estimated audio packets lost
  • PacketsReceived — Audio packets received
  • BytesReceived — Audio bytes received
  • Timestamp — Timestamp when stats were gathered
  • SenderStats — Sender-side network estimation (optional)

Subscriber.VideoNetworkStatsEventArgs

Provides statistics about a subscriber’s video track.

  • PacketsLost — Video packets lost
  • PacketsReceived — Video packets received
  • BytesReceived — Video bytes received
  • Timestamp — Timestamp when stats were gathered
  • SenderStats — Sender-side network estimation (optional)
  • Width — Decoded frame width
  • Height — Decoded frame height
  • DecodedFrameRate — Decoded frames per second
  • Bitrate — Video bitrate (bps)
  • TotalBitrate — Total bitrate including RTP overhead
  • PauseCount — Number of video pauses (>5s without a frame)
  • TotalPausesDuration — Total pause duration (ms)
  • FreezeCount — Number of WebRTC-defined freezes
  • TotalFreezesDuration — Total freeze duration (ms)
  • Codec — Decoder codec

Sender-side statistics

See the sender-side statistics overview.

Enabling sender-side statistics

Sender-side statistics are received on the subscribers. To receive sender-side statistics, enable them for the stream’s publisher by setting the HasSenderStatsTrack property to true when building the publisher:

var publisherBuilder = new Publisher.Builder()
{
    HasSenderStatsTrack = true
};

Publisher publisher = publisherBuilder.Build();

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

Subscribing to sender-side statistics

Subscribers automatically receive sender statistics only if the publisher has enabled them and if the subscriber registers a listener for network statistics events.

Receiving statistics events

Sender-side statistics are delivered via the VideoStatsUpdated and AudioStatsUpdated events for video and audio. The SenderStats class, included in both VideoNetworkStatsEventArgs and AudioNetworkStatsEventArgs, provides two properties:

  • ConnectionMaxAllocatedBitrate — The maximum bitrate that can be estimated for the connection

  • ConnectionEstimatedBandwidth — The current estimated bandwidth for the connection

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.

Inside the stats event handlers, you can access the sender-side metrics through the optional SenderStats property:

subscriber.VideoStatsUpdated += (sender, stats) =>
{
    if (stats.SenderStats != null)
    {
        Console.WriteLine($"Connection max allocated bitrate: {stats.SenderStats.ConnectionMaxAllocatedBitrate}");
        Console.WriteLine($"Connection current estimated bandwidth: {stats.SenderStats.ConnectionEstimatedBandwidth}");
    }
    else
    {
        Console.WriteLine("Sender stats not available yet.");
    }
};

The same approach applies to audio stats using the AudioStatsUpdated event.

RTC stats report

To get a publisher low-level peer connection statistics, use the Publisher.GetRtcStatsReport() method. This provides RTC stats reports for the media stream. This is an asynchronous operation. When the stats are available, the RtcStatsReport event is sent. The RtcStatsReportArgs object includes an array of PublisherRtcStats objects, which includes a JsonArrayOfReports property. This is a JSON array of RTC stats reports, which are similar to the format the RtcStatsReport object implemented in web browsers (see these Mozilla docs).

To get a subscriber low-level peer connection statistics, use the Subscriber.GetRtcStatsReport() method. This provides an RTC stats report for the media stream.

This is an asynchronous operation. When the stats are available, the RtcStatsReport event is sent. The RtcStatsReportArgs object includes a JsonArrayOfReports property. This is a JSON array of RTC stats reports, which are similar to the format the RtcStatsReport object implemented in web browsers (see these Mozilla docs).

Also see this W3C documentation.

Requesting an RTC stats report for a publisher:

publisher.RtcStatsReport += (sender, args) =>
{
    foreach (var stat in args.stats)
    {
        Console.WriteLine(stat.JsonArrayOfReports); // Raw RTC JSON
    }
};

publisher.GetRtcStatsReport();