草案
此页面不完整。
RTCStatsReport
interface provides a statistics report obtained by calling one of the
RTCPeerConnection.getStats()
,
RTCRtpReceiver.getStats()
,和
RTCRtpSender.getStats()
方法。
This statistics report contains a mapping of statistic category string names to objects containing the corresponding statistics data.
调用
getStats()
在
RTCPeerConnection
lets you specify 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 statistics available to the incoming or outgoing stream on which you call them.
For each category of statistic information, there is a dictionary whose properties provide the relevant information.
All WebRTC statistics objects are fundamentally based on the
RTCStats
dictionary, which provides the most fundamental information: the timestamp, the statistic type string, and an ID uniquely identifying the source of the data:
id
DOMString
which uniquely identifies the object which was inspected to produce this object based on
RTCStats
.
timestamp
DOMHighResTimeStamp
object indicating the time at which the sample was taken for this statistics object.
type
DOMString
indicating the type of statistics the object contains, taken from the enum type
RTCStatsType
.
type
gives the name of the statistic category represented by the object, and is how you locate the specific type of data you need. The statistic category names are members of the enumerated type
RTCStatsType
,如下:
candidate-pair
RTCIceCandidatePairStats
object providing statistics related to an
RTCIceTransport
. Candidate pairs other than the currently active pair for the transport are deleted when the
RTCPeerConnection
changes its
RTCPeerConnection.iceGatheringState
to
new
during an
ICE restart
. The active candidate pair is deleted after the transport switches to another candidate pair; this change cannot be detected otherwise.
certificate
RTCCertificateStats
object providing statistics related to a certificate being used by an
RTCIceTransport
.
codec
RTCCodecStats
object containing statistics about a codec currently being used by
RTP
streams to send or receive data for the
RTCPeerConnection
.
csrc
RTCContributingSourceStats
object which contains statistics related to a contributing source (CSRC) that contributed to an inbound RTP stream.
data-channel
RTCDataChannelStats
object which contains statistics about each
RTCDataChannel
on the connection.
inbound-rtp
RTCInboundRtpStreamStats
object providing statistics about
inbound
data being received from remote peers. Since this only provides statistics related to inbound data, without considering the local peer's state, any values that require knowledge of both, such as round-trip time, is not included. This report isn't available if there are no connected peers.
local-candidate
RTCIceCandidateStats
object giving statistics about an ICE local candidate; these candidates are found in the output from
RTCIceTransport.getLocalCandidates()
.
outbound-rtp
RTCOutboundRtpStreamStats
object providing statistics based on the local peer's
outgoing
data being sent to its peers. This information considers only the outbound RTP stream, so any data which requires information about the state of the remote peers (such as round-trip time) is unavailable, since those values can't be computed without knowing about the other peers' states.
peer-connection
RTCPeerConnectionStats
object provides statistics related to the overall peer connection's
RTCPeerConnection
.
receiver
RTCRtpReceiver
. The statistics object is an
RTCAudioReceiverStats
object if
kind
is
audio
;若
kind
is
视频
, the object is an
RTCVideoReceiverStats
对象。
remote-candidate
RTCIceCandidateStats
object containing statistics about the remote candidate's
RTCIceTransport
. This may include information such as the type of network, the protocol, the URL, the type of relay being used, and so forth.
remote-inbound-rtp
RTCRemoteInboundRtpStreamStats
object providing statistics about your outbound RTP data stream, but from the perspective of the remote peer. That is, this information is about your
outbound-rtp
stream, but as seen by the remote device that's handling the stream. You can use this information to do things like determine how well the remote peer is receiving data.
remote-outbound-rtp
RTCRemoteOutboundRtpStreamStats
object that contains statistics about your inbound RTP (
inbound-rtp
) stream, but from the perspective of the remote peer.
sender
RTCRtpSender
for a stream on the
RTCPeerConnection
。若
kind
is
"audio"
, this object is of type
RTCAudioSenderStats
;若
kind
is
"video"
, this is an
RTCVideoSenderStats
对象。
stream
RTCMediaStreamStats
, providing statistics and information about a
MediaStream
which is part of the
RTCPeerConnection
.
track
RTCMediaHandlerStats
: for audio tracks, the type is
RTCSenderAudioTrackAttachmentStats
and for video tracks, the type is
RTCSenderVideoTrackAttachmentStats
. The data within provides statistics related to a particular
MediaStreamTrack
's attachment to an
RTCRtpSender
; also included are the media level metrics that go along with the track.
transport
RTCPeerConnection
. The object is of type
RTCTransportStats
.
... coming soon-ish ...
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCStatsReport' in that specification. |
候选推荐 | 最初的规范。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
RTCStatsReport
|
Chrome No | Edge No | Firefox No | IE No | Opera No | Safari No | WebView Android No | Chrome Android No | Firefox Android No | Opera Android No | Safari iOS No | Samsung Internet Android No |
不支持
RTCPeerConnection
RTCPeerConnection.getStats()
,
RTCRtpReceiver.getStats()
,和
RTCRtpSender.getStats()
RTCStatsReport
MediaDevices.getUserMedia()
Navigator.mediaDevices
RTCCertificate
RTCDTMFSender
RTCDTMFToneChangeEvent
RTCDataChannel
RTCDataChannelEvent
RTCDtlsTransport
RTCErrorEvent
RTCIceCandidate
RTCIceTransport
RTCPeerConnection
RTCPeerConnectionIceErrorEvent
RTCPeerConnectionIceEvent
RTCRtpReceiver
RTCRtpSender
RTCRtpTransceiver
RTCSctpTransport
RTCSessionDescription
RTCStatsEvent
RTCTrackEvent