Draft
This page is not complete.
The RTCStatsReport
interface is used to provide statistics data about WebRTC connections as returned by the RTCPeerConnection.getStats()
, RTCRtpReceiver.getStats()
, and RTCRtpSender.getStats()
methods. This object consists of a mapping of strings which identify a category of statistics to objects which contains the various measured values for each.
Calling getStats()
on an RTCPeerConnection
lets you specifiy whether you wish to obtain statistics for outbound, inbound, or all streams on the connection. The RTCRtpReceiver
and RTCRtpSender
versions of getStats()
specifically only return the incoming and outgoing streams, respectively.
The full RTCStatsReport
interface is made up of a mapping of strings to subdictionaries which contain the statistics for each category, such as ICE candidate or media stream statistics. Each of these subdictionaries has in common the following values:
timestamp
DOMHighResTimeStamp
object which indicates the time at which the data was handled by the local WebRTC layer; for example, for statistics related to received RCTP packets, this would indicate the time at which the data was received by the local endpoint (the remote timestamp is available as well in one of the fields defined within one of the other subdictionaries. The time is specified relative to the UNIX epoch (the first moment of January 1, 1970, UTC).type
RTCStatsType
,id
DOMString
which uniquely identifies the object which was inspected to produce this object based on RTCStats
. This allows any two RTCStats
-based objects which were produced from the same data to be correlated to one another. The format of this ID is not defined by the specification, so it cannot be relied upon to have any particular format, structure, or meaning beyond that.From a definition standpoint, these values are defined in the RTCStats
dictionary in RTCStatsReport
's WebIDL file.
The RTCRtpStreamStats
dictionary is based on RTCStats
, and inherits its properties. In addition, some or all of the following properties are available.
codecId
DOMString
which uniquely identifies the object which was inspected to produce the RTCCodecStats
object associated with this RTP stream.kind
DOMString
whose value is "audio"
if the associated MediaStreamTrack
is audio-only or "video"
if the track contains video. This value will match that of the media type indicated by RTCCodecStats.codec
, as well as the track's kind
property. Previously called mediaType
.ssrc
RTCRtpStreamStats
object covers. This value is generated per the RFC 3550 specification.trackId
DOMString
which uniquely identifies the RTCMediaStreamTrackStats
object representing the associated MediaStreamTrack
. This is not the same as the value of MediaStreamTrack.id
.transportId
DOMString
uniquely identifying the object which was inspected to produce the RTCTransportStats
object associated with this RTP stream.mediaType
kind
in the specification in February 2018. See Browser compatibility in RTCRtpStreamStats.kind
to determine when browsers made the transition.These properties are computed locally, and are only available to the device receiving the media stream. Their primary purpose is to examine the error resiliency of the connection, as they provide information about lost packets, lost frames, and how heavily compressed the data is.
firCount
nackCount
pliCount
qpSum
RTCRtpStreamStats
object. In general, the higher this number is, the more heavily compressed the video track was. Combined with RTCReceivedRtpStreamStats.framesDecoded
or RTCSentRtpStreamStats.framesEncoded
, you can approximate the average QP over those frames, keeping in mind that codecs often vary the quantizer values even within frames. Also keep in mind that the values of QP can vary from codec to codec, so this value is only potentially useful when compared against the same codec.sliCount
Contains statistics about inbound RTP streaming. The RTCInboundRTPStreamStats
dictionary is based upon both RTCStats
and RTCRtpStreamStats
and includes all properties from those dictionaries, as well as the following:
bytesReceived
jitter
packetsDiscarded
packetsLost
packetsReceived
Contains statistics about outbound RTP streaming. The RTCOutboundRTPStreamStats
dictionary is based upon both RTCStats
and RTCRtpStreamStats
and includes all properties from those dictionaries, as well as the following:
packetsSent
bytesSent
targetBitrate
droppedFrames
framesEncoded
Specification | Status | Comment |
---|---|---|
WebRTC 1.0: Real-time Communication Between Browsers The definition of 'RTCStatsReport' in that specification. | Candidate Recommendation | Initial specification. |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | No | ? | No | No | No | No |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | No | No | ? | No | No | No | No |
RTCPeerConnection
RTCPeerConnection.getStats()
, RTCRtpReceiver.getStats()
, and RTCRtpSender.getStats()
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/RTCStatsReport