@observertc/observer-js 1.0.1-72a904d.0 → 1.0.1-9341fcd.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ObservedCall.d.ts +4 -8
- package/lib/ObservedCall.d.ts.map +1 -1
- package/lib/ObservedCall.js +16 -72
- package/lib/ObservedCallEventMonitor.d.ts +104 -0
- package/lib/ObservedCallEventMonitor.d.ts.map +1 -0
- package/lib/ObservedCallEventMonitor.js +314 -0
- package/lib/ObservedClient.d.ts +16 -8
- package/lib/ObservedClient.d.ts.map +1 -1
- package/lib/ObservedClient.js +257 -99
- package/lib/ObservedClientEventMonitor.d.ts +89 -0
- package/lib/ObservedClientEventMonitor.d.ts.map +1 -0
- package/lib/ObservedClientEventMonitor.js +247 -0
- package/lib/ObservedDataChannel.d.ts +2 -0
- package/lib/ObservedDataChannel.d.ts.map +1 -1
- package/lib/ObservedDataChannel.js +2 -0
- package/lib/ObservedIceCandidatePair.d.ts +2 -1
- package/lib/ObservedIceCandidatePair.d.ts.map +1 -1
- package/lib/ObservedIceCandidatePair.js +17 -1
- package/lib/ObservedInboundTrack.d.ts +2 -0
- package/lib/ObservedInboundTrack.d.ts.map +1 -1
- package/lib/ObservedInboundTrack.js +2 -0
- package/lib/ObservedOutboundTrack.d.ts +2 -0
- package/lib/ObservedOutboundTrack.d.ts.map +1 -1
- package/lib/ObservedOutboundTrack.js +2 -0
- package/lib/ObservedPeerConnection.d.ts.map +1 -1
- package/lib/ObservedPeerConnection.js +22 -6
- package/lib/Observer.d.ts +9 -7
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +16 -22
- package/lib/ObserverEventMonitor.d.ts +106 -0
- package/lib/ObserverEventMonitor.d.ts.map +1 -0
- package/lib/ObserverEventMonitor.js +320 -0
- package/lib/ObserverSummary.d.ts +2 -0
- package/lib/ObserverSummary.d.ts.map +1 -1
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/utils.d.ts.map +1 -1
- package/lib/common/utils.js +7 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -1
- package/lib/schema/ClientEventTypes.d.ts +60 -0
- package/lib/schema/ClientEventTypes.d.ts.map +1 -1
- package/lib/schema/ClientSample.d.ts +1 -1
- package/lib/schema/ClientSample.d.ts.map +1 -1
- package/lib/updaters/{OnAllCallObserverUpdater_.d.ts → OnAllCallObserverUpdater.d.ts} +3 -1
- package/lib/updaters/OnAllCallObserverUpdater.d.ts.map +1 -0
- package/lib/updaters/{OnAllCallObserverUpdater_.js → OnAllCallObserverUpdater.js} +13 -1
- package/lib/updaters/OnAllClientCallUpdater.d.ts +2 -0
- package/lib/updaters/OnAllClientCallUpdater.d.ts.map +1 -1
- package/lib/updaters/OnAllClientCallUpdater.js +16 -0
- package/lib/updaters/{OnAnyCallObserverUpdater_.d.ts → OnAnyCallObserverUpdater.d.ts} +2 -1
- package/lib/updaters/OnAnyCallObserverUpdater.d.ts.map +1 -0
- package/lib/updaters/{OnAnyCallObserverUpdater_.js → OnAnyCallObserverUpdater.js} +11 -1
- package/lib/updaters/OnAnyClientCallUpdater.d.ts +1 -0
- package/lib/updaters/OnAnyClientCallUpdater.d.ts.map +1 -1
- package/lib/updaters/OnAnyClientCallUpdater.js +11 -2
- package/lib/utils/MediasoupRemoteTrackResolver.d.ts +25 -0
- package/lib/utils/MediasoupRemoteTrackResolver.d.ts.map +1 -0
- package/lib/utils/MediasoupRemoteTrackResolver.js +110 -0
- package/package.json +1 -1
- package/src/ObservedCall.ts +56 -82
- package/src/ObservedCallEventMonitor.ts +392 -0
- package/src/ObservedClient.ts +335 -114
- package/src/ObservedClientEventMonitor.ts +301 -0
- package/src/ObservedDataChannel.ts +3 -0
- package/src/ObservedIceCandidatePair.ts +18 -2
- package/src/ObservedInboundTrack.ts +3 -0
- package/src/ObservedOutboundTrack.ts +3 -0
- package/src/ObservedPeerConnection.ts +25 -10
- package/src/Observer.ts +47 -29
- package/src/ObserverEventMonitor.ts +398 -0
- package/src/ObserverSummary.ts +3 -1
- package/src/common/utils.ts +6 -0
- package/src/index.ts +2 -0
- package/src/schema/ClientEventTypes.ts +64 -0
- package/src/schema/ClientSample.ts +1 -1
- package/src/updaters/{OnAllCallObserverUpdater_.ts → OnAllCallObserverUpdater.ts} +14 -1
- package/src/updaters/OnAllClientCallUpdater.ts +15 -0
- package/src/updaters/{OnAnyCallObserverUpdater_.ts → OnAnyCallObserverUpdater.ts} +11 -2
- package/src/updaters/OnAnyClientCallUpdater.ts +9 -2
- package/src/utils/MediasoupRemoteTrackResolver.ts +155 -0
- package/lib/updaters/OnAllCallObserverUpdater_.d.ts.map +0 -1
- package/lib/updaters/OnAnyCallObserverUpdater_.d.ts.map +0 -1
package/lib/ObservedClient.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { ObservedPeerConnection } from './ObservedPeerConnection';
|
|
4
|
-
import { ClientMetaData, ClientSample, ClientIssue, ExtensionStat } from './schema/ClientSample';
|
|
4
|
+
import { ClientEvent, ClientMetaData, ClientSample, ClientIssue, ExtensionStat } from './schema/ClientSample';
|
|
5
5
|
import * as MetaData from './schema/ClientMetaTypes';
|
|
6
6
|
import { ObservedCall } from './ObservedCall';
|
|
7
7
|
import { CalculatedScore } from './scores/CalculatedScore';
|
|
8
8
|
import { Detectors } from './detectors/Detectors';
|
|
9
|
-
import { ObservedClientSummary } from './ObservedClientSummary';
|
|
10
9
|
export type ObservedClientSettings<AppData extends Record<string, unknown> = Record<string, unknown>> = {
|
|
11
10
|
clientId: string;
|
|
12
11
|
appData?: AppData;
|
|
@@ -26,6 +25,8 @@ export type ObservedClientEvents = {
|
|
|
26
25
|
left: [];
|
|
27
26
|
usingturn: [boolean];
|
|
28
27
|
usermediaerror: [string];
|
|
28
|
+
extensionStats: [ExtensionStat];
|
|
29
|
+
clientEvent: [ClientEvent];
|
|
29
30
|
newpeerconnection: [ObservedPeerConnection];
|
|
30
31
|
};
|
|
31
32
|
export declare interface ObservedClient {
|
|
@@ -47,12 +48,14 @@ export declare class ObservedClient<AppData extends Record<string, unknown> = Re
|
|
|
47
48
|
closed: boolean;
|
|
48
49
|
joinedAt?: number;
|
|
49
50
|
leftAt?: number;
|
|
51
|
+
closedAt?: number;
|
|
50
52
|
operationSystem?: MetaData.OperationSystem;
|
|
51
53
|
engine?: MetaData.Engine;
|
|
52
54
|
platform?: MetaData.Platform;
|
|
53
55
|
browser?: MetaData.Browser;
|
|
54
56
|
mediaConstraints: string[];
|
|
55
57
|
usingTURN: boolean;
|
|
58
|
+
usingTCP: boolean;
|
|
56
59
|
availableOutgoingBitrate: number;
|
|
57
60
|
availableIncomingBitrate: number;
|
|
58
61
|
totalInboundPacketsLost: number;
|
|
@@ -79,14 +82,15 @@ export declare class ObservedClient<AppData extends Record<string, unknown> = Re
|
|
|
79
82
|
deltaInboundPacketsLost: number;
|
|
80
83
|
deltaInboundPacketsReceived: number;
|
|
81
84
|
deltaOutboundPacketsSent: number;
|
|
82
|
-
deltaRttInMsMeasurements: number[];
|
|
83
85
|
deltaTransportSentBytes: number;
|
|
84
86
|
deltaTransportReceivedBytes: number;
|
|
85
87
|
deltaRttLt50Measurements: number;
|
|
86
88
|
deltaRttLt150Measurements: number;
|
|
87
89
|
deltaRttLt300Measurements: number;
|
|
88
90
|
deltaRttGtOrEq300Measurements: number;
|
|
89
|
-
|
|
91
|
+
currentMaxRttInMs?: number;
|
|
92
|
+
currentMinRttInMs?: number;
|
|
93
|
+
currentAvgRttInMs?: number;
|
|
90
94
|
sendingAudioBitrate: number;
|
|
91
95
|
sendingVideoBitrate: number;
|
|
92
96
|
receivingAudioBitrate: number;
|
|
@@ -103,21 +107,25 @@ export declare class ObservedClient<AppData extends Record<string, unknown> = Re
|
|
|
103
107
|
deltaNumberOfIssues: number;
|
|
104
108
|
totalScoreSum: number;
|
|
105
109
|
numberOfScoreMeasurements: number;
|
|
106
|
-
|
|
110
|
+
totalNumberOfIssues: number;
|
|
107
111
|
readonly mediaDevices: MetaData.MediaDeviceInfo[];
|
|
108
112
|
issues: ClientIssue[];
|
|
113
|
+
private _injections;
|
|
109
114
|
constructor(settings: ObservedClientSettings<AppData>, call: ObservedCall);
|
|
110
115
|
get numberOfPeerConnections(): number;
|
|
111
116
|
get score(): number | undefined;
|
|
112
117
|
close(): void;
|
|
113
118
|
accept(sample: ClientSample): void;
|
|
114
119
|
private _processClientEvent;
|
|
120
|
+
injectMetaData(metaData: ClientMetaData): void;
|
|
121
|
+
injectEvent(event: ClientEvent): void;
|
|
122
|
+
injectIssue(issue: ClientIssue): void;
|
|
123
|
+
injectExtensionStat(stat: ExtensionStat): void;
|
|
124
|
+
injectAttachment(key: string, value: unknown): void;
|
|
115
125
|
addMetadata(metadata: ClientMetaData): void;
|
|
116
126
|
addIssue(issue: ClientIssue): void;
|
|
117
127
|
addExtensionStats(stats: ExtensionStat): void;
|
|
118
128
|
private _updatePeerConnection;
|
|
119
|
-
|
|
120
|
-
createSummary(): ObservedClientSummary;
|
|
121
|
-
private _updateRttMeasurements;
|
|
129
|
+
private _mergeInjections;
|
|
122
130
|
}
|
|
123
131
|
//# sourceMappingURL=ObservedClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservedClient.d.ts","sourceRoot":"","sources":["../src/ObservedClient.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,
|
|
1
|
+
{"version":3,"file":"ObservedClient.d.ts","sourceRoot":"","sources":["../src/ObservedClient.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAE,WAAW,EAAE,c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,aAAa,SAAK;IAClB,yBAAyB,SAAK;IAC9B,mBAAmB,SAAK;IAE/B,SAAgB,YAAY,EAAE,QAAQ,CAAC,eAAe,EAAE,CAAM;IACvD,MAAM,EAAE,WAAW,EAAE,CAAM;IAElC,OAAO,CAAC,WAAW,CAAkH;gBAElH,QAAQ,EAAE,sBAAsB,CAAC,OAAO,CAAC,EAAkB,IAAI,EAAE,YAAY;IAUhG,IAAW,uBAAuB,WAEjC;IAED,IAAW,KAAK,uBAEf;IAEM,KAAK;IAWL,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IA4KzC,OAAO,CAAC,mBAAmB;IAsIpB,cAAc,CAAC,QAAQ,EAAE,cAAc;IAQvC,WAAW,CAAC,KAAK,EAAE,WAAW;IAQ9B,WAAW,CAAC,KAAK,EAAE,WAAW;IAQ9B,mBAAmB,CAAC,IAAI,EAAE,aAAa;IAQvC,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;IAS5C,WAAW,CAAC,QAAQ,EAAE,cAAc;IAyBpC,QAAQ,CAAC,KAAK,EAAE,WAAW;IAO3B,iBAAiB,CAAC,KAAK,EAAE,aAAa;IAK7C,OAAO,CAAC,qBAAqB;IA0B7B,OAAO,CAAC,gBAAgB;CAwFxB"}
|
package/lib/ObservedClient.js
CHANGED
|
@@ -25,6 +25,7 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
25
25
|
closed = false;
|
|
26
26
|
joinedAt;
|
|
27
27
|
leftAt;
|
|
28
|
+
closedAt;
|
|
28
29
|
// the timestamp of the CLIENT_JOINED event
|
|
29
30
|
operationSystem;
|
|
30
31
|
engine;
|
|
@@ -32,6 +33,7 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
32
33
|
browser;
|
|
33
34
|
mediaConstraints = [];
|
|
34
35
|
usingTURN = false;
|
|
36
|
+
usingTCP = false;
|
|
35
37
|
availableOutgoingBitrate = 0;
|
|
36
38
|
availableIncomingBitrate = 0;
|
|
37
39
|
totalInboundPacketsLost = 0;
|
|
@@ -58,14 +60,15 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
58
60
|
deltaInboundPacketsLost = 0;
|
|
59
61
|
deltaInboundPacketsReceived = 0;
|
|
60
62
|
deltaOutboundPacketsSent = 0;
|
|
61
|
-
deltaRttInMsMeasurements = [];
|
|
62
63
|
deltaTransportSentBytes = 0;
|
|
63
64
|
deltaTransportReceivedBytes = 0;
|
|
64
65
|
deltaRttLt50Measurements = 0;
|
|
65
66
|
deltaRttLt150Measurements = 0;
|
|
66
67
|
deltaRttLt300Measurements = 0;
|
|
67
68
|
deltaRttGtOrEq300Measurements = 0;
|
|
68
|
-
|
|
69
|
+
currentMaxRttInMs;
|
|
70
|
+
currentMinRttInMs;
|
|
71
|
+
currentAvgRttInMs;
|
|
69
72
|
sendingAudioBitrate = 0;
|
|
70
73
|
sendingVideoBitrate = 0;
|
|
71
74
|
receivingAudioBitrate = 0;
|
|
@@ -82,9 +85,10 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
82
85
|
deltaNumberOfIssues = 0;
|
|
83
86
|
totalScoreSum = 0;
|
|
84
87
|
numberOfScoreMeasurements = 0;
|
|
85
|
-
|
|
88
|
+
totalNumberOfIssues = 0;
|
|
86
89
|
mediaDevices = [];
|
|
87
90
|
issues = [];
|
|
91
|
+
_injections = {};
|
|
88
92
|
constructor(settings, call) {
|
|
89
93
|
super();
|
|
90
94
|
this.call = call;
|
|
@@ -104,6 +108,7 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
104
108
|
return;
|
|
105
109
|
this.closed = true;
|
|
106
110
|
Array.from(this.observedPeerConnections.values()).forEach((peerConnection) => peerConnection.close());
|
|
111
|
+
this.closedAt = Date.now();
|
|
107
112
|
this.emit('close');
|
|
108
113
|
}
|
|
109
114
|
accept(sample) {
|
|
@@ -112,6 +117,8 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
112
117
|
const now = Date.now();
|
|
113
118
|
const elapsedInMs = now - this.updated;
|
|
114
119
|
const elapsedInSeconds = elapsedInMs / 1000;
|
|
120
|
+
let sumOfRtts = 0;
|
|
121
|
+
let numberOfRttMeasurements = 0;
|
|
115
122
|
++this.acceptedSamples;
|
|
116
123
|
this.availableIncomingBitrate = 0;
|
|
117
124
|
this.availableOutgoingBitrate = 0;
|
|
@@ -128,7 +135,6 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
128
135
|
this.deltaSentVideoBytes = 0;
|
|
129
136
|
this.deltaTransportReceivedBytes = 0;
|
|
130
137
|
this.deltaTransportSentBytes = 0;
|
|
131
|
-
this.deltaRttInMsMeasurements = [];
|
|
132
138
|
this.deltaRttLt50Measurements = 0;
|
|
133
139
|
this.deltaRttLt150Measurements = 0;
|
|
134
140
|
this.deltaRttLt300Measurements = 0;
|
|
@@ -139,12 +145,82 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
139
145
|
this.numberOfInbundTracks = 0;
|
|
140
146
|
this.numberOfOutboundRtpStreams = 0;
|
|
141
147
|
this.numberOfOutboundTracks = 0;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
+
this.usingTURN = false;
|
|
149
|
+
this.usingTCP = false;
|
|
150
|
+
this.currentMinRttInMs = undefined;
|
|
151
|
+
this.currentMaxRttInMs = undefined;
|
|
152
|
+
this._mergeInjections(sample);
|
|
153
|
+
const clientEventsPostBuffer = [];
|
|
154
|
+
for (const clientEvent of sample.clientEvents ?? []) {
|
|
155
|
+
this._processClientEvent(clientEvent, clientEventsPostBuffer);
|
|
156
|
+
this.call.observer.emit('client-event', this, clientEvent);
|
|
157
|
+
}
|
|
158
|
+
for (const metaData of sample.clientMetaItems ?? []) {
|
|
159
|
+
this.addMetadata(metaData);
|
|
160
|
+
}
|
|
161
|
+
for (const issue of sample.clientIssues ?? []) {
|
|
162
|
+
this.addIssue(issue);
|
|
163
|
+
++this.deltaNumberOfIssues;
|
|
164
|
+
}
|
|
165
|
+
for (const extensionStat of sample.extensionStats ?? []) {
|
|
166
|
+
this.addExtensionStats(extensionStat);
|
|
167
|
+
}
|
|
168
|
+
for (const pcSample of sample.peerConnections ?? []) {
|
|
169
|
+
const observedPeerConnection = this._updatePeerConnection(pcSample);
|
|
170
|
+
if (!observedPeerConnection)
|
|
171
|
+
continue;
|
|
172
|
+
this.deltaDataChannelBytesReceived += observedPeerConnection.deltaDataChannelBytesReceived;
|
|
173
|
+
this.deltaDataChannelBytesSent += observedPeerConnection.deltaDataChannelBytesSent;
|
|
174
|
+
this.deltaDataChannelMessagesReceived += observedPeerConnection.deltaDataChannelMessagesReceived;
|
|
175
|
+
this.deltaDataChannelMessagesSent += observedPeerConnection.deltaDataChannelMessagesSent;
|
|
176
|
+
this.deltaInboundPacketsLost += observedPeerConnection.deltaInboundPacketsLost;
|
|
177
|
+
this.deltaInboundPacketsReceived += observedPeerConnection.deltaInboundPacketsReceived;
|
|
178
|
+
this.deltaOutboundPacketsSent += observedPeerConnection.deltaOutboundPacketsSent;
|
|
179
|
+
this.deltaReceivedAudioBytes += observedPeerConnection.deltaReceivedAudioBytes;
|
|
180
|
+
this.deltaReceivedVideoBytes += observedPeerConnection.deltaReceivedVideoBytes;
|
|
181
|
+
this.deltaSentAudioBytes += observedPeerConnection.deltaSentAudioBytes;
|
|
182
|
+
this.deltaSentVideoBytes += observedPeerConnection.deltaSentVideoBytes;
|
|
183
|
+
this.deltaTransportReceivedBytes += observedPeerConnection.deltaTransportReceivedBytes;
|
|
184
|
+
this.deltaTransportSentBytes += observedPeerConnection.deltaTransportSentBytes;
|
|
185
|
+
this.availableIncomingBitrate += observedPeerConnection.availableIncomingBitrate;
|
|
186
|
+
this.availableOutgoingBitrate += observedPeerConnection.availableOutgoingBitrate;
|
|
187
|
+
this.numberOfDataChannels += observedPeerConnection.observedDataChannels.size;
|
|
188
|
+
this.numberOfInbundTracks += observedPeerConnection.observedInboundTracks.size;
|
|
189
|
+
this.numberOfOutboundRtpStreams += observedPeerConnection.observedOutboundRtps.size;
|
|
190
|
+
this.numberOfOutboundTracks += observedPeerConnection.observedOutboundTracks.size;
|
|
191
|
+
this.numberOfInboundRtpStreams += observedPeerConnection.observedInboundRtps.size;
|
|
192
|
+
if (observedPeerConnection.usingTURN) {
|
|
193
|
+
this.usingTURN = true;
|
|
194
|
+
}
|
|
195
|
+
if (observedPeerConnection.usingTCP) {
|
|
196
|
+
this.usingTCP = true;
|
|
197
|
+
}
|
|
198
|
+
if (observedPeerConnection.currentRttInMs) {
|
|
199
|
+
if (this.currentMinRttInMs === undefined || observedPeerConnection.currentRttInMs < this.currentMinRttInMs) {
|
|
200
|
+
this.currentMinRttInMs = observedPeerConnection.currentRttInMs;
|
|
201
|
+
}
|
|
202
|
+
if (this.currentMaxRttInMs === undefined || observedPeerConnection.currentRttInMs > this.currentMaxRttInMs) {
|
|
203
|
+
this.currentMaxRttInMs = observedPeerConnection.currentRttInMs;
|
|
204
|
+
}
|
|
205
|
+
if (observedPeerConnection.currentRttInMs < 50) {
|
|
206
|
+
this.deltaRttLt50Measurements += 1;
|
|
207
|
+
}
|
|
208
|
+
else if (observedPeerConnection.currentRttInMs < 150) {
|
|
209
|
+
this.deltaRttLt150Measurements += 1;
|
|
210
|
+
}
|
|
211
|
+
else if (observedPeerConnection.currentRttInMs < 300) {
|
|
212
|
+
this.deltaRttLt300Measurements += 1;
|
|
213
|
+
}
|
|
214
|
+
else if (300 <= observedPeerConnection.currentRttInMs) {
|
|
215
|
+
this.deltaRttGtOrEq300Measurements += 1;
|
|
216
|
+
}
|
|
217
|
+
sumOfRtts += observedPeerConnection.currentRttInMs;
|
|
218
|
+
++numberOfRttMeasurements;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
for (const clientEvent of clientEventsPostBuffer) {
|
|
222
|
+
this._processClientEvent(clientEvent);
|
|
223
|
+
}
|
|
148
224
|
// emit new attachments?
|
|
149
225
|
this.attachments = sample.attachments;
|
|
150
226
|
this.totalDataChannelBytesReceived += this.deltaDataChannelBytesReceived;
|
|
@@ -164,11 +240,12 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
164
240
|
this.totalRttLt150Measurements += this.deltaRttLt150Measurements;
|
|
165
241
|
this.totalRttLt300Measurements += this.deltaRttLt300Measurements;
|
|
166
242
|
this.totalRttGtOrEq300Measurements += this.deltaRttGtOrEq300Measurements;
|
|
167
|
-
this.
|
|
243
|
+
this.totalNumberOfIssues += this.deltaNumberOfIssues;
|
|
168
244
|
this.receivingAudioBitrate = (this.deltaReceivedAudioBytes * 8) / (elapsedInSeconds);
|
|
169
245
|
this.receivingVideoBitrate = (this.totalReceivedVideoBytes * 8) / (elapsedInSeconds);
|
|
170
246
|
this.sendingAudioBitrate = (this.deltaSentAudioBytes * 8) / (elapsedInSeconds);
|
|
171
247
|
this.sendingVideoBitrate = (this.deltaSentVideoBytes * 8) / (elapsedInSeconds);
|
|
248
|
+
this.currentAvgRttInMs = 0 < numberOfRttMeasurements ? sumOfRtts / numberOfRttMeasurements : undefined;
|
|
172
249
|
this.calculatedScore.value = sample.score;
|
|
173
250
|
this.detectors.update();
|
|
174
251
|
// emit update
|
|
@@ -183,7 +260,7 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
183
260
|
++this.numberOfScoreMeasurements;
|
|
184
261
|
}
|
|
185
262
|
}
|
|
186
|
-
_processClientEvent(event) {
|
|
263
|
+
_processClientEvent(event, postBuffer) {
|
|
187
264
|
// eslint-disable-next-line no-console
|
|
188
265
|
// console.warn('ClientEvent', event);
|
|
189
266
|
switch (event.type) {
|
|
@@ -215,8 +292,143 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
215
292
|
}
|
|
216
293
|
break;
|
|
217
294
|
}
|
|
295
|
+
case ClientEventTypes_1.ClientEventTypes.PEER_CONNECTION_OPENED: {
|
|
296
|
+
const payload = (0, utils_1.parseJsonAs)(event.payload);
|
|
297
|
+
if (payload?.peerConnectionId && typeof payload.peerConnectionId === 'string') {
|
|
298
|
+
const observedPeerConnection = this.observedPeerConnections.get(payload.peerConnectionId);
|
|
299
|
+
if (observedPeerConnection) {
|
|
300
|
+
observedPeerConnection.openedAt = event.timestamp;
|
|
301
|
+
}
|
|
302
|
+
else if (postBuffer) {
|
|
303
|
+
postBuffer.push(event);
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
logger.warn('Received PEER_CONNECTION_OPENED event without a corresponding observedPeerConnection', event);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
case ClientEventTypes_1.ClientEventTypes.PEER_CONNECTION_CLOSED: {
|
|
312
|
+
const payload = (0, utils_1.parseJsonAs)(event.payload);
|
|
313
|
+
if (payload?.peerConnectionId && typeof payload.peerConnectionId === 'string') {
|
|
314
|
+
const observedPeerConnection = this.observedPeerConnections.get(payload.peerConnectionId);
|
|
315
|
+
if (observedPeerConnection) {
|
|
316
|
+
observedPeerConnection.closedAt = event.timestamp;
|
|
317
|
+
}
|
|
318
|
+
else if (postBuffer) {
|
|
319
|
+
postBuffer.push(event);
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
logger.warn('Received PEER_CONNECTION_CLOSED event without a corresponding observedPeerConnection', event);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
case ClientEventTypes_1.ClientEventTypes.MEDIA_TRACK_ADDED: {
|
|
328
|
+
const payload = (0, utils_1.parseJsonAs)(event.payload);
|
|
329
|
+
if (payload?.peerConnectionId && typeof payload.peerConnectionId === 'string' && payload?.trackId && typeof payload.trackId === 'string') {
|
|
330
|
+
const observedPeerConnection = this.observedPeerConnections.get(payload.peerConnectionId);
|
|
331
|
+
const observedTrack = observedPeerConnection?.observedInboundTracks.get(payload.trackId) ?? observedPeerConnection?.observedOutboundTracks.get(payload.trackId);
|
|
332
|
+
if (observedTrack) {
|
|
333
|
+
observedTrack.addedAt = event.timestamp;
|
|
334
|
+
}
|
|
335
|
+
else if (postBuffer) {
|
|
336
|
+
postBuffer.push(event);
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
logger.warn('Received MEDIA_TRACK_ADDED event without a corresponding observedPeerConnection or observedTrack', event);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
case ClientEventTypes_1.ClientEventTypes.MEDIA_TRACK_REMOVED: {
|
|
345
|
+
const payload = (0, utils_1.parseJsonAs)(event.payload);
|
|
346
|
+
if (payload?.peerConnectionId && typeof payload.peerConnectionId === 'string' && payload?.trackId && typeof payload.trackId === 'string') {
|
|
347
|
+
const observedPeerConnection = this.observedPeerConnections.get(payload.peerConnectionId);
|
|
348
|
+
const observedTrack = observedPeerConnection?.observedInboundTracks.get(payload.trackId) ?? observedPeerConnection?.observedOutboundTracks.get(payload.trackId);
|
|
349
|
+
if (observedTrack) {
|
|
350
|
+
observedTrack.removedAt = event.timestamp;
|
|
351
|
+
}
|
|
352
|
+
else if (postBuffer) {
|
|
353
|
+
postBuffer.push(event);
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
logger.warn('Received MEDIA_TRACK_REMOVED event without a corresponding observedPeerConnection or observedTrack', event);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
break;
|
|
360
|
+
}
|
|
361
|
+
case ClientEventTypes_1.ClientEventTypes.DATA_CHANNEL_OPEN: {
|
|
362
|
+
const payload = (0, utils_1.parseJsonAs)(event.payload);
|
|
363
|
+
if (payload?.peerConnectionId && typeof payload.peerConnectionId === 'string' && payload?.dataChannelId && typeof payload.dataChannelId === 'string') {
|
|
364
|
+
const observedPeerConnection = this.observedPeerConnections.get(payload.peerConnectionId);
|
|
365
|
+
const observedDataChannel = observedPeerConnection?.observedDataChannels.get(payload.dataChannelId);
|
|
366
|
+
if (observedDataChannel) {
|
|
367
|
+
observedDataChannel.addedAt = event.timestamp;
|
|
368
|
+
}
|
|
369
|
+
else if (postBuffer) {
|
|
370
|
+
postBuffer.push(event);
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
logger.warn('Received DATA_CHANNEL_OPENED event without a corresponding observedPeerConnection or observedDataChannel', event);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
break;
|
|
377
|
+
}
|
|
378
|
+
case ClientEventTypes_1.ClientEventTypes.DATA_CHANNEL_CLOSED: {
|
|
379
|
+
const payload = (0, utils_1.parseJsonAs)(event.payload);
|
|
380
|
+
if (payload?.peerConnectionId && typeof payload.peerConnectionId === 'string' && payload?.dataChannelId && typeof payload.dataChannelId === 'string') {
|
|
381
|
+
const observedPeerConnection = this.observedPeerConnections.get(payload.peerConnectionId);
|
|
382
|
+
const observedDataChannel = observedPeerConnection?.observedDataChannels.get(payload.dataChannelId);
|
|
383
|
+
if (observedDataChannel) {
|
|
384
|
+
observedDataChannel.removedAt = event.timestamp;
|
|
385
|
+
}
|
|
386
|
+
else if (postBuffer) {
|
|
387
|
+
postBuffer.push(event);
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
logger.warn('Received DATA_CHANNEL_CLOSE event without a corresponding observedPeerConnection or observedDataChannel', event);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
break;
|
|
394
|
+
}
|
|
218
395
|
}
|
|
219
|
-
this.
|
|
396
|
+
this.emit('clientEvent', event);
|
|
397
|
+
}
|
|
398
|
+
injectMetaData(metaData) {
|
|
399
|
+
if (this.closed)
|
|
400
|
+
return;
|
|
401
|
+
if (!this._injections.clientMetaItems)
|
|
402
|
+
this._injections.clientMetaItems = [];
|
|
403
|
+
this._injections.clientMetaItems.push(metaData);
|
|
404
|
+
}
|
|
405
|
+
injectEvent(event) {
|
|
406
|
+
if (this.closed)
|
|
407
|
+
return;
|
|
408
|
+
if (!this._injections.clientEvents)
|
|
409
|
+
this._injections.clientEvents = [];
|
|
410
|
+
this._injections.clientEvents.push(event);
|
|
411
|
+
}
|
|
412
|
+
injectIssue(issue) {
|
|
413
|
+
if (this.closed)
|
|
414
|
+
return;
|
|
415
|
+
if (!this._injections.clientIssues)
|
|
416
|
+
this._injections.clientIssues = [];
|
|
417
|
+
this._injections.clientIssues.push(issue);
|
|
418
|
+
}
|
|
419
|
+
injectExtensionStat(stat) {
|
|
420
|
+
if (this.closed)
|
|
421
|
+
return;
|
|
422
|
+
if (!this._injections.extensionStats)
|
|
423
|
+
this._injections.extensionStats = [];
|
|
424
|
+
this._injections.extensionStats.push(stat);
|
|
425
|
+
}
|
|
426
|
+
injectAttachment(key, value) {
|
|
427
|
+
if (this.closed)
|
|
428
|
+
return;
|
|
429
|
+
if (!this._injections.attachments)
|
|
430
|
+
this._injections.attachments = {};
|
|
431
|
+
this._injections.attachments[key] = value;
|
|
220
432
|
}
|
|
221
433
|
addMetadata(metadata) {
|
|
222
434
|
if (this.closed)
|
|
@@ -244,18 +456,18 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
244
456
|
addIssue(issue) {
|
|
245
457
|
if (this.closed)
|
|
246
458
|
return;
|
|
247
|
-
++this.deltaNumberOfIssues;
|
|
248
459
|
this.emit('issue', issue);
|
|
249
460
|
this.call.observer.emit('client-issue', this, issue);
|
|
250
461
|
}
|
|
251
462
|
addExtensionStats(stats) {
|
|
252
463
|
this.call.observer.emit('client-extension-stats', this, stats);
|
|
464
|
+
this.emit('extensionStats', stats);
|
|
253
465
|
}
|
|
254
466
|
_updatePeerConnection(sample) {
|
|
255
467
|
let observedPeerConnection = this.observedPeerConnections.get(sample.peerConnectionId);
|
|
256
468
|
if (!observedPeerConnection) {
|
|
257
469
|
if (!sample.peerConnectionId) {
|
|
258
|
-
return logger.warn(`ObservedClient received an invalid PeerConnectionSample (missing peerConnectionId field). ClientId: ${this.clientId}, CallId: ${this.call.callId}`, sample);
|
|
470
|
+
return (logger.warn(`ObservedClient received an invalid PeerConnectionSample (missing peerConnectionId field). ClientId: ${this.clientId}, CallId: ${this.call.callId}`, sample), void 0);
|
|
259
471
|
}
|
|
260
472
|
observedPeerConnection = new ObservedPeerConnection_1.ObservedPeerConnection(sample.peerConnectionId, this);
|
|
261
473
|
observedPeerConnection.once('close', () => {
|
|
@@ -265,96 +477,42 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
265
477
|
this.emit('newpeerconnection', observedPeerConnection);
|
|
266
478
|
}
|
|
267
479
|
observedPeerConnection.accept(sample);
|
|
268
|
-
observedPeerConnection
|
|
269
|
-
this.deltaDataChannelBytesReceived += observedPeerConnection.deltaDataChannelBytesReceived;
|
|
270
|
-
this.deltaDataChannelBytesSent += observedPeerConnection.deltaDataChannelBytesSent;
|
|
271
|
-
this.deltaDataChannelMessagesReceived += observedPeerConnection.deltaDataChannelMessagesReceived;
|
|
272
|
-
this.deltaDataChannelMessagesSent += observedPeerConnection.deltaDataChannelMessagesSent;
|
|
273
|
-
this.deltaInboundPacketsLost += observedPeerConnection.deltaInboundPacketsLost;
|
|
274
|
-
this.deltaInboundPacketsReceived += observedPeerConnection.deltaInboundPacketsReceived;
|
|
275
|
-
this.deltaOutboundPacketsSent += observedPeerConnection.deltaOutboundPacketsSent;
|
|
276
|
-
this.deltaReceivedAudioBytes += observedPeerConnection.deltaReceivedAudioBytes;
|
|
277
|
-
this.deltaReceivedVideoBytes += observedPeerConnection.deltaReceivedVideoBytes;
|
|
278
|
-
this.deltaSentAudioBytes += observedPeerConnection.deltaSentAudioBytes;
|
|
279
|
-
this.deltaSentVideoBytes += observedPeerConnection.deltaSentVideoBytes;
|
|
280
|
-
this.deltaTransportReceivedBytes += observedPeerConnection.deltaTransportReceivedBytes;
|
|
281
|
-
this.deltaTransportSentBytes += observedPeerConnection.deltaTransportSentBytes;
|
|
282
|
-
this.availableIncomingBitrate += observedPeerConnection.availableIncomingBitrate;
|
|
283
|
-
this.availableOutgoingBitrate += observedPeerConnection.availableOutgoingBitrate;
|
|
284
|
-
this.numberOfDataChannels += observedPeerConnection.observedDataChannels.size;
|
|
285
|
-
this.numberOfInbundTracks += observedPeerConnection.observedInboundTracks.size;
|
|
286
|
-
this.numberOfOutboundRtpStreams += observedPeerConnection.observedOutboundRtps.size;
|
|
287
|
-
this.numberOfOutboundTracks += observedPeerConnection.observedOutboundTracks.size;
|
|
288
|
-
this.numberOfInboundRtpStreams += observedPeerConnection.observedInboundRtps.size;
|
|
289
|
-
if (observedPeerConnection.currentRttInMs) {
|
|
290
|
-
this.deltaRttInMsMeasurements.push(observedPeerConnection.currentRttInMs);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
resetSummaryMetrics() {
|
|
294
|
-
this.totalDataChannelBytesReceived = 0;
|
|
295
|
-
this.totalDataChannelBytesSent = 0;
|
|
296
|
-
this.totalDataChannelMessagesReceived = 0;
|
|
297
|
-
this.totalDataChannelMessagesSent = 0;
|
|
298
|
-
this.totalInboundPacketsLost = 0;
|
|
299
|
-
this.totalInboundPacketsReceived = 0;
|
|
300
|
-
this.totalOutboundPacketsSent = 0;
|
|
301
|
-
this.totalReceivedAudioBytes = 0;
|
|
302
|
-
this.totalReceivedVideoBytes = 0;
|
|
303
|
-
this.totalSentAudioBytes = 0;
|
|
304
|
-
this.totalSentVideoBytes = 0;
|
|
305
|
-
this.totalSentBytes = 0;
|
|
306
|
-
this.totalReceivedBytes = 0;
|
|
307
|
-
this.numberOfIssues = 0;
|
|
308
|
-
this.totalScoreSum = 0;
|
|
309
|
-
this.numberOfScoreMeasurements = 0;
|
|
310
|
-
}
|
|
311
|
-
createSummary() {
|
|
312
|
-
return {
|
|
313
|
-
totalRttLt50Measurements: this.totalRttLt50Measurements,
|
|
314
|
-
totalRttLt150Measurements: this.totalRttLt150Measurements,
|
|
315
|
-
totalRttLt300Measurements: this.totalRttLt300Measurements,
|
|
316
|
-
totalRttGtOrEq300Measurements: this.totalRttGtOrEq300Measurements,
|
|
317
|
-
totalDataChannelBytesReceived: this.totalDataChannelBytesReceived,
|
|
318
|
-
totalDataChannelBytesSent: this.totalDataChannelBytesSent,
|
|
319
|
-
totalDataChannelMessagesReceived: this.totalDataChannelMessagesReceived,
|
|
320
|
-
totalDataChannelMessagesSent: this.totalDataChannelMessagesSent,
|
|
321
|
-
totalInboundPacketsLost: this.totalInboundPacketsLost,
|
|
322
|
-
totalInboundPacketsReceived: this.totalInboundPacketsReceived,
|
|
323
|
-
totalOutboundPacketsSent: this.totalOutboundPacketsSent,
|
|
324
|
-
totalReceivedAudioBytes: this.totalReceivedAudioBytes,
|
|
325
|
-
totalReceivedVideoBytes: this.totalReceivedVideoBytes,
|
|
326
|
-
totalSentAudioBytes: this.totalSentAudioBytes,
|
|
327
|
-
totalSentVideoBytes: this.totalSentVideoBytes,
|
|
328
|
-
totalSentBytes: this.totalSentBytes,
|
|
329
|
-
totalReceivedBytes: this.totalReceivedBytes,
|
|
330
|
-
numberOfIssues: this.numberOfIssues,
|
|
331
|
-
totalScoreSum: this.totalScoreSum,
|
|
332
|
-
numberOfScoreMeasurements: this.numberOfScoreMeasurements,
|
|
333
|
-
};
|
|
480
|
+
return observedPeerConnection;
|
|
334
481
|
}
|
|
335
|
-
|
|
336
|
-
if (this.
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
this.currentRttInMs = undefined;
|
|
344
|
-
return;
|
|
482
|
+
_mergeInjections(sample) {
|
|
483
|
+
if (this.closed)
|
|
484
|
+
return sample;
|
|
485
|
+
if (this._injections.clientEvents) {
|
|
486
|
+
if (!sample.clientEvents)
|
|
487
|
+
sample.clientEvents = [];
|
|
488
|
+
sample.clientEvents.push(...this._injections.clientEvents);
|
|
489
|
+
this._injections.clientEvents = undefined;
|
|
345
490
|
}
|
|
346
|
-
if (this.
|
|
347
|
-
|
|
491
|
+
if (this._injections.clientIssues) {
|
|
492
|
+
if (!sample.clientIssues)
|
|
493
|
+
sample.clientIssues = [];
|
|
494
|
+
sample.clientIssues.push(...this._injections.clientIssues);
|
|
495
|
+
this._injections.clientIssues = undefined;
|
|
348
496
|
}
|
|
349
|
-
|
|
350
|
-
|
|
497
|
+
if (this._injections.extensionStats) {
|
|
498
|
+
if (!sample.extensionStats)
|
|
499
|
+
sample.extensionStats = [];
|
|
500
|
+
sample.extensionStats.push(...this._injections.extensionStats);
|
|
501
|
+
this._injections.extensionStats = undefined;
|
|
351
502
|
}
|
|
352
|
-
|
|
353
|
-
|
|
503
|
+
if (this._injections.attachments) {
|
|
504
|
+
if (!sample.attachments)
|
|
505
|
+
sample.attachments = {};
|
|
506
|
+
Object.assign(sample.attachments, this._injections.attachments);
|
|
507
|
+
this._injections.attachments = undefined;
|
|
354
508
|
}
|
|
355
|
-
|
|
356
|
-
|
|
509
|
+
if (this._injections.clientMetaItems) {
|
|
510
|
+
if (!sample.clientMetaItems)
|
|
511
|
+
sample.clientMetaItems = [];
|
|
512
|
+
sample.clientMetaItems.push(...this._injections.clientMetaItems);
|
|
513
|
+
this._injections.clientMetaItems = undefined;
|
|
357
514
|
}
|
|
515
|
+
return sample;
|
|
358
516
|
}
|
|
359
517
|
}
|
|
360
518
|
exports.ObservedClient = ObservedClient;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ObservedCertificate } from './ObservedCertificate';
|
|
2
|
+
import { ObservedClient } from './ObservedClient';
|
|
3
|
+
import { ObservedCodec } from './ObservedCodec';
|
|
4
|
+
import { ObservedDataChannel } from './ObservedDataChannel';
|
|
5
|
+
import { ObservedIceCandidate } from './ObservedIceCandidate';
|
|
6
|
+
import { ObservedIceCandidatePair } from './ObservedIceCandidatePair';
|
|
7
|
+
import { ObservedIceTransport } from './ObservedIceTransport';
|
|
8
|
+
import { ObservedInboundRtp } from './ObservedInboundRtp';
|
|
9
|
+
import { ObservedInboundTrack } from './ObservedInboundTrack';
|
|
10
|
+
import { ObservedMediaPlayout } from './ObservedMediaPlayout';
|
|
11
|
+
import { ObservedMediaSource } from './ObservedMediaSource';
|
|
12
|
+
import { ObservedOutboundRtp } from './ObservedOutboundRtp';
|
|
13
|
+
import { ObservedOutboundTrack } from './ObservedOutboundTrack';
|
|
14
|
+
import { ObservedPeerConnection } from './ObservedPeerConnection';
|
|
15
|
+
import { ClientIssue, ClientMetaData, ExtensionStat } from './schema/ClientSample';
|
|
16
|
+
export declare class ObservedClientEventMonitor<Context> {
|
|
17
|
+
readonly observedClient: ObservedClient;
|
|
18
|
+
readonly context: Context;
|
|
19
|
+
constructor(observedClient: ObservedClient, context: Context);
|
|
20
|
+
onClientClosed?: (client: ObservedClient, ctx: Context) => void;
|
|
21
|
+
private _onClientClosed;
|
|
22
|
+
onPeerConnectionAdded?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
|
|
23
|
+
private _onPeerConnconnectionAdded;
|
|
24
|
+
onPeerConnectionRemoved?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
|
|
25
|
+
private _onPeerConnectionRemoved;
|
|
26
|
+
onCertificateAdded?: (certificate: ObservedCertificate, ctx: Context) => void;
|
|
27
|
+
private _onCertificateAdded;
|
|
28
|
+
onCertificateRemoved?: (certificate: ObservedCertificate, ctx: Context) => void;
|
|
29
|
+
private _onCertificateRemoved;
|
|
30
|
+
onInboundTrackAdded?: (inboundTrack: ObservedInboundTrack, ctx: Context) => void;
|
|
31
|
+
private _onInboundTrackAdded;
|
|
32
|
+
onInboundTrackRemoved?: (inboundTrack: ObservedInboundTrack, ctx: Context) => void;
|
|
33
|
+
private _onInboundTrackRemoved;
|
|
34
|
+
onOutboundTrackAdded?: (outboundTrack: ObservedOutboundTrack, ctx: Context) => void;
|
|
35
|
+
private _onOutboundTrackAdded;
|
|
36
|
+
onOutboundTrackRemoved?: (outboundTrack: ObservedOutboundTrack, ctx: Context) => void;
|
|
37
|
+
private _onOutboundTrackRemoved;
|
|
38
|
+
onInboundRtpAdded?: (inboundRtp: ObservedInboundRtp, ctx: Context) => void;
|
|
39
|
+
private _onInboundRtpAdded;
|
|
40
|
+
onInboundRtpRemoved?: (inboundRtp: ObservedInboundRtp, ctx: Context) => void;
|
|
41
|
+
private _onInboundRtpRemoved;
|
|
42
|
+
onOutboundRtpAdded?: (outboundRtp: ObservedOutboundRtp, ctx: Context) => void;
|
|
43
|
+
private _onOutboundRtpAdded;
|
|
44
|
+
onOutboundRtpRemoved?: (outboundRtp: ObservedOutboundRtp, ctx: Context) => void;
|
|
45
|
+
private _onOutboundRtpRemoved;
|
|
46
|
+
onDataChannelAdded?: (dataChannel: ObservedDataChannel, ctx: Context) => void;
|
|
47
|
+
private _onDataChannelAdded;
|
|
48
|
+
onDataChannelRemoved?: (dataChannel: ObservedDataChannel, ctx: Context) => void;
|
|
49
|
+
private _onDataChannelRemoved;
|
|
50
|
+
onAddedIceTransport?: (iceTransport: ObservedIceTransport, ctx: Context) => void;
|
|
51
|
+
private _onAddedIceTransport;
|
|
52
|
+
onRemovedIceTransport?: (iceTransport: ObservedIceTransport, ctx: Context) => void;
|
|
53
|
+
private _onRemovedIceTransport;
|
|
54
|
+
onIceCandidateAdded?: (iceCandidate: ObservedIceCandidate, ctx: Context) => void;
|
|
55
|
+
private _onIceCandidateAdded;
|
|
56
|
+
onIceCandidateRemoved?: (iceCandidate: ObservedIceCandidate, ctx: Context) => void;
|
|
57
|
+
private _onIceCandidateRemoved;
|
|
58
|
+
onAddedIceCandidatePair?: (candidatePair: ObservedIceCandidatePair, ctx: Context) => void;
|
|
59
|
+
private _onAddedIceCandidatePair;
|
|
60
|
+
onRemovedIceCandidatePair?: (candidatePair: ObservedIceCandidatePair, ctx: Context) => void;
|
|
61
|
+
private _onRemovedIceCandidatePair;
|
|
62
|
+
onAddedMediaCodec?: (codec: ObservedCodec, ctx: Context) => void;
|
|
63
|
+
private _onAddedMediaCodec;
|
|
64
|
+
onRemovedMediaCodec?: (codec: ObservedCodec, ctx: Context) => void;
|
|
65
|
+
private _onRemovedMediaCodec;
|
|
66
|
+
onAddedMediaPlayout?: (mediaPlayout: ObservedMediaPlayout, ctx: Context) => void;
|
|
67
|
+
private _onAddedMediaPlayout;
|
|
68
|
+
onRemovedMediaPlayout?: (mediaPlayout: ObservedMediaPlayout, ctx: Context) => void;
|
|
69
|
+
private _onRemovedMediaPlayout;
|
|
70
|
+
onMediaSourceAdded?: (mediaSource: ObservedMediaSource, ctx: Context) => void;
|
|
71
|
+
private _onMediaSourceAdded;
|
|
72
|
+
onMediaSourceRemoved?: (mediaSource: ObservedMediaSource, ctx: Context) => void;
|
|
73
|
+
private _onMediaSourceRemoved;
|
|
74
|
+
onClientIssue?: (issue: ClientIssue, ctx: Context) => void;
|
|
75
|
+
private _onClientIssue;
|
|
76
|
+
onClientMetadata?: (metadata: ClientMetaData, ctx: Context) => void;
|
|
77
|
+
private _onClientMetadata;
|
|
78
|
+
onClientExtensionStats?: (extensionStats: ExtensionStat, ctx: Context) => void;
|
|
79
|
+
private _onClientExtensionStats;
|
|
80
|
+
onClientJoined?: (client: ObservedClient, ctx: Context) => void;
|
|
81
|
+
private _onClientJoined;
|
|
82
|
+
onClientLeft?: (client: ObservedClient, ctx: Context) => void;
|
|
83
|
+
private _onClientLeft;
|
|
84
|
+
onUserMediaError?: (error: string, observedClient: ObservedClient, ctx: Context) => void;
|
|
85
|
+
private _onUserMediaError;
|
|
86
|
+
onUsingTurn?: (client: ObservedClient, ctx: Context) => void;
|
|
87
|
+
private _onUsingTurn;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=ObservedClientEventMonitor.d.ts.map
|