RTCStatsReport has become Map-like object

Published: | Categories: Audio & Video


The implementation of RTCStatsReport, that can be retrieved using the RTCPeerConnection.getStats method, has been updated as per the latest WebRTC spec, and the interface has become an object like Map, offering the entries, forEach, get, has, keys, values, @@iterator methods as well as the size property. The legacy implementation, that allowed to access read-only enumerable properties directly on the object, will be warned in the Web Console and soon be removed. As this example shows, you basically have to replace report[key] with report.get(key).

Update: The legacy non-Map-like getStats access has been removed with Firefox 66.