@@ -39,6 +39,9 @@ webRtcIssueDetector.watchNewPeerConnections();
3939```
4040
4141### 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+
4245``` typescript
4346import WebRTCIssueDetector , {
4447 QualityLimitationsIssueDetector ,
@@ -49,17 +52,14 @@ import WebRTCIssueDetector, {
4952 NetworkMediaSyncIssueDetector ,
5053 AvailableOutgoingBitrateIssueDetector ,
5154 VideoCodecMismatchDetector ,
52- CompositeRTCStatsParser ,
53- WebRTCIssueEmitter ,
54- NetworkScoresCalculator ,
55- PeriodicWebRTCStatsReporter ,
56- RTCStatsParser ,
5755} from ' webrtc-issue-detector' ;
5856
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
6363 new QualityLimitationsIssueDetector (),
6464 new FramesDroppedIssueDetector (),
6565 new FramesEncodedSentIssueDetector (),
@@ -69,15 +69,16 @@ new WebRTCIssueDetector({
6969 new AvailableOutgoingBitrateIssueDetector (),
7070 new VideoCodecMismatchDetector (),
7171 ],
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+ ],
8182});
8283```
8384
@@ -86,105 +87,105 @@ new WebRTCIssueDetector({
8687### AvailableOutgoingBitrateIssueDetector
8788Detects issues with outgoing network connection.
8889``` js
89- {
90+ const issue = {
9091 type: ' network' ,
9192 reason: ' outbound-network-throughput' ,
92- debug: ' ...'
93+ debug: ' ...' ,
9394}
9495```
9596
9697### FramesDroppedIssueDetector
9798Detects issues with decoder.
9899``` js
99- {
100+ const issue = {
100101 type: ' cpu' ,
101102 reason: ' decoder-cpu-throttling' ,
102- debug: ' ...'
103+ debug: ' ...' ,
103104}
104105```
105106
106107### FramesEncodedSentIssueDetector
107108Detects issues with outbound network throughput.
108109``` js
109- {
110+ const issue = {
110111 type: ' network' ,
111112 reason: ' outbound-network-throughput' ,
112- debug: ' ...'
113+ debug: ' ...' ,
113114}
114115```
115116
116117### InboundNetworkIssueDetector
117118Detects issues with inbound network connection.
118119``` js
119- {
120+ const issue = {
120121 type: ' network' ,
121122 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: ' ...' ,
124125}
125126```
126127
127128Also can detect server side issues if there is high RTT and jitter is ok.
128129``` js
129- {
130+ const issue = {
130131 type: ' server' ,
131132 reason: ' server-issue' ,
132- iceCandidate: ' ice-candidate-id'
133- debug: ' ...'
133+ iceCandidate: ' ice-candidate-id' ,
134+ debug: ' ...' ,
134135}
135136```
136137
137138### NetworkMediaSyncIssueDetector
138139Detects issues with audio syncronization.
139140``` js
140- {
141+ const issue = {
141142 type: ' network' ,
142143 reason: ' network-media-sync-failure' ,
143- ssrc: ' ...'
144- debug: ' ...'
144+ ssrc: ' ...' ,
145+ debug: ' ...' ,
145146}
146147```
147148
148149### OutboundNetworkIssueDetector
149150Detects issues with outbound network connection.
150151``` js
151- {
152+ const issue = {
152153 type: ' network' ,
153154 reason: ' outbound-network-quality' | ' outbound-network-media-latency' ,
154- iceCandidate: ' ice-candidate-id'
155- debug: ' ...'
155+ iceCandidate: ' ice-candidate-id' ,
156+ debug: ' ...' ,
156157}
157158```
158159
159160### QualityLimitationsIssueDetector
160161Detects issues with encoder and outbound network. Based on native qualitiLimitationReason.
161162``` js
162- {
163+ const issue = {
163164 type: ' cpu' ,
164165 reason: ' encoder-cpu-throttling' ,
165- ssrc: ' ...'
166- debug: ' ...'
166+ ssrc: ' ...' ,
167+ debug: ' ...' ,
167168}
168169```
169170
170171``` js
171- {
172+ const issue = {
172173 type: ' network' ,
173174 reason: ' outbound-network-throughput' ,
174- ssrc: ' ...'
175- debug: ' ...'
175+ ssrc: ' ...' ,
176+ debug: ' ...' ,
176177}
177178```
178179
179180### VideoCodecMismatchDetector
180181Detects issues with decoding stream.
181182``` js
182- {
183+ const issue = {
183184 type: ' stream' ,
184185 reason: ' codec-mismatch' ,
185186 ssrc: ' ...' ,
186187 trackIdentifier: ' ...' ,
187- debug: ' ...'
188+ debug: ' ...' ,
188189}
189190```
190191
0 commit comments