Share via


msGetStats method

[Some information relates to pre-released product which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.]

Gathers stats for the given object and reports the result asynchronously. If the object has not yet begun to send or receive data, the returned stats will reflect this. If the object is in the closed state, the returned stats will reflect the stats at the time the object transitioned to the closed state.

When the msGetStats() method is invoked, the user agent MUST queue a task to run the following steps:

1. Let p be a new promise.

2. Return, but continue the following steps in the background.

3. Start gathering the stats.

4. When the relevant stats have been gathered, return a new RTCStatsReport object, representing the gathered stats.

Note  In the current Microsoft Edge implementation, the msGetStats method throws an InvalidStateError DOMException:

  • For RTCIceTransport.getStats(), if RTCIceTransport.start() has not yet been called, or if RTCIceTransport.stop() has been called;
  • For RTCRtpSender.getStats(), if RTCRtpSender.send(parameters) has not yet been called;
  • For RTCRtpReceiver.getStats(), if RTCRtpReceiver.receive(parameters) has not yet been called.

If the .msGetStats() method does not throw the InvalidStateError DOMException, but the “Ice Transport” state is not “completed”, the Promise will be returned, but will be rejected. In future implementations, the msGetStats method will avoid these InvalidStateError messages, instead returning empty stats until the “completed” state is achieved.

 

Syntax

*object.*msGetStats()

Parameters

This method has no parameters.

Return value

Type: Promise<RTCStatsReport>

Represents a map between strings, identifying the inspected objects (RTCStats.id), and their corresponding RTCStats objects.

Standards information

See also

Statistics extensions

Statistics API