@observertc/observer-js 1.0.1-646d974.0 → 1.0.1-797e5af.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.
@@ -1,11 +1,12 @@
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 { ObservedClientEventMonitor } from './ObservedClientEventMonitor';
9
10
  export type ObservedClientSettings<AppData extends Record<string, unknown> = Record<string, unknown>> = {
10
11
  clientId: string;
11
12
  appData?: AppData;
@@ -108,15 +109,23 @@ export declare class ObservedClient<AppData extends Record<string, unknown> = Re
108
109
  totalNumberOfIssues: number;
109
110
  readonly mediaDevices: MetaData.MediaDeviceInfo[];
110
111
  issues: ClientIssue[];
112
+ private _injections;
111
113
  constructor(settings: ObservedClientSettings<AppData>, call: ObservedCall);
112
114
  get numberOfPeerConnections(): number;
113
115
  get score(): number | undefined;
114
116
  close(): void;
115
117
  accept(sample: ClientSample): void;
116
118
  private _processClientEvent;
119
+ injectMetaData(metaData: ClientMetaData): void;
120
+ injectEvent(event: ClientEvent): void;
121
+ injectIssue(issue: ClientIssue): void;
122
+ injectExtensionStat(stat: ExtensionStat): void;
123
+ injectAttachment(key: string, value: unknown): void;
117
124
  addMetadata(metadata: ClientMetaData): void;
118
125
  addIssue(issue: ClientIssue): void;
119
126
  addExtensionStats(stats: ExtensionStat): void;
120
127
  private _updatePeerConnection;
128
+ createEventMonitor<CTX = unknown>(ctx?: CTX): ObservedClientEventMonitor<CTX>;
129
+ private _mergeInjections;
121
130
  }
122
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,EAAe,cAAc,EAAE,YAAY,EAAwB,WAAW,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACpI,OAAO,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIlD,MAAM,MAAM,sBAAsB,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACvG,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAClC,MAAM,EAAE;QACP;YACC,MAAM,EAAE,YAAY,CAAC;YACrB,eAAe,EAAE,MAAM,CAAC;SACxB;KACD,CAAC;IACF,KAAK,EAAE,EAAE,CAAC;IACV,MAAM,EAAE,EAAE,CAAC;IACX,KAAK,EAAE,CAAC,WAAW,CAAC,CAAC;IACrB,QAAQ,EAAE,CAAC,cAAc,CAAC,CAAC;IAC3B,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC9B,IAAI,EAAE,EAAE,CAAC;IACT,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC;IACrB,cAAc,EAAE,CAAC,MAAM,CAAC,CAAC;IAGzB,iBAAiB,EAAE,CAAC,sBAAsB,CAAC,CAAC;CAC5C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,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;IAI7C,OAAO,CAAC,qBAAqB;IA0BtB,kBAAkB,CAAC,GAAG,GAAG,OAAO,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,0BAA0B,CAAC,GAAG,CAAC;IAIpF,OAAO,CAAC,gBAAgB;CAwFxB"}
@@ -8,6 +8,7 @@ const ClientEventTypes_1 = require("./schema/ClientEventTypes");
8
8
  const ClientMetaTypes_1 = require("./schema/ClientMetaTypes");
9
9
  const utils_1 = require("./common/utils");
10
10
  const Detectors_1 = require("./detectors/Detectors");
11
+ const ObservedClientEventMonitor_1 = require("./ObservedClientEventMonitor");
11
12
  const logger = (0, logger_1.createLogger)('ObservedClient');
12
13
  class ObservedClient extends events_1.EventEmitter {
13
14
  call;
@@ -88,6 +89,7 @@ class ObservedClient extends events_1.EventEmitter {
88
89
  totalNumberOfIssues = 0;
89
90
  mediaDevices = [];
90
91
  issues = [];
92
+ _injections = {};
91
93
  constructor(settings, call) {
92
94
  super();
93
95
  this.call = call;
@@ -148,6 +150,7 @@ class ObservedClient extends events_1.EventEmitter {
148
150
  this.usingTCP = false;
149
151
  this.currentMinRttInMs = undefined;
150
152
  this.currentMaxRttInMs = undefined;
153
+ this._mergeInjections(sample);
151
154
  const clientEventsPostBuffer = [];
152
155
  for (const clientEvent of sample.clientEvents ?? []) {
153
156
  this._processClientEvent(clientEvent, clientEventsPostBuffer);
@@ -392,6 +395,41 @@ class ObservedClient extends events_1.EventEmitter {
392
395
  }
393
396
  }
394
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;
432
+ }
395
433
  addMetadata(metadata) {
396
434
  if (this.closed)
397
435
  return;
@@ -440,5 +478,43 @@ class ObservedClient extends events_1.EventEmitter {
440
478
  observedPeerConnection.accept(sample);
441
479
  return observedPeerConnection;
442
480
  }
481
+ createEventMonitor(ctx) {
482
+ return new ObservedClientEventMonitor_1.ObservedClientEventMonitor(this, ctx ?? {});
483
+ }
484
+ _mergeInjections(sample) {
485
+ if (this.closed)
486
+ return sample;
487
+ if (this._injections.clientEvents) {
488
+ if (!sample.clientEvents)
489
+ sample.clientEvents = [];
490
+ sample.clientEvents.push(...this._injections.clientEvents);
491
+ this._injections.clientEvents = undefined;
492
+ }
493
+ if (this._injections.clientIssues) {
494
+ if (!sample.clientIssues)
495
+ sample.clientIssues = [];
496
+ sample.clientIssues.push(...this._injections.clientIssues);
497
+ this._injections.clientIssues = undefined;
498
+ }
499
+ if (this._injections.extensionStats) {
500
+ if (!sample.extensionStats)
501
+ sample.extensionStats = [];
502
+ sample.extensionStats.push(...this._injections.extensionStats);
503
+ this._injections.extensionStats = undefined;
504
+ }
505
+ if (this._injections.attachments) {
506
+ if (!sample.attachments)
507
+ sample.attachments = {};
508
+ Object.assign(sample.attachments, this._injections.attachments);
509
+ this._injections.attachments = undefined;
510
+ }
511
+ if (this._injections.clientMetaItems) {
512
+ if (!sample.clientMetaItems)
513
+ sample.clientMetaItems = [];
514
+ sample.clientMetaItems.push(...this._injections.clientMetaItems);
515
+ this._injections.clientMetaItems = undefined;
516
+ }
517
+ return sample;
518
+ }
443
519
  }
444
520
  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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObservedClientEventMonitor.d.ts","sourceRoot":"","sources":["../src/ObservedClientEventM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,cAAc,EAAE,cAAc,EAAE,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IAChG,OAAO,CAAC,iBAAiB;IAIlB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IACpE,OAAO,CAAC,YAAY;CAGpB"}
@@ -0,0 +1,247 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ObservedClientEventMonitor = void 0;
4
+ class ObservedClientEventMonitor {
5
+ observedClient;
6
+ context;
7
+ constructor(observedClient, context) {
8
+ this.observedClient = observedClient;
9
+ this.context = context;
10
+ this._onPeerConnconnectionAdded = this._onPeerConnconnectionAdded.bind(this);
11
+ this._onPeerConnectionRemoved = this._onPeerConnectionRemoved.bind(this);
12
+ this._onCertificateAdded = this._onCertificateAdded.bind(this);
13
+ this._onCertificateRemoved = this._onCertificateRemoved.bind(this);
14
+ this._onInboundTrackAdded = this._onInboundTrackAdded.bind(this);
15
+ this._onInboundTrackRemoved = this._onInboundTrackRemoved.bind(this);
16
+ this._onOutboundTrackAdded = this._onOutboundTrackAdded.bind(this);
17
+ this._onOutboundTrackRemoved = this._onOutboundTrackRemoved.bind(this);
18
+ this._onInboundRtpAdded = this._onInboundRtpAdded.bind(this);
19
+ this._onInboundRtpRemoved = this._onInboundRtpRemoved.bind(this);
20
+ this._onOutboundRtpAdded = this._onOutboundRtpAdded.bind(this);
21
+ this._onOutboundRtpRemoved = this._onOutboundRtpRemoved.bind(this);
22
+ this._onDataChannelAdded = this._onDataChannelAdded.bind(this);
23
+ this._onDataChannelRemoved = this._onDataChannelRemoved.bind(this);
24
+ this._onAddedIceTransport = this._onAddedIceTransport.bind(this);
25
+ this._onRemovedIceTransport = this._onRemovedIceTransport.bind(this);
26
+ this._onIceCandidateAdded = this._onIceCandidateAdded.bind(this);
27
+ this._onIceCandidateRemoved = this._onIceCandidateRemoved.bind(this);
28
+ this._onAddedIceCandidatePair = this._onAddedIceCandidatePair.bind(this);
29
+ this._onRemovedIceCandidatePair = this._onRemovedIceCandidatePair.bind(this);
30
+ this._onAddedMediaCodec = this._onAddedMediaCodec.bind(this);
31
+ this._onRemovedMediaCodec = this._onRemovedMediaCodec.bind(this);
32
+ this._onAddedMediaPlayout = this._onAddedMediaPlayout.bind(this);
33
+ this._onRemovedMediaPlayout = this._onRemovedMediaPlayout.bind(this);
34
+ this._onMediaSourceAdded = this._onMediaSourceAdded.bind(this);
35
+ this._onMediaSourceRemoved = this._onMediaSourceRemoved.bind(this);
36
+ this._onClientClosed = this._onClientClosed.bind(this);
37
+ this._onClientIssue = this._onClientIssue.bind(this);
38
+ this._onClientMetadata = this._onClientMetadata.bind(this);
39
+ this._onClientJoined = this._onClientJoined.bind(this);
40
+ this._onClientLeft = this._onClientLeft.bind(this);
41
+ this._onUserMediaError = this._onUserMediaError.bind(this);
42
+ this._onUsingTurn = this._onUsingTurn.bind(this);
43
+ this.observedClient.on('newpeerconnection', this._onPeerConnconnectionAdded);
44
+ this.observedClient.on('issue', this._onClientIssue);
45
+ this.observedClient.on('metaData', this._onClientMetadata);
46
+ this.observedClient.on('joined', this._onClientJoined);
47
+ this.observedClient.on('left', this._onClientLeft);
48
+ this.observedClient.on('rejoined', this._onClientJoined);
49
+ this.observedClient.on('usermediaerror', this._onUserMediaError);
50
+ this.observedClient.on('usingturn', this._onUsingTurn);
51
+ this.observedClient.once('close', this._onClientClosed);
52
+ }
53
+ onClientClosed;
54
+ _onClientClosed() {
55
+ this.onClientClosed?.(this.observedClient, this.context);
56
+ this.observedClient.off('newpeerconnection', this._onPeerConnconnectionAdded);
57
+ this.observedClient.off('issue', this._onClientIssue);
58
+ this.observedClient.off('metaData', this._onClientMetadata);
59
+ this.observedClient.off('joined', this._onClientJoined);
60
+ this.observedClient.off('left', this._onClientLeft);
61
+ this.observedClient.off('rejoined', this._onClientJoined);
62
+ this.observedClient.off('usermediaerror', this._onUserMediaError);
63
+ this.observedClient.off('usingturn', this._onUsingTurn);
64
+ }
65
+ onPeerConnectionAdded;
66
+ _onPeerConnconnectionAdded(peerConnection) {
67
+ this.onPeerConnectionAdded?.(peerConnection, this.context);
68
+ peerConnection.once('close', () => this._onPeerConnectionRemoved(peerConnection));
69
+ peerConnection.on('added-certificate', this._onCertificateAdded);
70
+ peerConnection.on('removed-certificate', this._onCertificateRemoved);
71
+ peerConnection.on('added-inbound-track', this._onInboundTrackAdded);
72
+ peerConnection.on('removed-inbound-track', this._onInboundTrackRemoved);
73
+ peerConnection.on('added-outbound-track', this._onOutboundTrackAdded);
74
+ peerConnection.on('removed-outbound-track', this._onOutboundTrackRemoved);
75
+ peerConnection.on('added-inbound-rtp', this._onInboundRtpAdded);
76
+ peerConnection.on('removed-inbound-rtp', this._onInboundRtpRemoved);
77
+ peerConnection.on('added-outbound-rtp', this._onOutboundRtpAdded);
78
+ peerConnection.on('removed-outbound-rtp', this._onOutboundRtpRemoved);
79
+ peerConnection.on('added-data-channel', this._onDataChannelAdded);
80
+ peerConnection.on('removed-data-channel', this._onDataChannelRemoved);
81
+ peerConnection.on('added-ice-transport', this._onAddedIceTransport);
82
+ peerConnection.on('removed-ice-transport', this._onRemovedIceTransport);
83
+ peerConnection.on('added-ice-candidate', this._onIceCandidateAdded);
84
+ peerConnection.on('removed-ice-candidate', this._onIceCandidateRemoved);
85
+ peerConnection.on('added-ice-candidate-pair', this._onAddedIceCandidatePair);
86
+ peerConnection.on('removed-ice-candidate-pair', this._onRemovedIceCandidatePair);
87
+ peerConnection.on('added-codec', this._onAddedMediaCodec);
88
+ peerConnection.on('removed-codec', this._onRemovedMediaCodec);
89
+ peerConnection.on('added-media-playout', this._onAddedMediaPlayout);
90
+ peerConnection.on('removed-media-playout', this._onRemovedMediaPlayout);
91
+ peerConnection.on('added-media-source', this._onMediaSourceAdded);
92
+ peerConnection.on('removed-media-source', this._onMediaSourceRemoved);
93
+ }
94
+ onPeerConnectionRemoved;
95
+ _onPeerConnectionRemoved(peerConnection) {
96
+ this.onPeerConnectionRemoved?.(peerConnection, this.context);
97
+ peerConnection.off('added-certificate', this._onCertificateAdded);
98
+ peerConnection.off('removed-certificate', this._onCertificateRemoved);
99
+ peerConnection.off('added-inbound-track', this._onInboundTrackAdded);
100
+ peerConnection.off('removed-inbound-track', this._onInboundTrackRemoved);
101
+ peerConnection.off('added-outbound-track', this._onOutboundTrackAdded);
102
+ peerConnection.off('removed-outbound-track', this._onOutboundTrackRemoved);
103
+ peerConnection.off('added-inbound-rtp', this._onInboundRtpAdded);
104
+ peerConnection.off('removed-inbound-rtp', this._onInboundRtpRemoved);
105
+ peerConnection.off('added-outbound-rtp', this._onOutboundRtpAdded);
106
+ peerConnection.off('removed-outbound-rtp', this._onOutboundRtpRemoved);
107
+ peerConnection.off('added-data-channel', this._onDataChannelAdded);
108
+ peerConnection.off('removed-data-channel', this._onDataChannelRemoved);
109
+ peerConnection.off('added-ice-transport', this._onAddedIceTransport);
110
+ peerConnection.off('removed-ice-transport', this._onRemovedIceTransport);
111
+ peerConnection.off('added-ice-candidate', this._onIceCandidateAdded);
112
+ peerConnection.off('removed-ice-candidate', this._onIceCandidateRemoved);
113
+ peerConnection.off('added-ice-candidate-pair', this._onAddedIceCandidatePair);
114
+ peerConnection.off('removed-ice-candidate-pair', this._onRemovedIceCandidatePair);
115
+ peerConnection.off('added-codec', this._onAddedMediaCodec);
116
+ peerConnection.off('removed-codec', this._onRemovedMediaCodec);
117
+ peerConnection.off('added-media-playout', this._onAddedMediaPlayout);
118
+ peerConnection.off('removed-media-playout', this._onRemovedMediaPlayout);
119
+ peerConnection.off('added-media-source', this._onMediaSourceAdded);
120
+ peerConnection.off('removed-media-source', this._onMediaSourceRemoved);
121
+ }
122
+ onCertificateAdded;
123
+ _onCertificateAdded(certificate) {
124
+ this.onCertificateAdded?.(certificate, this.context);
125
+ }
126
+ onCertificateRemoved;
127
+ _onCertificateRemoved(certificate) {
128
+ this.onCertificateRemoved?.(certificate, this.context);
129
+ }
130
+ onInboundTrackAdded;
131
+ _onInboundTrackAdded(inboundTrack) {
132
+ this.onInboundTrackAdded?.(inboundTrack, this.context);
133
+ }
134
+ onInboundTrackRemoved;
135
+ _onInboundTrackRemoved(inboundTrack) {
136
+ this.onInboundTrackRemoved?.(inboundTrack, this.context);
137
+ }
138
+ onOutboundTrackAdded;
139
+ _onOutboundTrackAdded(outboundTrack) {
140
+ this.onOutboundTrackAdded?.(outboundTrack, this.context);
141
+ }
142
+ onOutboundTrackRemoved;
143
+ _onOutboundTrackRemoved(outboundTrack) {
144
+ this.onOutboundTrackRemoved?.(outboundTrack, this.context);
145
+ }
146
+ onInboundRtpAdded;
147
+ _onInboundRtpAdded(inboundRtp) {
148
+ this.onInboundRtpAdded?.(inboundRtp, this.context);
149
+ }
150
+ onInboundRtpRemoved;
151
+ _onInboundRtpRemoved(inboundRtp) {
152
+ this.onInboundRtpRemoved?.(inboundRtp, this.context);
153
+ }
154
+ onOutboundRtpAdded;
155
+ _onOutboundRtpAdded(outboundRtp) {
156
+ this.onOutboundRtpAdded?.(outboundRtp, this.context);
157
+ }
158
+ onOutboundRtpRemoved;
159
+ _onOutboundRtpRemoved(outboundRtp) {
160
+ this.onOutboundRtpRemoved?.(outboundRtp, this.context);
161
+ }
162
+ onDataChannelAdded;
163
+ _onDataChannelAdded(dataChannel) {
164
+ this.onDataChannelAdded?.(dataChannel, this.context);
165
+ }
166
+ onDataChannelRemoved;
167
+ _onDataChannelRemoved(dataChannel) {
168
+ this.onDataChannelRemoved?.(dataChannel, this.context);
169
+ }
170
+ onAddedIceTransport;
171
+ _onAddedIceTransport(iceTransport) {
172
+ this.onAddedIceTransport?.(iceTransport, this.context);
173
+ }
174
+ onRemovedIceTransport;
175
+ _onRemovedIceTransport(iceTransport) {
176
+ this.onRemovedIceTransport?.(iceTransport, this.context);
177
+ }
178
+ onIceCandidateAdded;
179
+ _onIceCandidateAdded(iceCandidate) {
180
+ this.onIceCandidateAdded?.(iceCandidate, this.context);
181
+ }
182
+ onIceCandidateRemoved;
183
+ _onIceCandidateRemoved(iceCandidate) {
184
+ this.onIceCandidateRemoved?.(iceCandidate, this.context);
185
+ }
186
+ onAddedIceCandidatePair;
187
+ _onAddedIceCandidatePair(candidatePair) {
188
+ this.onAddedIceCandidatePair?.(candidatePair, this.context);
189
+ }
190
+ onRemovedIceCandidatePair;
191
+ _onRemovedIceCandidatePair(candidatePair) {
192
+ this.onRemovedIceCandidatePair?.(candidatePair, this.context);
193
+ }
194
+ onAddedMediaCodec;
195
+ _onAddedMediaCodec(codec) {
196
+ this.onAddedMediaCodec?.(codec, this.context);
197
+ }
198
+ onRemovedMediaCodec;
199
+ _onRemovedMediaCodec(codec) {
200
+ this.onRemovedMediaCodec?.(codec, this.context);
201
+ }
202
+ onAddedMediaPlayout;
203
+ _onAddedMediaPlayout(mediaPlayout) {
204
+ this.onAddedMediaPlayout?.(mediaPlayout, this.context);
205
+ }
206
+ onRemovedMediaPlayout;
207
+ _onRemovedMediaPlayout(mediaPlayout) {
208
+ this.onRemovedMediaPlayout?.(mediaPlayout, this.context);
209
+ }
210
+ onMediaSourceAdded;
211
+ _onMediaSourceAdded(mediaSource) {
212
+ this.onMediaSourceAdded?.(mediaSource, this.context);
213
+ }
214
+ onMediaSourceRemoved;
215
+ _onMediaSourceRemoved(mediaSource) {
216
+ this.onMediaSourceRemoved?.(mediaSource, this.context);
217
+ }
218
+ onClientIssue;
219
+ _onClientIssue(issue) {
220
+ this.onClientIssue?.(issue, this.context);
221
+ }
222
+ onClientMetadata;
223
+ _onClientMetadata(metadata) {
224
+ this.onClientMetadata?.(metadata, this.context);
225
+ }
226
+ onClientExtensionStats;
227
+ _onClientExtensionStats(extensionStats) {
228
+ this.onClientExtensionStats?.(extensionStats, this.context);
229
+ }
230
+ onClientJoined;
231
+ _onClientJoined() {
232
+ this.onClientJoined?.(this.observedClient, this.context);
233
+ }
234
+ onClientLeft;
235
+ _onClientLeft() {
236
+ this.onClientLeft?.(this.observedClient, this.context);
237
+ }
238
+ onUserMediaError;
239
+ _onUserMediaError(error) {
240
+ this.onUserMediaError?.(error, this.observedClient, this.context);
241
+ }
242
+ onUsingTurn;
243
+ _onUsingTurn() {
244
+ this.onUsingTurn?.(this.observedClient, this.context);
245
+ }
246
+ }
247
+ exports.ObservedClientEventMonitor = ObservedClientEventMonitor;
package/lib/Observer.d.ts CHANGED
@@ -42,7 +42,7 @@ export declare class Observer extends EventEmitter {
42
42
  totalRttLt300Measurements: number;
43
43
  totalRttGtOrEq300Measurements: number;
44
44
  totalClientIssues: number;
45
- numberOfClientsUsedTurn: number;
45
+ numberOfClientsUsingTurn: number;
46
46
  numberOfClients: number;
47
47
  numberOfInboundRtpStreams: number;
48
48
  numberOfOutboundRtpStreams: number;
@@ -1 +1 @@
1
- {"version":3,"file":"Observer.d.ts","sourceRoot":"","sources":["../src/Observer.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC9G,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAO7C,MAAM,MAAM,cAAc,GAAG;IAC5B,cAAc,EAAE,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;IAC9C,cAAc,EAAE,CAAC,YAAY,CAAC,CAAC;IAC/B,cAAc,EAAE,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;IAC9C,iBAAiB,EAAE,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;IACpD,wBAAwB,EAAE,CAAC,cAAc,EAAE,aA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/Observer.js CHANGED
@@ -24,7 +24,7 @@ class Observer extends events_1.EventEmitter {
24
24
  totalRttLt300Measurements = 0;
25
25
  totalRttGtOrEq300Measurements = 0;
26
26
  totalClientIssues = 0;
27
- numberOfClientsUsedTurn = 0;
27
+ numberOfClientsUsingTurn = 0;
28
28
  numberOfClients = 0;
29
29
  numberOfInboundRtpStreams = 0;
30
30
  numberOfOutboundRtpStreams = 0;
@@ -133,14 +133,14 @@ class Observer extends events_1.EventEmitter {
133
133
  this.numberOfPeerConnections = 0;
134
134
  this.numberOfDataChannels = 0;
135
135
  this.numberOfClients = 0;
136
- this.numberOfClientsUsedTurn = 0;
136
+ this.numberOfClientsUsingTurn = 0;
137
137
  for (const call of this.observedCalls.values()) {
138
138
  this.numberOfInboundRtpStreams += call.numberOfInboundRtpStreams;
139
139
  this.numberOfOutboundRtpStreams += call.numberOfOutboundRtpStreams;
140
140
  this.numberOfPeerConnections += call.numberOfPeerConnections;
141
141
  this.numberOfDataChannels += call.numberOfDataChannels;
142
142
  this.numberOfClients += call.numberOfClients;
143
- this.numberOfClientsUsedTurn += call.clientsUsedTurn.size;
143
+ this.numberOfClientsUsingTurn += call.clientsUsedTurn.size;
144
144
  }
145
145
  this.observedTURN.update();
146
146
  this.emit('update');
package/lib/index.d.ts CHANGED
@@ -22,5 +22,6 @@ export { ClientEventTypes } from './schema/ClientEventTypes';
22
22
  export { ClientMetaTypes } from './schema/ClientMetaTypes';
23
23
  export { ClientSample } from './schema/ClientSample';
24
24
  export { ScoreCalculator } from './scores/ScoreCalculator';
25
+ export { ObservedClientEventMonitor } from './ObservedClientEventMonitor';
25
26
  export { Middleware } from './common/Middleware';
26
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAA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E,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ClientMetaTypes = exports.ClientEventTypes = exports.ObservedPeerConnectionTransport = exports.ObservedIceTransport = exports.ObservedIceCandidate = exports.ObservedIceCandidatePair = exports.ObservedRemoteOutboundRtp = exports.ObservedRemoteInboundRtp = exports.ObservedOutboundRtp = exports.ObservedInboundRtp = exports.ObservedDataChannel = exports.ObservedCertificate = exports.ObservedCodec = exports.ObservedMediaPlayout = exports.ObservedMediaSource = exports.ObservedPeerConnection = exports.ObservedClient = exports.ObservedOutboundTrack = exports.ObservedInboundTrack = exports.ObservedCall = exports.Observer = void 0;
3
+ exports.ObservedClientEventMonitor = exports.ClientMetaTypes = exports.ClientEventTypes = exports.ObservedPeerConnectionTransport = exports.ObservedIceTransport = exports.ObservedIceCandidate = exports.ObservedIceCandidatePair = exports.ObservedRemoteOutboundRtp = exports.ObservedRemoteInboundRtp = exports.ObservedOutboundRtp = exports.ObservedInboundRtp = exports.ObservedDataChannel = exports.ObservedCertificate = exports.ObservedCodec = exports.ObservedMediaPlayout = exports.ObservedMediaSource = exports.ObservedPeerConnection = exports.ObservedClient = exports.ObservedOutboundTrack = exports.ObservedInboundTrack = exports.ObservedCall = exports.Observer = void 0;
4
4
  var Observer_1 = require("./Observer");
5
5
  Object.defineProperty(exports, "Observer", { enumerable: true, get: function () { return Observer_1.Observer; } });
6
6
  var ObservedCall_1 = require("./ObservedCall");
@@ -43,3 +43,5 @@ var ClientEventTypes_1 = require("./schema/ClientEventTypes");
43
43
  Object.defineProperty(exports, "ClientEventTypes", { enumerable: true, get: function () { return ClientEventTypes_1.ClientEventTypes; } });
44
44
  var ClientMetaTypes_1 = require("./schema/ClientMetaTypes");
45
45
  Object.defineProperty(exports, "ClientMetaTypes", { enumerable: true, get: function () { return ClientMetaTypes_1.ClientMetaTypes; } });
46
+ var ObservedClientEventMonitor_1 = require("./ObservedClientEventMonitor");
47
+ Object.defineProperty(exports, "ObservedClientEventMonitor", { enumerable: true, get: function () { return ObservedClientEventMonitor_1.ObservedClientEventMonitor; } });
@@ -1,3 +1,45 @@
1
+ interface DoubleRange {
2
+ max?: number;
3
+ min?: number;
4
+ }
5
+ interface ULongRange {
6
+ max?: number;
7
+ min?: number;
8
+ }
9
+ interface MediaTrackConstraints {
10
+ aspectRatio?: DoubleRange;
11
+ autoGainControl?: boolean[];
12
+ backgroundBlur?: boolean[];
13
+ channelCount?: ULongRange;
14
+ deviceId?: string;
15
+ displaySurface?: string;
16
+ echoCancellation?: boolean[];
17
+ facingMode?: string[];
18
+ frameRate?: DoubleRange;
19
+ groupId?: string;
20
+ height?: ULongRange;
21
+ noiseSuppression?: boolean[];
22
+ sampleRate?: ULongRange;
23
+ sampleSize?: ULongRange;
24
+ width?: ULongRange;
25
+ }
26
+ interface MediaTrackCapabilities {
27
+ aspectRatio?: DoubleRange;
28
+ autoGainControl?: boolean[];
29
+ backgroundBlur?: boolean[];
30
+ channelCount?: ULongRange;
31
+ deviceId?: string;
32
+ displaySurface?: string;
33
+ echoCancellation?: boolean[];
34
+ facingMode?: string[];
35
+ frameRate?: DoubleRange;
36
+ groupId?: string;
37
+ height?: ULongRange;
38
+ noiseSuppression?: boolean[];
39
+ sampleRate?: ULongRange;
40
+ sampleSize?: ULongRange;
41
+ width?: ULongRange;
42
+ }
1
43
  export declare enum ClientEventTypes {
2
44
  CLIENT_JOINED = "CLIENT_JOINED",
3
45
  CLIENT_LEFT = "CLIENT_LEFT",
@@ -97,4 +139,5 @@ export interface DataChannelClosedEventPayload extends Record<string, unknown> {
97
139
  readyState: string;
98
140
  dataChannelId: string;
99
141
  }
142
+ export {};
100
143
  //# sourceMappingURL=ClientEventTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClientEventTypes.d.ts","sourceRoot":"","sources":["../../src/schema/ClientEventTypes.ts"],"names":[],"mappings":"AAEA,oBAAY,gBAAgB;IAC3B,aAAa,kBAAkB;IAC/B,WAAW,gBAAgB;IAC3B,sBAAsB,2BAA2B;IACjD,sBAAsB,2BAA2B;IACjD,iBAAiB,sBAAsB;IACvC,mBAAmB,wBAAwB;IAC3C,mBAAmB,wBAAwB;IAC3C,iBAAiB,sBAAsB;IACvC,mBAAmB,wBAAwB;IAC3C,2BAA2B,gCAAgC;IAC3D,6BAA6B,kCAAkC;IAC/D,4BAA4B,iCAAiC;IAC7D,iBAAiB,sBAAsB;IACvC,mBAAmB,wBAAwB;IAC3C,kBAAkB,uBAAuB;IACzC,kBAAkB,uBAAuB;IACzC,sBAAsB,2BAA2B;IACjD,0BAA0B,+BAA+B;IACzD,2BAA2B,gCAAgC;IAC3D,aAAa,kBAAkB;IAG/B,cAAc,mBAAmB;IACjC,gBAAgB,qBAAqB;IACrC,eAAe,oBAAoB;IACnC,gBAAgB,qBAAqB;IACrC,cAAc,mBAAmB;IACjC,gBAAgB,qBAAqB;IACrC,qBAAqB,0BAA0B;IAC/C,oBAAoB,yBAAyB;IAC7C,qBAAqB,0BAA0B;IAC/C,oBAAoB,yBAAyB;CAC7C;AAED,MAAM,WAAW,gCAAiC,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAChF,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,gCAAiC,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAChF,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MA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U,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,6BAA8B,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@observertc/observer-js",
3
- "version": "1.0.1-646d974.0",
3
+ "version": "1.0.1-797e5af.0",
4
4
  "description": "Server Side NodeJS Library for processing ObserveRTC Samples",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -10,6 +10,7 @@ import { ClientMetaTypes } from './schema/ClientMetaTypes';
10
10
  import { parseJsonAs } from './common/utils';
11
11
  import { CalculatedScore } from './scores/CalculatedScore';
12
12
  import { Detectors } from './detectors/Detectors';
13
+ import { ObservedClientEventMonitor } from './ObservedClientEventMonitor';
13
14
 
14
15
  const logger = createLogger('ObservedClient');
15
16
 
@@ -137,6 +138,8 @@ export class ObservedClient<AppData extends Record<string, unknown> = Record<str
137
138
  public readonly mediaDevices: MetaData.MediaDeviceInfo[] = [];
138
139
  public issues: ClientIssue[] = [];
139
140
 
141
+ private _injections: Pick<ClientSample, 'clientEvents' | 'clientIssues' | 'extensionStats' | 'attachments' | 'clientMetaItems'> = {};
142
+
140
143
  public constructor(settings: ObservedClientSettings<AppData>, public readonly call: ObservedCall) {
141
144
  super();
142
145
  this.setMaxListeners(Infinity);
@@ -208,6 +211,8 @@ export class ObservedClient<AppData extends Record<string, unknown> = Record<str
208
211
  this.currentMinRttInMs = undefined;
209
212
  this.currentMaxRttInMs = undefined;
210
213
 
214
+ this._mergeInjections(sample);
215
+
211
216
  const clientEventsPostBuffer: ClientEvent[] = [];
212
217
 
213
218
  for (const clientEvent of sample.clientEvents ?? []) {
@@ -470,6 +475,47 @@ export class ObservedClient<AppData extends Record<string, unknown> = Record<str
470
475
  }
471
476
  }
472
477
 
478
+ public injectMetaData(metaData: ClientMetaData) {
479
+ if (this.closed) return;
480
+
481
+ if (!this._injections.clientMetaItems) this._injections.clientMetaItems = [];
482
+
483
+ this._injections.clientMetaItems.push(metaData);
484
+ }
485
+
486
+ public injectEvent(event: ClientEvent) {
487
+ if (this.closed) return;
488
+
489
+ if (!this._injections.clientEvents) this._injections.clientEvents = [];
490
+
491
+ this._injections.clientEvents.push(event);
492
+ }
493
+
494
+ public injectIssue(issue: ClientIssue) {
495
+ if (this.closed) return;
496
+
497
+ if (!this._injections.clientIssues) this._injections.clientIssues = [];
498
+
499
+ this._injections.clientIssues.push(issue);
500
+ }
501
+
502
+ public injectExtensionStat(stat: ExtensionStat) {
503
+ if (this.closed) return;
504
+
505
+ if (!this._injections.extensionStats) this._injections.extensionStats = [];
506
+
507
+ this._injections.extensionStats.push(stat);
508
+ }
509
+
510
+ public injectAttachment(key: string, value: unknown) {
511
+ if (this.closed) return;
512
+
513
+ if (!this._injections.attachments) this._injections.attachments = {};
514
+
515
+ this._injections.attachments[key] = value;
516
+
517
+ }
518
+
473
519
  public addMetadata(metadata: ClientMetaData) {
474
520
  if (this.closed) return;
475
521
 
@@ -532,6 +578,51 @@ export class ObservedClient<AppData extends Record<string, unknown> = Record<str
532
578
  return observedPeerConnection;
533
579
  }
534
580
 
581
+ public createEventMonitor<CTX = unknown>(ctx?: CTX): ObservedClientEventMonitor<CTX> {
582
+ return new ObservedClientEventMonitor<CTX>(this, ctx ?? {} as CTX);
583
+ }
584
+
585
+ private _mergeInjections(sample: ClientSample): ClientSample {
586
+ if (this.closed) return sample;
587
+
588
+ if (this._injections.clientEvents) {
589
+ if (!sample.clientEvents) sample.clientEvents = [];
590
+ sample.clientEvents.push(...this._injections.clientEvents);
591
+
592
+ this._injections.clientEvents = undefined;
593
+ }
594
+
595
+ if (this._injections.clientIssues) {
596
+ if (!sample.clientIssues) sample.clientIssues = [];
597
+ sample.clientIssues.push(...this._injections.clientIssues);
598
+
599
+ this._injections.clientIssues = undefined;
600
+ }
601
+
602
+ if (this._injections.extensionStats) {
603
+ if (!sample.extensionStats) sample.extensionStats = [];
604
+ sample.extensionStats.push(...this._injections.extensionStats);
605
+
606
+ this._injections.extensionStats = undefined;
607
+ }
608
+
609
+ if (this._injections.attachments) {
610
+ if (!sample.attachments) sample.attachments = {};
611
+ Object.assign(sample.attachments, this._injections.attachments);
612
+
613
+ this._injections.attachments = undefined;
614
+ }
615
+
616
+ if (this._injections.clientMetaItems) {
617
+ if (!sample.clientMetaItems) sample.clientMetaItems = [];
618
+ sample.clientMetaItems.push(...this._injections.clientMetaItems);
619
+
620
+ this._injections.clientMetaItems = undefined;
621
+ }
622
+
623
+ return sample;
624
+ }
625
+
535
626
  // public resetSummaryMetrics() {
536
627
  // this.totalDataChannelBytesReceived = 0;
537
628
  // this.totalDataChannelBytesSent = 0;
@@ -0,0 +1,301 @@
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
+
17
+ export class ObservedClientEventMonitor<Context> {
18
+ public constructor(
19
+ public readonly observedClient: ObservedClient,
20
+ public readonly context: Context,
21
+ ) {
22
+ this._onPeerConnconnectionAdded = this._onPeerConnconnectionAdded.bind(this);
23
+ this._onPeerConnectionRemoved = this._onPeerConnectionRemoved.bind(this);
24
+ this._onCertificateAdded = this._onCertificateAdded.bind(this);
25
+ this._onCertificateRemoved = this._onCertificateRemoved.bind(this);
26
+ this._onInboundTrackAdded = this._onInboundTrackAdded.bind(this);
27
+ this._onInboundTrackRemoved = this._onInboundTrackRemoved.bind(this);
28
+ this._onOutboundTrackAdded = this._onOutboundTrackAdded.bind(this);
29
+ this._onOutboundTrackRemoved = this._onOutboundTrackRemoved.bind(this);
30
+ this._onInboundRtpAdded = this._onInboundRtpAdded.bind(this);
31
+ this._onInboundRtpRemoved = this._onInboundRtpRemoved.bind(this);
32
+ this._onOutboundRtpAdded = this._onOutboundRtpAdded.bind(this);
33
+ this._onOutboundRtpRemoved = this._onOutboundRtpRemoved.bind(this);
34
+ this._onDataChannelAdded = this._onDataChannelAdded.bind(this);
35
+ this._onDataChannelRemoved = this._onDataChannelRemoved.bind(this);
36
+ this._onAddedIceTransport = this._onAddedIceTransport.bind(this);
37
+ this._onRemovedIceTransport = this._onRemovedIceTransport.bind(this);
38
+ this._onIceCandidateAdded = this._onIceCandidateAdded.bind(this);
39
+ this._onIceCandidateRemoved = this._onIceCandidateRemoved.bind(this);
40
+ this._onAddedIceCandidatePair = this._onAddedIceCandidatePair.bind(this);
41
+ this._onRemovedIceCandidatePair = this._onRemovedIceCandidatePair.bind(this);
42
+ this._onAddedMediaCodec = this._onAddedMediaCodec.bind(this);
43
+ this._onRemovedMediaCodec = this._onRemovedMediaCodec.bind(this);
44
+ this._onAddedMediaPlayout = this._onAddedMediaPlayout.bind(this);
45
+ this._onRemovedMediaPlayout = this._onRemovedMediaPlayout.bind(this);
46
+ this._onMediaSourceAdded = this._onMediaSourceAdded.bind(this);
47
+ this._onMediaSourceRemoved = this._onMediaSourceRemoved.bind(this);
48
+ this._onClientClosed = this._onClientClosed.bind(this);
49
+ this._onClientIssue = this._onClientIssue.bind(this);
50
+ this._onClientMetadata = this._onClientMetadata.bind(this);
51
+ this._onClientJoined = this._onClientJoined.bind(this);
52
+ this._onClientLeft = this._onClientLeft.bind(this);
53
+ this._onUserMediaError = this._onUserMediaError.bind(this);
54
+ this._onUsingTurn = this._onUsingTurn.bind(this);
55
+
56
+ this.observedClient.on('newpeerconnection', this._onPeerConnconnectionAdded);
57
+ this.observedClient.on('issue', this._onClientIssue);
58
+ this.observedClient.on('metaData', this._onClientMetadata);
59
+ this.observedClient.on('joined', this._onClientJoined);
60
+ this.observedClient.on('left', this._onClientLeft);
61
+ this.observedClient.on('rejoined', this._onClientJoined);
62
+ this.observedClient.on('usermediaerror', this._onUserMediaError);
63
+ this.observedClient.on('usingturn', this._onUsingTurn);
64
+
65
+ this.observedClient.once('close', this._onClientClosed);
66
+ }
67
+
68
+ public onClientClosed?: (client: ObservedClient, ctx: Context) => void;
69
+ private _onClientClosed() {
70
+ this.onClientClosed?.(this.observedClient, this.context);
71
+
72
+ this.observedClient.off('newpeerconnection', this._onPeerConnconnectionAdded);
73
+ this.observedClient.off('issue', this._onClientIssue);
74
+ this.observedClient.off('metaData', this._onClientMetadata);
75
+ this.observedClient.off('joined', this._onClientJoined);
76
+ this.observedClient.off('left', this._onClientLeft);
77
+ this.observedClient.off('rejoined', this._onClientJoined);
78
+ this.observedClient.off('usermediaerror', this._onUserMediaError);
79
+ this.observedClient.off('usingturn', this._onUsingTurn);
80
+
81
+ }
82
+
83
+ public onPeerConnectionAdded?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
84
+ private _onPeerConnconnectionAdded(peerConnection: ObservedPeerConnection) {
85
+ this.onPeerConnectionAdded?.(peerConnection, this.context);
86
+
87
+ peerConnection.once('close', () => this._onPeerConnectionRemoved(peerConnection));
88
+
89
+ peerConnection.on('added-certificate', this._onCertificateAdded);
90
+ peerConnection.on('removed-certificate', this._onCertificateRemoved);
91
+ peerConnection.on('added-inbound-track', this._onInboundTrackAdded);
92
+ peerConnection.on('removed-inbound-track', this._onInboundTrackRemoved);
93
+ peerConnection.on('added-outbound-track', this._onOutboundTrackAdded);
94
+ peerConnection.on('removed-outbound-track', this._onOutboundTrackRemoved);
95
+ peerConnection.on('added-inbound-rtp', this._onInboundRtpAdded);
96
+ peerConnection.on('removed-inbound-rtp', this._onInboundRtpRemoved);
97
+ peerConnection.on('added-outbound-rtp', this._onOutboundRtpAdded);
98
+ peerConnection.on('removed-outbound-rtp', this._onOutboundRtpRemoved);
99
+ peerConnection.on('added-data-channel', this._onDataChannelAdded);
100
+ peerConnection.on('removed-data-channel', this._onDataChannelRemoved);
101
+ peerConnection.on('added-ice-transport', this._onAddedIceTransport);
102
+ peerConnection.on('removed-ice-transport', this._onRemovedIceTransport);
103
+ peerConnection.on('added-ice-candidate', this._onIceCandidateAdded);
104
+ peerConnection.on('removed-ice-candidate', this._onIceCandidateRemoved);
105
+ peerConnection.on('added-ice-candidate-pair', this._onAddedIceCandidatePair);
106
+ peerConnection.on('removed-ice-candidate-pair', this._onRemovedIceCandidatePair);
107
+ peerConnection.on('added-codec', this._onAddedMediaCodec);
108
+ peerConnection.on('removed-codec', this._onRemovedMediaCodec);
109
+ peerConnection.on('added-media-playout', this._onAddedMediaPlayout);
110
+ peerConnection.on('removed-media-playout', this._onRemovedMediaPlayout);
111
+ peerConnection.on('added-media-source', this._onMediaSourceAdded);
112
+ peerConnection.on('removed-media-source', this._onMediaSourceRemoved);
113
+
114
+ }
115
+
116
+ public onPeerConnectionRemoved?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
117
+ private _onPeerConnectionRemoved(peerConnection: ObservedPeerConnection) {
118
+ this.onPeerConnectionRemoved?.(peerConnection, this.context);
119
+
120
+ peerConnection.off('added-certificate', this._onCertificateAdded);
121
+ peerConnection.off('removed-certificate', this._onCertificateRemoved);
122
+ peerConnection.off('added-inbound-track', this._onInboundTrackAdded);
123
+ peerConnection.off('removed-inbound-track', this._onInboundTrackRemoved);
124
+ peerConnection.off('added-outbound-track', this._onOutboundTrackAdded);
125
+ peerConnection.off('removed-outbound-track', this._onOutboundTrackRemoved);
126
+ peerConnection.off('added-inbound-rtp', this._onInboundRtpAdded);
127
+ peerConnection.off('removed-inbound-rtp', this._onInboundRtpRemoved);
128
+ peerConnection.off('added-outbound-rtp', this._onOutboundRtpAdded);
129
+ peerConnection.off('removed-outbound-rtp', this._onOutboundRtpRemoved);
130
+ peerConnection.off('added-data-channel', this._onDataChannelAdded);
131
+ peerConnection.off('removed-data-channel', this._onDataChannelRemoved);
132
+ peerConnection.off('added-ice-transport', this._onAddedIceTransport);
133
+ peerConnection.off('removed-ice-transport', this._onRemovedIceTransport);
134
+ peerConnection.off('added-ice-candidate', this._onIceCandidateAdded);
135
+ peerConnection.off('removed-ice-candidate', this._onIceCandidateRemoved);
136
+ peerConnection.off('added-ice-candidate-pair', this._onAddedIceCandidatePair);
137
+ peerConnection.off('removed-ice-candidate-pair', this._onRemovedIceCandidatePair);
138
+ peerConnection.off('added-codec', this._onAddedMediaCodec);
139
+ peerConnection.off('removed-codec', this._onRemovedMediaCodec);
140
+ peerConnection.off('added-media-playout', this._onAddedMediaPlayout);
141
+ peerConnection.off('removed-media-playout', this._onRemovedMediaPlayout);
142
+ peerConnection.off('added-media-source', this._onMediaSourceAdded);
143
+ peerConnection.off('removed-media-source', this._onMediaSourceRemoved);
144
+
145
+ }
146
+
147
+ public onCertificateAdded?: (certificate: ObservedCertificate, ctx: Context) => void;
148
+ private _onCertificateAdded(certificate: ObservedCertificate) {
149
+ this.onCertificateAdded?.(certificate, this.context);
150
+ }
151
+
152
+ public onCertificateRemoved?: (certificate: ObservedCertificate, ctx: Context) => void;
153
+ private _onCertificateRemoved(certificate: ObservedCertificate) {
154
+ this.onCertificateRemoved?.(certificate, this.context);
155
+ }
156
+
157
+ public onInboundTrackAdded?: (inboundTrack: ObservedInboundTrack, ctx: Context) => void;
158
+ private _onInboundTrackAdded(inboundTrack: ObservedInboundTrack) {
159
+ this.onInboundTrackAdded?.(inboundTrack, this.context);
160
+ }
161
+
162
+ public onInboundTrackRemoved?: (inboundTrack: ObservedInboundTrack, ctx: Context) => void;
163
+ private _onInboundTrackRemoved(inboundTrack: ObservedInboundTrack) {
164
+ this.onInboundTrackRemoved?.(inboundTrack, this.context);
165
+ }
166
+
167
+ public onOutboundTrackAdded?: (outboundTrack: ObservedOutboundTrack, ctx: Context) => void;
168
+ private _onOutboundTrackAdded(outboundTrack: ObservedOutboundTrack) {
169
+ this.onOutboundTrackAdded?.(outboundTrack, this.context);
170
+ }
171
+
172
+ public onOutboundTrackRemoved?: (outboundTrack: ObservedOutboundTrack, ctx: Context) => void;
173
+ private _onOutboundTrackRemoved(outboundTrack: ObservedOutboundTrack) {
174
+ this.onOutboundTrackRemoved?.(outboundTrack, this.context);
175
+ }
176
+
177
+ public onInboundRtpAdded?: (inboundRtp: ObservedInboundRtp, ctx: Context) => void;
178
+ private _onInboundRtpAdded(inboundRtp: ObservedInboundRtp) {
179
+ this.onInboundRtpAdded?.(inboundRtp, this.context);
180
+ }
181
+
182
+ public onInboundRtpRemoved?: (inboundRtp: ObservedInboundRtp, ctx: Context) => void;
183
+ private _onInboundRtpRemoved(inboundRtp: ObservedInboundRtp) {
184
+ this.onInboundRtpRemoved?.(inboundRtp, this.context);
185
+ }
186
+
187
+ public onOutboundRtpAdded?: (outboundRtp: ObservedOutboundRtp, ctx: Context) => void;
188
+ private _onOutboundRtpAdded(outboundRtp: ObservedOutboundRtp) {
189
+ this.onOutboundRtpAdded?.(outboundRtp, this.context);
190
+ }
191
+
192
+ public onOutboundRtpRemoved?: (outboundRtp: ObservedOutboundRtp, ctx: Context) => void;
193
+ private _onOutboundRtpRemoved(outboundRtp: ObservedOutboundRtp) {
194
+ this.onOutboundRtpRemoved?.(outboundRtp, this.context);
195
+ }
196
+
197
+ public onDataChannelAdded?: (dataChannel: ObservedDataChannel, ctx: Context) => void;
198
+ private _onDataChannelAdded(dataChannel: ObservedDataChannel) {
199
+ this.onDataChannelAdded?.(dataChannel, this.context);
200
+ }
201
+
202
+ public onDataChannelRemoved?: (dataChannel: ObservedDataChannel, ctx: Context) => void;
203
+ private _onDataChannelRemoved(dataChannel: ObservedDataChannel) {
204
+ this.onDataChannelRemoved?.(dataChannel, this.context);
205
+ }
206
+
207
+ public onAddedIceTransport?: (iceTransport: ObservedIceTransport, ctx: Context) => void;
208
+ private _onAddedIceTransport(iceTransport: ObservedIceTransport) {
209
+ this.onAddedIceTransport?.(iceTransport, this.context);
210
+ }
211
+
212
+ public onRemovedIceTransport?: (iceTransport: ObservedIceTransport, ctx: Context) => void;
213
+ private _onRemovedIceTransport(iceTransport: ObservedIceTransport) {
214
+ this.onRemovedIceTransport?.(iceTransport, this.context);
215
+ }
216
+
217
+ public onIceCandidateAdded?: (iceCandidate: ObservedIceCandidate, ctx: Context) => void;
218
+ private _onIceCandidateAdded(iceCandidate: ObservedIceCandidate) {
219
+ this.onIceCandidateAdded?.(iceCandidate, this.context);
220
+ }
221
+
222
+ public onIceCandidateRemoved?: (iceCandidate: ObservedIceCandidate, ctx: Context) => void;
223
+ private _onIceCandidateRemoved(iceCandidate: ObservedIceCandidate) {
224
+ this.onIceCandidateRemoved?.(iceCandidate, this.context);
225
+ }
226
+
227
+ public onAddedIceCandidatePair?: (candidatePair: ObservedIceCandidatePair, ctx: Context) => void;
228
+ private _onAddedIceCandidatePair(candidatePair: ObservedIceCandidatePair) {
229
+ this.onAddedIceCandidatePair?.(candidatePair, this.context);
230
+ }
231
+
232
+ public onRemovedIceCandidatePair?: (candidatePair: ObservedIceCandidatePair, ctx: Context) => void;
233
+ private _onRemovedIceCandidatePair(candidatePair: ObservedIceCandidatePair) {
234
+ this.onRemovedIceCandidatePair?.(candidatePair, this.context);
235
+ }
236
+
237
+ public onAddedMediaCodec?: (codec: ObservedCodec, ctx: Context) => void;
238
+ private _onAddedMediaCodec(codec: ObservedCodec) {
239
+ this.onAddedMediaCodec?.(codec, this.context);
240
+ }
241
+
242
+ public onRemovedMediaCodec?: (codec: ObservedCodec, ctx: Context) => void;
243
+ private _onRemovedMediaCodec(codec: ObservedCodec) {
244
+ this.onRemovedMediaCodec?.(codec, this.context);
245
+ }
246
+
247
+ public onAddedMediaPlayout?: (mediaPlayout: ObservedMediaPlayout, ctx: Context) => void;
248
+ private _onAddedMediaPlayout(mediaPlayout: ObservedMediaPlayout) {
249
+ this.onAddedMediaPlayout?.(mediaPlayout, this.context);
250
+ }
251
+
252
+ public onRemovedMediaPlayout?: (mediaPlayout: ObservedMediaPlayout, ctx: Context) => void;
253
+ private _onRemovedMediaPlayout(mediaPlayout: ObservedMediaPlayout) {
254
+ this.onRemovedMediaPlayout?.(mediaPlayout, this.context);
255
+ }
256
+
257
+ public onMediaSourceAdded?: (mediaSource: ObservedMediaSource, ctx: Context) => void;
258
+ private _onMediaSourceAdded(mediaSource: ObservedMediaSource) {
259
+ this.onMediaSourceAdded?.(mediaSource, this.context);
260
+ }
261
+
262
+ public onMediaSourceRemoved?: (mediaSource: ObservedMediaSource, ctx: Context) => void;
263
+ private _onMediaSourceRemoved(mediaSource: ObservedMediaSource) {
264
+ this.onMediaSourceRemoved?.(mediaSource, this.context);
265
+ }
266
+
267
+ public onClientIssue?: (issue: ClientIssue, ctx: Context) => void;
268
+ private _onClientIssue(issue: ClientIssue) {
269
+ this.onClientIssue?.(issue, this.context);
270
+ }
271
+
272
+ public onClientMetadata?: (metadata: ClientMetaData, ctx: Context) => void;
273
+ private _onClientMetadata(metadata: ClientMetaData) {
274
+ this.onClientMetadata?.(metadata, this.context);
275
+ }
276
+
277
+ public onClientExtensionStats?: (extensionStats: ExtensionStat, ctx: Context) => void;
278
+ private _onClientExtensionStats(extensionStats: ExtensionStat) {
279
+ this.onClientExtensionStats?.(extensionStats, this.context);
280
+ }
281
+
282
+ public onClientJoined?: (client: ObservedClient, ctx: Context) => void;
283
+ private _onClientJoined() {
284
+ this.onClientJoined?.(this.observedClient, this.context);
285
+ }
286
+
287
+ public onClientLeft?: (client: ObservedClient, ctx: Context) => void;
288
+ private _onClientLeft() {
289
+ this.onClientLeft?.(this.observedClient, this.context);
290
+ }
291
+
292
+ public onUserMediaError?: (error: string, observedClient: ObservedClient, ctx: Context) => void;
293
+ private _onUserMediaError(error: string) {
294
+ this.onUserMediaError?.(error, this.observedClient, this.context);
295
+ }
296
+
297
+ public onUsingTurn?: (client: ObservedClient, ctx: Context) => void;
298
+ private _onUsingTurn() {
299
+ this.onUsingTurn?.(this.observedClient, this.context);
300
+ }
301
+ }
package/src/Observer.ts CHANGED
@@ -54,7 +54,7 @@ export class Observer extends EventEmitter {
54
54
  public totalRttGtOrEq300Measurements = 0;
55
55
  public totalClientIssues = 0;
56
56
 
57
- public numberOfClientsUsedTurn = 0;
57
+ public numberOfClientsUsingTurn = 0;
58
58
  public numberOfClients = 0;
59
59
  public numberOfInboundRtpStreams = 0;
60
60
  public numberOfOutboundRtpStreams = 0;
@@ -186,7 +186,7 @@ export class Observer extends EventEmitter {
186
186
  this.numberOfPeerConnections = 0;
187
187
  this.numberOfDataChannels = 0;
188
188
  this.numberOfClients = 0;
189
- this.numberOfClientsUsedTurn = 0;
189
+ this.numberOfClientsUsingTurn = 0;
190
190
 
191
191
  for (const call of this.observedCalls.values()) {
192
192
  this.numberOfInboundRtpStreams += call.numberOfInboundRtpStreams;
@@ -194,7 +194,7 @@ export class Observer extends EventEmitter {
194
194
  this.numberOfPeerConnections += call.numberOfPeerConnections;
195
195
  this.numberOfDataChannels += call.numberOfDataChannels;
196
196
  this.numberOfClients += call.numberOfClients;
197
- this.numberOfClientsUsedTurn += call.clientsUsedTurn.size;
197
+ this.numberOfClientsUsingTurn += call.clientsUsedTurn.size;
198
198
  }
199
199
 
200
200
  this.observedTURN.update();
package/src/index.ts CHANGED
@@ -23,5 +23,6 @@ export { ClientEventTypes } from './schema/ClientEventTypes';
23
23
  export { ClientMetaTypes } from './schema/ClientMetaTypes';
24
24
  export { ClientSample } from './schema/ClientSample';
25
25
  export { ScoreCalculator } from './scores/ScoreCalculator';
26
+ export { ObservedClientEventMonitor } from './ObservedClientEventMonitor';
26
27
 
27
28
  export { Middleware } from './common/Middleware';
@@ -1,5 +1,51 @@
1
1
  /* eslint-disable no-shadow */
2
2
 
3
+ interface DoubleRange {
4
+ max?: number;
5
+ min?: number;
6
+ }
7
+
8
+ interface ULongRange {
9
+ max?: number;
10
+ min?: number;
11
+ }
12
+
13
+ interface MediaTrackConstraints {
14
+ aspectRatio?: DoubleRange;
15
+ autoGainControl?: boolean[];
16
+ backgroundBlur?: boolean[];
17
+ channelCount?: ULongRange;
18
+ deviceId?: string;
19
+ displaySurface?: string;
20
+ echoCancellation?: boolean[];
21
+ facingMode?: string[];
22
+ frameRate?: DoubleRange;
23
+ groupId?: string;
24
+ height?: ULongRange;
25
+ noiseSuppression?: boolean[];
26
+ sampleRate?: ULongRange;
27
+ sampleSize?: ULongRange;
28
+ width?: ULongRange;
29
+ }
30
+
31
+ interface MediaTrackCapabilities {
32
+ aspectRatio?: DoubleRange;
33
+ autoGainControl?: boolean[];
34
+ backgroundBlur?: boolean[];
35
+ channelCount?: ULongRange;
36
+ deviceId?: string;
37
+ displaySurface?: string;
38
+ echoCancellation?: boolean[];
39
+ facingMode?: string[];
40
+ frameRate?: DoubleRange;
41
+ groupId?: string;
42
+ height?: ULongRange;
43
+ noiseSuppression?: boolean[];
44
+ sampleRate?: ULongRange;
45
+ sampleSize?: ULongRange;
46
+ width?: ULongRange;
47
+ }
48
+
3
49
  export enum ClientEventTypes {
4
50
  CLIENT_JOINED = 'CLIENT_JOINED',
5
51
  CLIENT_LEFT = 'CLIENT_LEFT',