RTCRtpSender
方法
getStats()
asynchronously requests an
RTCStatsReport
object which provides statistics about outgoing traffic on the
RTCPeerConnection
which owns the sender, returning a
Promise
which is fulfilled when the results are available.
var promise = RTCRtpSender.getStats();
A JavaScript
Promise
which is fulfilled once the statistics are available. The promise's fulfillment handler receives as a parameter a
RTCStatsReport
object containing the collected statistics.
返回的
RTCStatsReport
accumulates the statistics for all of the streams being sent using the
RTCRtpSender
, as well as the statistics for any dependencies those streams have.
This simple example obtains the statistics for an
RTCRtpSender
and updates an element's
innerText
to display the current round trip time for requests on the sender.
sender.getStats().then(function(stats) {
document.getElementById("currentRTT").innerText =
stats.roundTripTime;
});
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCRtpSender.getStats()' in that specification. |
候选推荐 | 最初的规范。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
getStats()
|
Chrome 67 | Edge ≤18 | Firefox 55 | IE No | Opera 54 | Safari ? | WebView Android 67 | Chrome Android 67 | Firefox Android 55 | Opera Android 48 | Safari iOS ? | Samsung Internet Android 9.0 |
完整支持
不支持
兼容性未知
RTCRtpSender
getParameters()
getStats()
replaceTrack()
setParameters()
MediaDevices.getUserMedia()
Navigator.mediaDevices
RTCCertificate
RTCDTMFSender
RTCDTMFToneChangeEvent
RTCDataChannel
RTCDataChannelEvent
RTCDtlsTransport
RTCErrorEvent
RTCIceCandidate
RTCIceTransport
RTCPeerConnection
RTCPeerConnectionIceErrorEvent
RTCPeerConnectionIceEvent
RTCRtpReceiver
RTCRtpTransceiver
RTCSctpTransport
RTCSessionDescription
RTCStatsEvent
RTCStatsReport
RTCTrackEvent