@@ -39,6 +39,9 @@ webRtcIssueDetector.watchNewPeerConnections();
39
39
```
40
40
41
41
### Configure
42
+
43
+ By default, WebRTCIssueDetector can be created with minimum of mandatory constructor parameters. But it's possible to override most of them.
44
+
42
45
``` typescript
43
46
import WebRTCIssueDetector , {
44
47
QualityLimitationsIssueDetector ,
@@ -49,17 +52,14 @@ import WebRTCIssueDetector, {
49
52
NetworkMediaSyncIssueDetector ,
50
53
AvailableOutgoingBitrateIssueDetector ,
51
54
VideoCodecMismatchDetector ,
52
- CompositeRTCStatsParser ,
53
- WebRTCIssueEmitter ,
54
- NetworkScoresCalculator ,
55
- PeriodicWebRTCStatsReporter ,
56
- RTCStatsParser ,
57
55
} from ' webrtc-issue-detector' ;
58
56
59
- new WebRTCIssueDetector ({
60
- issueEmitter: new WebRTCIssueEmitter (),
61
- networkScoresCalculator: new NetworkScoresCalculator (),
62
- detectors: [
57
+ const widWithDefaultConstructorArgs = new WebRTCIssueDetector ();
58
+
59
+ // or you can fully customize WebRTCIssueDetector with constructor arguments
60
+
61
+ const widWithCustomConstructorArgs = new WebRTCIssueDetector ({
62
+ detectors: [ // you are free to change the detectors list according to your needs
63
63
new QualityLimitationsIssueDetector (),
64
64
new FramesDroppedIssueDetector (),
65
65
new FramesEncodedSentIssueDetector (),
@@ -69,15 +69,16 @@ new WebRTCIssueDetector({
69
69
new AvailableOutgoingBitrateIssueDetector (),
70
70
new VideoCodecMismatchDetector (),
71
71
],
72
- statsReporter: new PeriodicWebRTCStatsReporter ({
73
- compositeStatsParser ,
74
- getStatsInterval: 5000 ,
75
- }),
76
- onIssues: params .onIssues ,
77
- onNetworkScoresUpdated: params .onNetworkScoresUpdated ,
78
- ignoreSSRCList: params .ignoreSSRCList ,
79
- compositeStatsParser ,
80
- logger ,
72
+ getStatsInterval: 10_000 , // set custom stats parsing interval
73
+ onIssues : (payload : IssueDetectorResult ) => {
74
+ // your custom callback for detected issues handling
75
+ },
76
+ onNetworkScoresUpdated : (payload : NetworkScores ) => {
77
+ // your custom callback for networks score updates handling
78
+ },
79
+ ignoreSSRCList: [
80
+ // in case you need to skip some ssrc from parsing, add its numbers to the array
81
+ ],
81
82
});
82
83
```
83
84
@@ -86,105 +87,105 @@ new WebRTCIssueDetector({
86
87
### AvailableOutgoingBitrateIssueDetector
87
88
Detects issues with outgoing network connection.
88
89
``` js
89
- {
90
+ const issue = {
90
91
type: ' network' ,
91
92
reason: ' outbound-network-throughput' ,
92
- debug: ' ...'
93
+ debug: ' ...' ,
93
94
}
94
95
```
95
96
96
97
### FramesDroppedIssueDetector
97
98
Detects issues with decoder.
98
99
``` js
99
- {
100
+ const issue = {
100
101
type: ' cpu' ,
101
102
reason: ' decoder-cpu-throttling' ,
102
- debug: ' ...'
103
+ debug: ' ...' ,
103
104
}
104
105
```
105
106
106
107
### FramesEncodedSentIssueDetector
107
108
Detects issues with outbound network throughput.
108
109
``` js
109
- {
110
+ const issue = {
110
111
type: ' network' ,
111
112
reason: ' outbound-network-throughput' ,
112
- debug: ' ...'
113
+ debug: ' ...' ,
113
114
}
114
115
```
115
116
116
117
### InboundNetworkIssueDetector
117
118
Detects issues with inbound network connection.
118
119
``` js
119
- {
120
+ const issue = {
120
121
type: ' network' ,
121
122
reason: ' inbound-network-quality' | ' inbound-network-media-latency' | ' network-media-sync-failure' ,
122
- iceCandidate: ' ice-candidate-id'
123
- debug: ' ...'
123
+ iceCandidate: ' ice-candidate-id' ,
124
+ debug: ' ...' ,
124
125
}
125
126
```
126
127
127
128
Also can detect server side issues if there is high RTT and jitter is ok.
128
129
``` js
129
- {
130
+ const issue = {
130
131
type: ' server' ,
131
132
reason: ' server-issue' ,
132
- iceCandidate: ' ice-candidate-id'
133
- debug: ' ...'
133
+ iceCandidate: ' ice-candidate-id' ,
134
+ debug: ' ...' ,
134
135
}
135
136
```
136
137
137
138
### NetworkMediaSyncIssueDetector
138
139
Detects issues with audio syncronization.
139
140
``` js
140
- {
141
+ const issue = {
141
142
type: ' network' ,
142
143
reason: ' network-media-sync-failure' ,
143
- ssrc: ' ...'
144
- debug: ' ...'
144
+ ssrc: ' ...' ,
145
+ debug: ' ...' ,
145
146
}
146
147
```
147
148
148
149
### OutboundNetworkIssueDetector
149
150
Detects issues with outbound network connection.
150
151
``` js
151
- {
152
+ const issue = {
152
153
type: ' network' ,
153
154
reason: ' outbound-network-quality' | ' outbound-network-media-latency' ,
154
- iceCandidate: ' ice-candidate-id'
155
- debug: ' ...'
155
+ iceCandidate: ' ice-candidate-id' ,
156
+ debug: ' ...' ,
156
157
}
157
158
```
158
159
159
160
### QualityLimitationsIssueDetector
160
161
Detects issues with encoder and outbound network. Based on native qualitiLimitationReason.
161
162
``` js
162
- {
163
+ const issue = {
163
164
type: ' cpu' ,
164
165
reason: ' encoder-cpu-throttling' ,
165
- ssrc: ' ...'
166
- debug: ' ...'
166
+ ssrc: ' ...' ,
167
+ debug: ' ...' ,
167
168
}
168
169
```
169
170
170
171
``` js
171
- {
172
+ const issue = {
172
173
type: ' network' ,
173
174
reason: ' outbound-network-throughput' ,
174
- ssrc: ' ...'
175
- debug: ' ...'
175
+ ssrc: ' ...' ,
176
+ debug: ' ...' ,
176
177
}
177
178
```
178
179
179
180
### VideoCodecMismatchDetector
180
181
Detects issues with decoding stream.
181
182
``` js
182
- {
183
+ const issue = {
183
184
type: ' stream' ,
184
185
reason: ' codec-mismatch' ,
185
186
ssrc: ' ...' ,
186
187
trackIdentifier: ' ...' ,
187
- debug: ' ...'
188
+ debug: ' ...' ,
188
189
}
189
190
```
190
191
0 commit comments