onStats()
wrtc.onStats() is called when Chrome browser has collected statistics about received media stream during a call. (Chrome only, never occurs on other browsers.)
You can use this event to display the statistics (mostly used for debug).
Occurs
You must set call.adv.stats_ms to enable wrtc.onStats()
If you have set call.adv.stats_ms=1000 wrtc.onStats() will be called once per second during the duration of the call. (Chrome only)
Arguments
wrtc.onStat(call, arg)
- call - the call object raising the event
- arg: JSON structure containing:
- timestamp : date and time data was collected
- remoteAddr : IP address data stream is coming from
- remotePort : IP port data stream is coming from
- remoteType : type of connection:
- local : connected directly to remote peer
- serverreflexive : address derived using STUN
- relayed : connected through TURN server
- videoBytes : number of video stream bytes received since the beginning of the call
- videoPackets : number of video stream packets received since the beginning of the call
- videoLost : number of video stream packets lost (should have arrived but never did) since the beginning of the call
- videoBitRate : current bitrate video stream is received at, in kbps
- videoWidth : width of the video frame currently received, in pixels
- videoHeight : height of the video frame currently received, in pixels
- videoFrameRate : number of video frames per second received (slow hardwares may drop video frames during render – this is the number of frames received)
- videoJitterBufMs : size of the video jitter buffer, in ms of video stored
- audioBytes : number of audio stream bytes received since the beginning of the call
- audioPackets : number of audio stream packets received since the beginning of the call
- audioLost : number of audio stream packets lost (should have arrived but never did) since the beginning of the call
- audioBitRate : current bitrate audio stream is received at, in kbps
- audioLevel : current audio volume (sound level)
- audioJitter : current audio jitter
All measurements are of the incoming media stream.
You can use the value audioLevel to detect if the person you are in call with is speaking right now or not. Usually audioLevel>1000 means you are receiving sound.