I was playing with ErizoClient.Room.getStreamStats()
and found it very useful to provide users some interesting information about the stream status. But the API seems to be unofficial since there is no documentation for it. The current output is hard to read and needs to be parsed and filtered. Consider the following output:
{
'888581ec-5d51-4881-b007-4f04983935cf': {
0: {
erizoAudioMute: 0,
erizoVideoMute: 0,
},
2780458502: {
bandwidth: 825600,
bitrateCalculated: 176165,
clientHostType: 'host',
fractionLost: 0,
jitter: 11619,
keyFrames: 1,
packetsLost: 0,
sourceSsrc: 2780458502,
type: 'video',
},
qualityLayers: {
0: {
0: 68968,
1: 180976,
2: 226672,
},
maxActiveSpatialLayer: 0,
maxActiveTemporalLayer: 2,
},
total: {
bitrateCalculated: 176165,
paddingBitrate: 102048,
senderBitrateEstimation: 825600,
},
},
publisher: {
2780458502: {
PLI: 1,
bitrateCalculated: 226499,
bytesSent: 85942,
clientHostType: 'host',
erizoBandwidth: 796317,
keyFrames: 2,
packetsSent: 103,
type: 'video',
},
total: {
bitrateCalculated: 226499,
paddingBitrate: 0,
},
},
}
At the moment you need to traverse the entire object and examine the type of keys to reach the data you need. One idea is to add the sourceSsrc
(2780458502 in this example) to the stream attributes so finding the key is much easier.
In the other hand some data are ambiguous to me like bandwidth
vs erizoBandwidth
vs bitrateCalculated
or packetsLost
vs fractionLost
vs jitter
. BTW what is PLI
??
Also the output seems incomplete. For example we have bytesSent
for the publisher but there is no bytesReceived
for the subscriber which could be useful for calculating the total upload/download traffic usage.