FirefoxRTCStatsReport

FirefoxRTCStatsReport

Wrapped RTCStatsReport class for Firefox.

Constructor

new FirefoxRTCStatsReport()

Extends

Classes

FirefoxRTCStatsReport

Methods

get(key) → {Array.<RTCStats>}

Get the array of type of stats referred by key.

Overrides:
Parameters:
Name Type Description
key string

A stats object reference defined in RTCStatsReferences enum.

Returns:
Type:
Array.<RTCStats>

An array of stats referred by key.

Example
const report = new BaseRTCStatsReport(await pc.getStats());

if (report.get(RTCStatsReferences.RTCInboundRtpVideoStreams.key)) {
const stats = report.get(
  RTCStatsReferences.RTCInboundRtpVideoStreams.key
)[0];
logger.info(`ts:${stats.timestamp} id:${stats.trackId} recv:${stats.bytesReceived}`);

has(key) → {bool}

Check if the instance has the type of stats referred by key.

Overrides:
Parameters:
Name Type Description
key string

A stats object reference defined in RTCStatsReferences enum.

Returns:
Type:
bool

True if the referred stats exists.

Example
const report = new BaseRTCStatsReport(await pc.getStats());

if (report.has(RTCStatsReferences.RTCInboundRtpVideoStreams.key)) {
  logger.info("receiving video.");
} else {
  logger.info("no video streams receiving.");
}