@observertc/observer-js 1.0.1-4416b1e.0 → 1.0.1-4daea92.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.
Files changed (50) hide show
  1. package/lib/ObservedCall.d.ts +2 -0
  2. package/lib/ObservedCall.d.ts.map +1 -1
  3. package/lib/ObservedCall.js +4 -0
  4. package/lib/ObservedCallEventMonitor.d.ts +103 -0
  5. package/lib/ObservedCallEventMonitor.d.ts.map +1 -0
  6. package/lib/ObservedCallEventMonitor.js +312 -0
  7. package/lib/ObservedClient.d.ts +10 -3
  8. package/lib/ObservedClient.d.ts.map +1 -1
  9. package/lib/ObservedClient.js +73 -3
  10. package/lib/Observer.d.ts +2 -0
  11. package/lib/Observer.d.ts.map +1 -1
  12. package/lib/Observer.js +10 -2
  13. package/lib/ObserverEventMonitor.d.ts +106 -0
  14. package/lib/ObserverEventMonitor.d.ts.map +1 -0
  15. package/lib/ObserverEventMonitor.js +320 -0
  16. package/lib/index.d.ts +1 -0
  17. package/lib/index.d.ts.map +1 -1
  18. package/lib/index.js +3 -1
  19. package/lib/schema/ClientEventTypes.d.ts +60 -0
  20. package/lib/schema/ClientEventTypes.d.ts.map +1 -1
  21. package/lib/updaters/{OnAllCallObserverUpdater_.d.ts → OnAllCallObserverUpdater.d.ts} +3 -1
  22. package/lib/updaters/OnAllCallObserverUpdater.d.ts.map +1 -0
  23. package/lib/updaters/{OnAllCallObserverUpdater_.js → OnAllCallObserverUpdater.js} +13 -1
  24. package/lib/updaters/OnAllClientCallUpdater.d.ts +2 -0
  25. package/lib/updaters/OnAllClientCallUpdater.d.ts.map +1 -1
  26. package/lib/updaters/OnAllClientCallUpdater.js +16 -0
  27. package/lib/updaters/{OnAnyCallObserverUpdater_.d.ts → OnAnyCallObserverUpdater.d.ts} +2 -1
  28. package/lib/updaters/OnAnyCallObserverUpdater.d.ts.map +1 -0
  29. package/lib/updaters/{OnAnyCallObserverUpdater_.js → OnAnyCallObserverUpdater.js} +11 -1
  30. package/lib/updaters/OnAnyClientCallUpdater.d.ts +1 -0
  31. package/lib/updaters/OnAnyClientCallUpdater.d.ts.map +1 -1
  32. package/lib/updaters/OnAnyClientCallUpdater.js +11 -2
  33. package/lib/utils/MediasoupRemoteTrackResolver.d.ts +25 -0
  34. package/lib/utils/MediasoupRemoteTrackResolver.d.ts.map +1 -0
  35. package/lib/utils/MediasoupRemoteTrackResolver.js +110 -0
  36. package/package.json +1 -1
  37. package/src/ObservedCall.ts +5 -0
  38. package/src/ObservedCallEventMonitor.ts +389 -0
  39. package/src/ObservedClient.ts +88 -5
  40. package/src/Observer.ts +12 -3
  41. package/src/ObserverEventMonitor.ts +398 -0
  42. package/src/index.ts +1 -0
  43. package/src/schema/ClientEventTypes.ts +64 -0
  44. package/src/updaters/{OnAllCallObserverUpdater_.ts → OnAllCallObserverUpdater.ts} +14 -1
  45. package/src/updaters/OnAllClientCallUpdater.ts +15 -0
  46. package/src/updaters/{OnAnyCallObserverUpdater_.ts → OnAnyCallObserverUpdater.ts} +11 -2
  47. package/src/updaters/OnAnyClientCallUpdater.ts +9 -2
  48. package/src/utils/MediasoupRemoteTrackResolver.ts +155 -0
  49. package/lib/updaters/OnAllCallObserverUpdater_.d.ts.map +0 -1
  50. package/lib/updaters/OnAnyCallObserverUpdater_.d.ts.map +0 -1
@@ -8,7 +8,6 @@ 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");
12
11
  const logger = (0, logger_1.createLogger)('ObservedClient');
13
12
  class ObservedClient extends events_1.EventEmitter {
14
13
  call;
@@ -89,6 +88,7 @@ class ObservedClient extends events_1.EventEmitter {
89
88
  totalNumberOfIssues = 0;
90
89
  mediaDevices = [];
91
90
  issues = [];
91
+ _injections = {};
92
92
  constructor(settings, call) {
93
93
  super();
94
94
  this.call = call;
@@ -149,6 +149,7 @@ class ObservedClient extends events_1.EventEmitter {
149
149
  this.usingTCP = false;
150
150
  this.currentMinRttInMs = undefined;
151
151
  this.currentMaxRttInMs = undefined;
152
+ this._mergeInjections(sample);
152
153
  const clientEventsPostBuffer = [];
153
154
  for (const clientEvent of sample.clientEvents ?? []) {
154
155
  this._processClientEvent(clientEvent, clientEventsPostBuffer);
@@ -392,6 +393,42 @@ class ObservedClient extends events_1.EventEmitter {
392
393
  break;
393
394
  }
394
395
  }
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;
395
432
  }
396
433
  addMetadata(metadata) {
397
434
  if (this.closed)
@@ -424,6 +461,7 @@ class ObservedClient extends events_1.EventEmitter {
424
461
  }
425
462
  addExtensionStats(stats) {
426
463
  this.call.observer.emit('client-extension-stats', this, stats);
464
+ this.emit('extensionStats', stats);
427
465
  }
428
466
  _updatePeerConnection(sample) {
429
467
  let observedPeerConnection = this.observedPeerConnections.get(sample.peerConnectionId);
@@ -441,8 +479,40 @@ class ObservedClient extends events_1.EventEmitter {
441
479
  observedPeerConnection.accept(sample);
442
480
  return observedPeerConnection;
443
481
  }
444
- createEventMonitor(ctx) {
445
- return new ObservedClientEventMonitor_1.ObservedClientEventMonitor(this, ctx ?? {});
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;
490
+ }
491
+ if (this._injections.clientIssues) {
492
+ if (!sample.clientIssues)
493
+ sample.clientIssues = [];
494
+ sample.clientIssues.push(...this._injections.clientIssues);
495
+ this._injections.clientIssues = undefined;
496
+ }
497
+ if (this._injections.extensionStats) {
498
+ if (!sample.extensionStats)
499
+ sample.extensionStats = [];
500
+ sample.extensionStats.push(...this._injections.extensionStats);
501
+ this._injections.extensionStats = undefined;
502
+ }
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;
508
+ }
509
+ if (this._injections.clientMetaItems) {
510
+ if (!sample.clientMetaItems)
511
+ sample.clientMetaItems = [];
512
+ sample.clientMetaItems.push(...this._injections.clientMetaItems);
513
+ this._injections.clientMetaItems = undefined;
514
+ }
515
+ return sample;
446
516
  }
447
517
  }
448
518
  exports.ObservedClient = ObservedClient;
package/lib/Observer.d.ts CHANGED
@@ -6,6 +6,7 @@ import { ObservedClient } from './ObservedClient';
6
6
  import { ObservedTURN } from './ObservedTURN';
7
7
  import { Detectors } from './detectors/Detectors';
8
8
  import { Updater } from './updaters/Updater';
9
+ import { ObserverEventMonitor } from './ObserverEventMonitor';
9
10
  export type ObserverEvents = {
10
11
  'client-event': [ObservedClient, ClientEvent];
11
12
  'call-updated': [ObservedCall];
@@ -57,5 +58,6 @@ export declare class Observer extends EventEmitter {
57
58
  accept(sample: ClientSample): void;
58
59
  update(): void;
59
60
  private _onObservedCallUpdated;
61
+ createEventMonitor<CTX = unknown>(ctx?: CTX): ObserverEventMonitor<CTX>;
60
62
  }
61
63
  //# sourceMappingURL=Observer.d.ts.map
@@ -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,aAAa,CAAC,CAAC;IAC1D,SAAS,EAAE,CAAC,YAAY,CAAC,CAAC;IAC1B,QAAQ,EAAE,EAAE,CAAC;IACb,OAAO,EAAE,EAAE,CAAC;CACZ,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC5B,YAAY,CAAC,EAAE,4BAA4B,GAAG,8BAA8B,GAAG,oBAAoB,CAAC;IACpG,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,uBAAuB,CAAC,EAAE,oBAAoB,CAAC,cAAc,CAA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B,SAAS,EAAE,SAAS,CAAC;IAErC,SAAgB,YAAY,eAAsB;IAClD,SAAgB,aAAa,qDAAmC;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,MAAM,UAAS;IAEf,cAAc,SAAK;IACnB,gBAAgB,SAAK;IACrB,wBAAwB,SAAK;IAC7B,yBAAyB,SAAK;IAC9B,yBAAyB,SAAK;IAC9B,6BAA6B,SAAK;IAClC,iBAAiB,SAAK;IAEtB,wBAAwB,SAAK;IAC7B,eAAe,SAAK;IACpB,yBAAyB,SAAK;IAC9B,0BAA0B,SAAK;IAC/B,oBAAoB,SAAK;IACzB,uBAAuB,SAAK;IAEnC,IAAW,aAAa,WAEvB;IAED,OAAO,CAAC,MAAM,CAAC,CAAiC;gBAEb,MAAM,GAAE,cAG1C;IAsCM,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS;IAMzH,kBAAkB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpF,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAC/B,YAAY,CAAC,CAAC,CAAC;IAgCX,KAAK;IAaL,MAAM,CAAC,MAAM,EAAE,YAAY;IAkB3B,MAAM;IA0Bb,OAAO,CAAC,sBAAsB;IAQvB,kBAAkB,CAAC,GAAG,GAAG,OAAO,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,oBAAoB,CAAC,GAAG,CAAC;CA8B9E"}
package/lib/Observer.js CHANGED
@@ -7,8 +7,10 @@ const events_1 = require("events");
7
7
  const ObservedTURN_1 = require("./ObservedTURN");
8
8
  const Detectors_1 = require("./detectors/Detectors");
9
9
  const OnIntervalUpdater_1 = require("./updaters/OnIntervalUpdater");
10
- const OnAllCallObserverUpdater_1 = require("./updaters/OnAllCallObserverUpdater_");
11
- const OnAnyCallObserverUpdater_1 = require("./updaters/OnAnyCallObserverUpdater_");
10
+ const OnAllCallObserverUpdater_1 = require("./updaters/OnAllCallObserverUpdater");
11
+ const OnAnyCallObserverUpdater_1 = require("./updaters/OnAnyCallObserverUpdater");
12
+ const ObserverEventMonitor_1 = require("./ObserverEventMonitor");
13
+ const MediasoupRemoteTrackResolver_1 = require("./utils/MediasoupRemoteTrackResolver");
12
14
  const logger = (0, logger_1.createLogger)('Observer');
13
15
  class Observer extends events_1.EventEmitter {
14
16
  config;
@@ -86,6 +88,9 @@ class Observer extends events_1.EventEmitter {
86
88
  const onCallUpdated = () => this._onObservedCallUpdated(observedCall);
87
89
  if (this.observedCalls.has(observedCall.callId))
88
90
  throw new Error(`Observed Call with id ${observedCall.callId} already exists`);
91
+ if (settings.remoteTrackResolvePolicy === 'mediasoup-sfu') {
92
+ observedCall.remoteTrackResolver = new MediasoupRemoteTrackResolver_1.MediasoupRemoteTrackResolver(observedCall);
93
+ }
89
94
  observedCall.once('close', () => {
90
95
  this.observedCalls.delete(observedCall.callId);
91
96
  observedCall.off('update', onCallUpdated);
@@ -152,5 +157,8 @@ class Observer extends events_1.EventEmitter {
152
157
  this.totalRttGtOrEq300Measurements += call.deltaRttGtOrEq300Measurements;
153
158
  this.totalClientIssues += call.deltaNumberOfIssues;
154
159
  }
160
+ createEventMonitor(ctx) {
161
+ return new ObserverEventMonitor_1.ObserverEventMonitor(this, ctx ?? {});
162
+ }
155
163
  }
156
164
  exports.Observer = Observer;
@@ -0,0 +1,106 @@
1
+ import { ObservedCall } from './ObservedCall';
2
+ import { ObservedCertificate } from './ObservedCertificate';
3
+ import { ObservedClient } from './ObservedClient';
4
+ import { ObservedCodec } from './ObservedCodec';
5
+ import { ObservedDataChannel } from './ObservedDataChannel';
6
+ import { ObservedIceCandidate } from './ObservedIceCandidate';
7
+ import { ObservedIceCandidatePair } from './ObservedIceCandidatePair';
8
+ import { ObservedIceTransport } from './ObservedIceTransport';
9
+ import { ObservedInboundRtp } from './ObservedInboundRtp';
10
+ import { ObservedInboundTrack } from './ObservedInboundTrack';
11
+ import { ObservedMediaPlayout } from './ObservedMediaPlayout';
12
+ import { ObservedMediaSource } from './ObservedMediaSource';
13
+ import { ObservedOutboundRtp } from './ObservedOutboundRtp';
14
+ import { ObservedOutboundTrack } from './ObservedOutboundTrack';
15
+ import { ObservedPeerConnection } from './ObservedPeerConnection';
16
+ import { Observer } from './Observer';
17
+ import { ClientEvent, ClientIssue, ClientMetaData, ClientSample, ExtensionStat } from './schema/ClientSample';
18
+ export declare class ObserverEventMonitor<Context> {
19
+ readonly observer: Observer;
20
+ readonly context: Context;
21
+ constructor(observer: Observer, context: Context);
22
+ onCallAdded?: (call: ObservedCall, ctx: Context) => void;
23
+ onCallRemoved?: (call: ObservedCall, ctx: Context) => void;
24
+ onCallEmpty?: (call: ObservedCall, ctx: Context) => void;
25
+ onCallNotEmpty?: (call: ObservedCall, ctx: Context) => void;
26
+ onCallUpdated?: (call: ObservedCall, ctx: Context) => void;
27
+ onClientAdded?: (client: ObservedClient, ctx: Context) => void;
28
+ onClientClosed?: (client: ObservedClient, ctx: Context) => void;
29
+ onClientRejoined?: (client: ObservedClient, ctx: Context) => void;
30
+ onClientIssue?: (observedClent: ObservedClient, issue: ClientIssue, ctx: Context) => void;
31
+ onClientMetadata?: (observedClient: ObservedClient, metadata: ClientMetaData, ctx: Context) => void;
32
+ onClientExtensionStats?: (observedClient: ObservedClient, extensionStats: ExtensionStat, ctx: Context) => void;
33
+ onClientJoined?: (client: ObservedClient, ctx: Context) => void;
34
+ onClientLeft?: (client: ObservedClient, ctx: Context) => void;
35
+ onClientUserMediaError?: (observedClient: ObservedClient, error: string, ctx: Context) => void;
36
+ onClientUsingTurn?: (client: ObservedClient, usingTurn: boolean, ctx: Context) => void;
37
+ onClientUpdated?: (client: ObservedClient, sample: ClientSample, ctx: Context) => void;
38
+ onClientEvent?: (client: ObservedClient, event: ClientEvent, ctx: Context) => void;
39
+ onPeerConnectionAdded?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
40
+ onPeerConnectionRemoved?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
41
+ onSelectedCandidatePairChanged?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
42
+ onIceGatheringStateChange?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
43
+ onIceConnectionStateChange?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
44
+ onConnectionStateChange?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
45
+ onCertificateAdded?: (certificate: ObservedCertificate, ctx: Context) => void;
46
+ onCertificateRemoved?: (certificate: ObservedCertificate, ctx: Context) => void;
47
+ onInboundTrackAdded?: (inboundTrack: ObservedInboundTrack, ctx: Context) => void;
48
+ onInboundTrackRemoved?: (inboundTrack: ObservedInboundTrack, ctx: Context) => void;
49
+ onOutboundTrackAdded?: (outboundTrack: ObservedOutboundTrack, ctx: Context) => void;
50
+ onOutboundTrackRemoved?: (outboundTrack: ObservedOutboundTrack, ctx: Context) => void;
51
+ onInboundRtpAdded?: (inboundRtp: ObservedInboundRtp, ctx: Context) => void;
52
+ onInboundRtpRemoved?: (inboundRtp: ObservedInboundRtp, ctx: Context) => void;
53
+ onOutboundRtpAdded?: (outboundRtp: ObservedOutboundRtp, ctx: Context) => void;
54
+ onOutboundRtpRemoved?: (outboundRtp: ObservedOutboundRtp, ctx: Context) => void;
55
+ onDataChannelAdded?: (dataChannel: ObservedDataChannel, ctx: Context) => void;
56
+ onDataChannelRemoved?: (dataChannel: ObservedDataChannel, ctx: Context) => void;
57
+ onAddedIceTransport?: (iceTransport: ObservedIceTransport, ctx: Context) => void;
58
+ onRemovedIceTransport?: (iceTransport: ObservedIceTransport, ctx: Context) => void;
59
+ onIceCandidateAdded?: (iceCandidate: ObservedIceCandidate, ctx: Context) => void;
60
+ onIceCandidateRemoved?: (iceCandidate: ObservedIceCandidate, ctx: Context) => void;
61
+ onAddedIceCandidatePair?: (candidatePair: ObservedIceCandidatePair, ctx: Context) => void;
62
+ onRemovedIceCandidatePair?: (candidatePair: ObservedIceCandidatePair, ctx: Context) => void;
63
+ onAddedMediaCodec?: (codec: ObservedCodec, ctx: Context) => void;
64
+ onRemovedMediaCodec?: (codec: ObservedCodec, ctx: Context) => void;
65
+ onAddedMediaPlayout?: (mediaPlayout: ObservedMediaPlayout, ctx: Context) => void;
66
+ onRemovedMediaPlayout?: (mediaPlayout: ObservedMediaPlayout, ctx: Context) => void;
67
+ onMediaSourceAdded?: (mediaSource: ObservedMediaSource, ctx: Context) => void;
68
+ onMediaSourceRemoved?: (mediaSource: ObservedMediaSource, ctx: Context) => void;
69
+ private _onCallAdded;
70
+ private _onClientAdded;
71
+ private _onClientRejoined;
72
+ private _onPeerConnconnectionAdded;
73
+ private _onPeerConnectionRemoved;
74
+ private _onCertificateAdded;
75
+ private _onCertificateRemoved;
76
+ private _onInboundTrackAdded;
77
+ private _onInboundTrackRemoved;
78
+ private _onOutboundTrackAdded;
79
+ private _onOutboundTrackRemoved;
80
+ private _onInboundRtpAdded;
81
+ private _onInboundRtpRemoved;
82
+ private _onOutboundRtpAdded;
83
+ private _onOutboundRtpRemoved;
84
+ private _onDataChannelAdded;
85
+ private _onDataChannelRemoved;
86
+ private _onAddedIceTransport;
87
+ private _onRemovedIceTransport;
88
+ private _onIceCandidateAdded;
89
+ private _onIceCandidateRemoved;
90
+ private _onAddedIceCandidatePair;
91
+ private _onRemovedIceCandidatePair;
92
+ private _onAddedMediaCodec;
93
+ private _onRemovedMediaCodec;
94
+ private _onAddedMediaPlayout;
95
+ private _onRemovedMediaPlayout;
96
+ private _onMediaSourceAdded;
97
+ private _onMediaSourceRemoved;
98
+ private _onClientIssue;
99
+ private _onClientMetadata;
100
+ private _onClientExtensionStats;
101
+ private _onClientJoined;
102
+ private _onClientLeft;
103
+ private _onUserMediaError;
104
+ private _onUsingTurn;
105
+ }
106
+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,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,sBAAsB;IAI9B,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,sBAAsB;IAI9B,OAAO,CAAC,wBAAwB;IAIhC,OAAO,CAAC,0BAA0B;IAIlC,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,sBAAsB;IAI9B,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,uBAAuB;IAI/B,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,YAAY;CAGpB"}
@@ -0,0 +1,320 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ObserverEventMonitor = void 0;
4
+ class ObserverEventMonitor {
5
+ observer;
6
+ context;
7
+ constructor(observer, context) {
8
+ this.observer = observer;
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._onClientIssue = this._onClientIssue.bind(this);
37
+ this._onClientMetadata = this._onClientMetadata.bind(this);
38
+ this._onClientJoined = this._onClientJoined.bind(this);
39
+ this._onClientLeft = this._onClientLeft.bind(this);
40
+ this._onUserMediaError = this._onUserMediaError.bind(this);
41
+ this._onUsingTurn = this._onUsingTurn.bind(this);
42
+ this._onClientAdded = this._onClientAdded.bind(this);
43
+ this._onCallAdded = this._onCallAdded.bind(this);
44
+ this._onClientRejoined = this._onClientRejoined.bind(this);
45
+ this._onClientExtensionStats = this._onClientExtensionStats.bind(this);
46
+ this.observer.once('close', () => {
47
+ this.observer.off('newcall', this._onCallAdded);
48
+ });
49
+ this.observer.on('newcall', this._onCallAdded);
50
+ }
51
+ // Public event handlers
52
+ onCallAdded;
53
+ onCallRemoved;
54
+ onCallEmpty;
55
+ onCallNotEmpty;
56
+ onCallUpdated;
57
+ onClientAdded;
58
+ onClientClosed;
59
+ onClientRejoined;
60
+ onClientIssue;
61
+ onClientMetadata;
62
+ onClientExtensionStats;
63
+ onClientJoined;
64
+ onClientLeft;
65
+ onClientUserMediaError;
66
+ onClientUsingTurn;
67
+ onClientUpdated;
68
+ onClientEvent;
69
+ onPeerConnectionAdded;
70
+ onPeerConnectionRemoved;
71
+ onSelectedCandidatePairChanged;
72
+ onIceGatheringStateChange;
73
+ onIceConnectionStateChange;
74
+ onConnectionStateChange;
75
+ onCertificateAdded;
76
+ onCertificateRemoved;
77
+ onInboundTrackAdded;
78
+ onInboundTrackRemoved;
79
+ onOutboundTrackAdded;
80
+ onOutboundTrackRemoved;
81
+ onInboundRtpAdded;
82
+ onInboundRtpRemoved;
83
+ onOutboundRtpAdded;
84
+ onOutboundRtpRemoved;
85
+ onDataChannelAdded;
86
+ onDataChannelRemoved;
87
+ onAddedIceTransport;
88
+ onRemovedIceTransport;
89
+ onIceCandidateAdded;
90
+ onIceCandidateRemoved;
91
+ onAddedIceCandidatePair;
92
+ onRemovedIceCandidatePair;
93
+ onAddedMediaCodec;
94
+ onRemovedMediaCodec;
95
+ onAddedMediaPlayout;
96
+ onRemovedMediaPlayout;
97
+ onMediaSourceAdded;
98
+ onMediaSourceRemoved;
99
+ _onCallAdded(call) {
100
+ const onCallEmpty = () => this.onCallEmpty?.(call, this.context);
101
+ const onCallNotEmpty = () => this.onCallNotEmpty?.(call, this.context);
102
+ const onCallUpdated = () => this.onCallUpdated?.(call, this.context);
103
+ call.once('close', () => {
104
+ call.off('newclient', this._onClientAdded);
105
+ call.off('empty', onCallEmpty);
106
+ call.off('not-empty', onCallNotEmpty);
107
+ call.off('update', onCallUpdated);
108
+ this.onCallRemoved?.(call, this.context);
109
+ });
110
+ call.on('newclient', this._onClientAdded);
111
+ call.on('empty', onCallEmpty);
112
+ call.on('not-empty', onCallNotEmpty);
113
+ call.on('update', onCallUpdated);
114
+ this.onCallAdded?.(call, this.context);
115
+ }
116
+ _onClientAdded(observedClient) {
117
+ const onClientIssue = (issue) => this._onClientIssue(observedClient, issue);
118
+ const onClientMetadata = (metaData) => this._onClientMetadata(observedClient, metaData);
119
+ const onClientJoined = () => this._onClientJoined(observedClient);
120
+ const onClientLeft = () => this._onClientLeft(observedClient);
121
+ const onClientRejoined = () => this._onClientRejoined(observedClient);
122
+ const onClientExtensionStats = (extensionStats) => this._onClientExtensionStats(observedClient, extensionStats);
123
+ const onUsingTurn = (usingTurn) => this._onUsingTurn(observedClient, usingTurn);
124
+ const onUserMediaError = (error) => this._onUserMediaError(observedClient, error);
125
+ const onClientUpdated = (...args) => this.onClientUpdated?.(observedClient, args[0].sample, this.context);
126
+ const onClientEvent = (event) => this.onClientEvent?.(observedClient, event, this.context);
127
+ observedClient.once('close', () => {
128
+ observedClient.off('newpeerconnection', this._onPeerConnconnectionAdded);
129
+ observedClient.off('issue', onClientIssue);
130
+ observedClient.off('metaData', onClientMetadata);
131
+ observedClient.off('joined', onClientJoined);
132
+ observedClient.off('left', onClientLeft);
133
+ observedClient.off('rejoined', onClientJoined);
134
+ observedClient.off('usermediaerror', onUserMediaError);
135
+ observedClient.off('usingturn', onUsingTurn);
136
+ observedClient.off('extensionStats', onClientExtensionStats);
137
+ observedClient.off('update', onClientUpdated);
138
+ observedClient.off('clientEvent', onClientEvent);
139
+ this.onClientClosed?.(observedClient, this.context);
140
+ });
141
+ observedClient.on('newpeerconnection', this._onPeerConnconnectionAdded);
142
+ observedClient.on('issue', onClientIssue);
143
+ observedClient.on('metaData', onClientMetadata);
144
+ observedClient.on('joined', onClientJoined);
145
+ observedClient.on('left', onClientLeft);
146
+ observedClient.on('rejoined', onClientRejoined);
147
+ observedClient.on('usermediaerror', onUserMediaError);
148
+ observedClient.on('usingturn', onUsingTurn);
149
+ observedClient.on('extensionStats', onClientExtensionStats);
150
+ observedClient.on('update', onClientUpdated);
151
+ observedClient.on('clientEvent', onClientEvent);
152
+ this.onClientAdded?.(observedClient, this.context);
153
+ }
154
+ _onClientRejoined(observedClient) {
155
+ this.onClientRejoined?.(observedClient, this.context);
156
+ }
157
+ _onPeerConnconnectionAdded(peerConnection) {
158
+ const onSelectedCandidatePairChanged = () => this.onSelectedCandidatePairChanged?.(peerConnection, this.context);
159
+ const onIceGatheringStateChange = () => this.onIceGatheringStateChange?.(peerConnection, this.context);
160
+ const onIceConnectionStateChange = () => this.onIceConnectionStateChange?.(peerConnection, this.context);
161
+ const onConnectionStateChange = () => this.onConnectionStateChange?.(peerConnection, this.context);
162
+ peerConnection.once('close', () => {
163
+ peerConnection.off('added-certificate', this._onCertificateAdded);
164
+ peerConnection.off('removed-certificate', this._onCertificateRemoved);
165
+ peerConnection.off('added-inbound-track', this._onInboundTrackAdded);
166
+ peerConnection.off('removed-inbound-track', this._onInboundTrackRemoved);
167
+ peerConnection.off('added-outbound-track', this._onOutboundTrackAdded);
168
+ peerConnection.off('removed-outbound-track', this._onOutboundTrackRemoved);
169
+ peerConnection.off('added-inbound-rtp', this._onInboundRtpAdded);
170
+ peerConnection.off('removed-inbound-rtp', this._onInboundRtpRemoved);
171
+ peerConnection.off('added-outbound-rtp', this._onOutboundRtpAdded);
172
+ peerConnection.off('removed-outbound-rtp', this._onOutboundRtpRemoved);
173
+ peerConnection.off('added-data-channel', this._onDataChannelAdded);
174
+ peerConnection.off('removed-data-channel', this._onDataChannelRemoved);
175
+ peerConnection.off('added-ice-transport', this._onAddedIceTransport);
176
+ peerConnection.off('removed-ice-transport', this._onRemovedIceTransport);
177
+ peerConnection.off('added-ice-candidate', this._onIceCandidateAdded);
178
+ peerConnection.off('removed-ice-candidate', this._onIceCandidateRemoved);
179
+ peerConnection.off('added-ice-candidate-pair', this._onAddedIceCandidatePair);
180
+ peerConnection.off('removed-ice-candidate-pair', this._onRemovedIceCandidatePair);
181
+ peerConnection.off('added-codec', this._onAddedMediaCodec);
182
+ peerConnection.off('removed-codec', this._onRemovedMediaCodec);
183
+ peerConnection.off('added-media-playout', this._onAddedMediaPlayout);
184
+ peerConnection.off('removed-media-playout', this._onRemovedMediaPlayout);
185
+ peerConnection.off('added-media-source', this._onMediaSourceAdded);
186
+ peerConnection.off('removed-media-source', this._onMediaSourceRemoved);
187
+ peerConnection.off('selectedcandidatepair', onSelectedCandidatePairChanged);
188
+ peerConnection.off('icegatheringstatechange', onIceGatheringStateChange);
189
+ peerConnection.off('iceconnectionstatechange', onIceConnectionStateChange);
190
+ peerConnection.off('connectionstatechange', onConnectionStateChange);
191
+ this.onPeerConnectionRemoved?.(peerConnection, this.context);
192
+ });
193
+ peerConnection.on('added-certificate', this._onCertificateAdded);
194
+ peerConnection.on('removed-certificate', this._onCertificateRemoved);
195
+ peerConnection.on('added-inbound-track', this._onInboundTrackAdded);
196
+ peerConnection.on('removed-inbound-track', this._onInboundTrackRemoved);
197
+ peerConnection.on('added-outbound-track', this._onOutboundTrackAdded);
198
+ peerConnection.on('removed-outbound-track', this._onOutboundTrackRemoved);
199
+ peerConnection.on('added-inbound-rtp', this._onInboundRtpAdded);
200
+ peerConnection.on('removed-inbound-rtp', this._onInboundRtpRemoved);
201
+ peerConnection.on('added-outbound-rtp', this._onOutboundRtpAdded);
202
+ peerConnection.on('removed-outbound-rtp', this._onOutboundRtpRemoved);
203
+ peerConnection.on('added-data-channel', this._onDataChannelAdded);
204
+ peerConnection.on('removed-data-channel', this._onDataChannelRemoved);
205
+ peerConnection.on('added-ice-transport', this._onAddedIceTransport);
206
+ peerConnection.on('removed-ice-transport', this._onRemovedIceTransport);
207
+ peerConnection.on('added-ice-candidate', this._onIceCandidateAdded);
208
+ peerConnection.on('removed-ice-candidate', this._onIceCandidateRemoved);
209
+ peerConnection.on('added-ice-candidate-pair', this._onAddedIceCandidatePair);
210
+ peerConnection.on('removed-ice-candidate-pair', this._onRemovedIceCandidatePair);
211
+ peerConnection.on('added-codec', this._onAddedMediaCodec);
212
+ peerConnection.on('removed-codec', this._onRemovedMediaCodec);
213
+ peerConnection.on('added-media-playout', this._onAddedMediaPlayout);
214
+ peerConnection.on('removed-media-playout', this._onRemovedMediaPlayout);
215
+ peerConnection.on('added-media-source', this._onMediaSourceAdded);
216
+ peerConnection.on('removed-media-source', this._onMediaSourceRemoved);
217
+ peerConnection.on('selectedcandidatepair', onSelectedCandidatePairChanged);
218
+ peerConnection.on('icegatheringstatechange', onIceGatheringStateChange);
219
+ peerConnection.on('iceconnectionstatechange', onIceConnectionStateChange);
220
+ peerConnection.on('connectionstatechange', onConnectionStateChange);
221
+ this.onPeerConnectionAdded?.(peerConnection, this.context);
222
+ }
223
+ _onPeerConnectionRemoved(peerConnection) {
224
+ this.onPeerConnectionRemoved?.(peerConnection, this.context);
225
+ }
226
+ _onCertificateAdded(certificate) {
227
+ this.onCertificateAdded?.(certificate, this.context);
228
+ }
229
+ _onCertificateRemoved(certificate) {
230
+ this.onCertificateRemoved?.(certificate, this.context);
231
+ }
232
+ _onInboundTrackAdded(inboundTrack) {
233
+ this.onInboundTrackAdded?.(inboundTrack, this.context);
234
+ }
235
+ _onInboundTrackRemoved(inboundTrack) {
236
+ this.onInboundTrackRemoved?.(inboundTrack, this.context);
237
+ }
238
+ _onOutboundTrackAdded(outboundTrack) {
239
+ this.onOutboundTrackAdded?.(outboundTrack, this.context);
240
+ }
241
+ _onOutboundTrackRemoved(outboundTrack) {
242
+ this.onOutboundTrackRemoved?.(outboundTrack, this.context);
243
+ }
244
+ _onInboundRtpAdded(inboundRtp) {
245
+ this.onInboundRtpAdded?.(inboundRtp, this.context);
246
+ }
247
+ _onInboundRtpRemoved(inboundRtp) {
248
+ this.onInboundRtpRemoved?.(inboundRtp, this.context);
249
+ }
250
+ _onOutboundRtpAdded(outboundRtp) {
251
+ this.onOutboundRtpAdded?.(outboundRtp, this.context);
252
+ }
253
+ _onOutboundRtpRemoved(outboundRtp) {
254
+ this.onOutboundRtpRemoved?.(outboundRtp, this.context);
255
+ }
256
+ _onDataChannelAdded(dataChannel) {
257
+ this.onDataChannelAdded?.(dataChannel, this.context);
258
+ }
259
+ _onDataChannelRemoved(dataChannel) {
260
+ this.onDataChannelRemoved?.(dataChannel, this.context);
261
+ }
262
+ _onAddedIceTransport(iceTransport) {
263
+ this.onAddedIceTransport?.(iceTransport, this.context);
264
+ }
265
+ _onRemovedIceTransport(iceTransport) {
266
+ this.onRemovedIceTransport?.(iceTransport, this.context);
267
+ }
268
+ _onIceCandidateAdded(iceCandidate) {
269
+ this.onIceCandidateAdded?.(iceCandidate, this.context);
270
+ }
271
+ _onIceCandidateRemoved(iceCandidate) {
272
+ this.onIceCandidateRemoved?.(iceCandidate, this.context);
273
+ }
274
+ _onAddedIceCandidatePair(candidatePair) {
275
+ this.onAddedIceCandidatePair?.(candidatePair, this.context);
276
+ }
277
+ _onRemovedIceCandidatePair(candidatePair) {
278
+ this.onRemovedIceCandidatePair?.(candidatePair, this.context);
279
+ }
280
+ _onAddedMediaCodec(codec) {
281
+ this.onAddedMediaCodec?.(codec, this.context);
282
+ }
283
+ _onRemovedMediaCodec(codec) {
284
+ this.onRemovedMediaCodec?.(codec, this.context);
285
+ }
286
+ _onAddedMediaPlayout(mediaPlayout) {
287
+ this.onAddedMediaPlayout?.(mediaPlayout, this.context);
288
+ }
289
+ _onRemovedMediaPlayout(mediaPlayout) {
290
+ this.onRemovedMediaPlayout?.(mediaPlayout, this.context);
291
+ }
292
+ _onMediaSourceAdded(mediaSource) {
293
+ this.onMediaSourceAdded?.(mediaSource, this.context);
294
+ }
295
+ _onMediaSourceRemoved(mediaSource) {
296
+ this.onMediaSourceRemoved?.(mediaSource, this.context);
297
+ }
298
+ _onClientIssue(observedClent, issue) {
299
+ this.onClientIssue?.(observedClent, issue, this.context);
300
+ }
301
+ _onClientMetadata(observedClient, metadata) {
302
+ this.onClientMetadata?.(observedClient, metadata, this.context);
303
+ }
304
+ _onClientExtensionStats(observedClient, extensionStats) {
305
+ this.onClientExtensionStats?.(observedClient, extensionStats, this.context);
306
+ }
307
+ _onClientJoined(observedClient) {
308
+ this.onClientJoined?.(observedClient, this.context);
309
+ }
310
+ _onClientLeft(observedClient) {
311
+ this.onClientLeft?.(observedClient, this.context);
312
+ }
313
+ _onUserMediaError(observedClient, error) {
314
+ this.onClientUserMediaError?.(observedClient, error, this.context);
315
+ }
316
+ _onUsingTurn(observedClient, usingTurn) {
317
+ this.onClientUsingTurn?.(observedClient, usingTurn, this.context);
318
+ }
319
+ }
320
+ exports.ObserverEventMonitor = ObserverEventMonitor;
package/lib/index.d.ts CHANGED
@@ -23,5 +23,6 @@ export { ClientMetaTypes } from './schema/ClientMetaTypes';
23
23
  export { ClientSample } from './schema/ClientSample';
24
24
  export { ScoreCalculator } from './scores/ScoreCalculator';
25
25
  export { ObservedClientEventMonitor } from './ObservedClientEventMonitor';
26
+ export { ObserverEventMonitor } from './ObserverEventMonitor';
26
27
  export { Middleware } from './common/Middleware';
27
28
  //# 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,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,mB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AAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,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.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;
3
+ exports.ObserverEventMonitor = 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");
@@ -45,3 +45,5 @@ var ClientMetaTypes_1 = require("./schema/ClientMetaTypes");
45
45
  Object.defineProperty(exports, "ClientMetaTypes", { enumerable: true, get: function () { return ClientMetaTypes_1.ClientMetaTypes; } });
46
46
  var ObservedClientEventMonitor_1 = require("./ObservedClientEventMonitor");
47
47
  Object.defineProperty(exports, "ObservedClientEventMonitor", { enumerable: true, get: function () { return ObservedClientEventMonitor_1.ObservedClientEventMonitor; } });
48
+ var ObserverEventMonitor_1 = require("./ObserverEventMonitor");
49
+ Object.defineProperty(exports, "ObserverEventMonitor", { enumerable: true, get: function () { return ObserverEventMonitor_1.ObserverEventMonitor; } });