new RTCMonitor(optionsopt)
RTCMonitor polls a peerConnection via PeerConnection.getStats
and emits warnings when stats cross the specified threshold values.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
options |
RTCMonitor.Options |
<optional> |
Config options for RTCMonitor. |
- Source:
Methods
(static) createSample(stats, previousSampleopt, nullable) → {Promise.<RTCSample>}
Create a sample object from a stats object using the previous sample,
if available.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
stats |
Object | Stats retrieved from getStatistics | ||
previousSample |
Object |
<optional> <nullable> |
null | The previous sample to use to calculate deltas. |
- Source:
Returns:
- Type
- Promise.<RTCSample>
disable() → {RTCMonitor}
Stop sampling RTC statistics for this RTCMonitor.
- Source:
Returns:
This RTCMonitor instance.
- Type
- RTCMonitor
disableWarnings() → {RTCMonitor}
Disable warning functionality.
- Source:
Returns:
- Type
- RTCMonitor
enable(peerConnectionopt) → {RTCMonitor}
Start sampling RTC statistics for this RTCMonitor.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
peerConnection |
PeerConnection |
<optional> |
A PeerConnection to monitor. |
- Source:
Throws:
-
-
Attempted to replace an existing PeerConnection in RTCMonitor.enable
- Type
- Error
-
-
-
Can not enable RTCMonitor without a PeerConnection
- Type
- Error
-
Returns:
This RTCMonitor instance.
- Type
- RTCMonitor
enableWarnings() → {RTCMonitor}
Enable warning functionality.
- Source:
Returns:
- Type
- RTCMonitor
getSample() → {Promise.<RTCSample>}
Get stats from the PeerConnection.
- Source:
Returns:
A universally-formatted version of RTC stats.
- Type
- Promise.<RTCSample>
Type Definitions
Options
Type:
- Object
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
peerConnection |
PeerConnection |
<optional> |
The PeerConnection to monitor. |
thresholds |
RTCMonitor.ThresholdOptions |
<optional> |
Optional custom threshold values. |
- Source:
ThresholdOption
Type:
- Object
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
min |
Number |
<optional> <nullable> |
Warning will be raised if tracked metric falls below this value. |
max |
Number |
<optional> <nullable> |
Warning will be raised if tracked metric rises above this value. |
maxDuration |
Number |
<optional> <nullable> |
Warning will be raised if tracked metric stays constant for the specified number of consequent samples. |
- Source:
ThresholdOptions
Type:
- Object
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
audioInputLevel |
RTCMonitor.ThresholdOption |
<optional> |
Rules to apply to sample.audioInputLevel |
audioOutputLevel |
RTCMonitor.ThresholdOption |
<optional> |
Rules to apply to sample.audioOutputLevel |
packetsLostFraction |
RTCMonitor.ThresholdOption |
<optional> |
Rules to apply to sample.packetsLostFraction |
jitter |
RTCMonitor.ThresholdOption |
<optional> |
Rules to apply to sample.jitter |
rtt |
RTCMonitor.ThresholdOption |
<optional> |
Rules to apply to sample.rtt |
mos |
RTCMonitor.ThresholdOption |
<optional> |
Rules to apply to sample.mos |
- Source: