1.0.0 • Published 5 years ago

webrtcsmetrics v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

WebRTCMetrics

WebRTCMetrics is a JavaScript library that aggregates stats received from the WebRTC stack to help Web applications grabbing metrics and information in real time.

Install

Using NPM

$ npm install webrtcmetrics

Using Yarn

$ yarn add webrtcmetrics

Usage

Once initialized the RTCPeerConnection, give it to the WebRTCMetrics instance created such in the following example:

import WebRTCMetrics from "webrtcmetrics";

// Somewhere in your code
const pc = new RTCPeerConnection(config);

const analyzer = new WebRTCMetrics({ pc });
analyzer.onmetrics = (metrics) => {
  // Do something with the metrics received
};

// Start the analyzer
analyzer.start();

Audio Information

NameValueDescription
input_codecJSONDescription of the audio input codec and parameters used
input_levelNumberLevel of the input sound (speakers)
output_codecJSONDescription of the audio output codec and parameters used
output_levelNumberLevel of the output sound (microphone)

Audio Statistics

NameValueDescription
last_three_jitterArrayLast 3 Jitter values received (in ms)
last_three_rttArraylast 3 RTT values received (in ms)
percent_packets_lostNumberPercent of audio packet lost since the last statistic
total_packets_receivedNumberNumber of packers received since the begining of the call
total_packets_lostNumberNumber of packers lost since the begining of the call
delta_packets_receivedNumberNumber of packers received since the last statistic
delta_packets_lostNumberNumber of packers lost since last statistic

Audio metrics

NameValueDescription
mosNumberAudio quality indicator based on 'Monitoring VoIP Call Quality Using Improved Simplified E-model'

Video Statistics

NameValueDescription
input_codecJSONDescription of the video input codec and parameters used
input_sizeNumberSize of the input video (from remote peer)
output_codecJSONDescription of the video output codec and parameters used
output_sizeNumberSize of the output video (own video)

Network

NameValueDescription
infrastructureNumberInfrastructure level (0: Eth, 3: Wifi, 5: 4G, 10: 3G)

Metrics to add

cet (call establishment time) --> Network ? local_candidate {type: "host|srflx|relay", protocol: "udp|tcp, port: Number} --> Network ? remote_candidate_type {type: "host|srflx|relay", protocol: "udp|tcp, port: Number} --> Network ? candidates_number: Number --> Network

1.0.0

5 years ago