@observertc/observer-js 1.0.1-9d3744d.0 → 1.0.1-a6fb9d3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +535 -1
- package/lib/ObservedCall.d.ts +8 -7
- package/lib/ObservedCall.d.ts.map +1 -1
- package/lib/ObservedCall.js +42 -38
- package/lib/ObservedCallEventMonitor.d.ts +104 -0
- package/lib/ObservedCallEventMonitor.d.ts.map +1 -0
- package/lib/ObservedCallEventMonitor.js +314 -0
- package/lib/ObservedClient.d.ts +20 -10
- package/lib/ObservedClient.d.ts.map +1 -1
- package/lib/ObservedClient.js +330 -13
- package/lib/ObservedClientEventMonitor.d.ts +91 -0
- package/lib/ObservedClientEventMonitor.d.ts.map +1 -0
- package/lib/ObservedClientEventMonitor.js +254 -0
- package/lib/ObservedTURN.d.ts +1 -1
- package/lib/ObservedTURN.d.ts.map +1 -1
- package/lib/ObservedTURN.js +1 -0
- package/lib/ObservedTurnServer.d.ts +2 -2
- package/lib/ObservedTurnServer.d.ts.map +1 -1
- package/lib/Observer.d.ts +9 -6
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +26 -25
- package/lib/ObserverEventMonitor.d.ts +138 -0
- package/lib/ObserverEventMonitor.d.ts.map +1 -0
- package/lib/ObserverEventMonitor.js +433 -0
- package/lib/common/ObserverSummary.d.ts.map +1 -0
- package/lib/common/SummaryTypes.d.ts +75 -0
- package/lib/common/SummaryTypes.d.ts.map +1 -0
- package/lib/common/SummaryTypes.js +2 -0
- package/lib/index.d.ts +19 -17
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +21 -17
- package/lib/mediasoup/ObservedMediasoupRouter.d.ts +7 -0
- package/lib/mediasoup/ObservedMediasoupRouter.d.ts.map +1 -0
- package/lib/mediasoup/ObservedMediasoupRouter.js +12 -0
- package/lib/monitors/SummaryMonitor.d.ts +19 -0
- package/lib/monitors/SummaryMonitor.d.ts.map +1 -0
- package/lib/monitors/SummaryMonitor.js +129 -0
- package/lib/schema/ClientEventTypes.d.ts +147 -19
- package/lib/schema/ClientEventTypes.d.ts.map +1 -1
- package/lib/schema/ClientEventTypes.js +5 -2
- package/lib/schema/ClientSample.d.ts +1 -1
- package/lib/schema/ClientSample.d.ts.map +1 -1
- package/lib/updaters/{OnAllCallObserverUpdater_.d.ts → OnAllCallObserverUpdater.d.ts} +3 -1
- package/lib/updaters/OnAllCallObserverUpdater.d.ts.map +1 -0
- package/lib/updaters/{OnAllCallObserverUpdater_.js → OnAllCallObserverUpdater.js} +13 -1
- package/lib/updaters/OnAllClientCallUpdater.d.ts +2 -0
- package/lib/updaters/OnAllClientCallUpdater.d.ts.map +1 -1
- package/lib/updaters/OnAllClientCallUpdater.js +16 -0
- package/lib/updaters/{OnAnyCallObserverUpdater_.d.ts → OnAnyCallObserverUpdater.d.ts} +2 -1
- package/lib/updaters/OnAnyCallObserverUpdater.d.ts.map +1 -0
- package/lib/updaters/{OnAnyCallObserverUpdater_.js → OnAnyCallObserverUpdater.js} +11 -1
- package/lib/updaters/OnAnyClientCallUpdater.d.ts +1 -0
- package/lib/updaters/OnAnyClientCallUpdater.d.ts.map +1 -1
- package/lib/updaters/OnAnyClientCallUpdater.js +11 -2
- package/lib/utils/MediasoupRemoteTrackResolver.d.ts +25 -0
- package/lib/utils/MediasoupRemoteTrackResolver.d.ts.map +1 -0
- package/lib/utils/MediasoupRemoteTrackResolver.js +110 -0
- package/lib/utils/RemoteTrackResolver.d.ts +2 -2
- package/lib/utils/RemoteTrackResolver.d.ts.map +1 -1
- package/lib/{ObservedCertificate.d.ts → webrtc/ObservedCertificate.d.ts} +1 -1
- package/lib/webrtc/ObservedCertificate.d.ts.map +1 -0
- package/lib/{ObservedCodec.d.ts → webrtc/ObservedCodec.d.ts} +1 -1
- package/lib/webrtc/ObservedCodec.d.ts.map +1 -0
- package/lib/{ObservedDataChannel.d.ts → webrtc/ObservedDataChannel.d.ts} +3 -1
- package/lib/webrtc/ObservedDataChannel.d.ts.map +1 -0
- package/lib/{ObservedDataChannel.js → webrtc/ObservedDataChannel.js} +2 -0
- package/lib/{ObservedIceCandidate.d.ts → webrtc/ObservedIceCandidate.d.ts} +1 -1
- package/lib/webrtc/ObservedIceCandidate.d.ts.map +1 -0
- package/lib/{ObservedIceCandidatePair.d.ts → webrtc/ObservedIceCandidatePair.d.ts} +3 -2
- package/lib/webrtc/ObservedIceCandidatePair.d.ts.map +1 -0
- package/lib/{ObservedIceCandidatePair.js → webrtc/ObservedIceCandidatePair.js} +17 -1
- package/lib/{ObservedIceTransport.d.ts → webrtc/ObservedIceTransport.d.ts} +1 -1
- package/lib/webrtc/ObservedIceTransport.d.ts.map +1 -0
- package/lib/{ObservedInboundRtp.d.ts → webrtc/ObservedInboundRtp.d.ts} +2 -2
- package/lib/webrtc/ObservedInboundRtp.d.ts.map +1 -0
- package/lib/{ObservedInboundTrack.d.ts → webrtc/ObservedInboundTrack.d.ts} +7 -4
- package/lib/webrtc/ObservedInboundTrack.d.ts.map +1 -0
- package/lib/{ObservedInboundTrack.js → webrtc/ObservedInboundTrack.js} +4 -1
- package/lib/{ObservedMediaPlayout.d.ts → webrtc/ObservedMediaPlayout.d.ts} +2 -2
- package/lib/webrtc/ObservedMediaPlayout.d.ts.map +1 -0
- package/lib/{ObservedMediaSource.d.ts → webrtc/ObservedMediaSource.d.ts} +2 -2
- package/lib/webrtc/ObservedMediaSource.d.ts.map +1 -0
- package/lib/{ObservedOutboundRtp.d.ts → webrtc/ObservedOutboundRtp.d.ts} +2 -2
- package/lib/webrtc/ObservedOutboundRtp.d.ts.map +1 -0
- package/lib/{ObservedOutboundTrack.d.ts → webrtc/ObservedOutboundTrack.d.ts} +7 -4
- package/lib/webrtc/ObservedOutboundTrack.d.ts.map +1 -0
- package/lib/{ObservedOutboundTrack.js → webrtc/ObservedOutboundTrack.js} +4 -1
- package/lib/{ObservedPeerConnection.d.ts → webrtc/ObservedPeerConnection.d.ts} +26 -4
- package/lib/webrtc/ObservedPeerConnection.d.ts.map +1 -0
- package/lib/{ObservedPeerConnection.js → webrtc/ObservedPeerConnection.js} +82 -17
- package/lib/{ObservedPeerConnectionTransport.d.ts → webrtc/ObservedPeerConnectionTransport.d.ts} +1 -1
- package/lib/webrtc/ObservedPeerConnectionTransport.d.ts.map +1 -0
- package/lib/{ObservedRemoteInboundRtp.d.ts → webrtc/ObservedRemoteInboundRtp.d.ts} +2 -2
- package/lib/webrtc/ObservedRemoteInboundRtp.d.ts.map +1 -0
- package/lib/{ObservedRemoteOutboundRtp.d.ts → webrtc/ObservedRemoteOutboundRtp.d.ts} +2 -2
- package/lib/webrtc/ObservedRemoteOutboundRtp.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/ObservedCall.ts +44 -48
- package/src/ObservedCallEventMonitor.ts +392 -0
- package/src/ObservedClient.ts +363 -22
- package/src/ObservedClientEventMonitor.ts +309 -0
- package/src/ObservedTURN.ts +2 -1
- package/src/ObservedTurnServer.ts +2 -2
- package/src/Observer.ts +37 -33
- package/src/ObserverEventMonitor.ts +551 -0
- package/src/common/SummaryTypes.ts +91 -0
- package/src/index.ts +19 -18
- package/src/mediasoup/ObservedMediasoupRouter.ts +12 -0
- package/src/monitors/SummaryMonitor.ts +181 -0
- package/src/schema/ClientEventTypes.ts +187 -19
- package/src/schema/ClientSample.ts +1 -1
- package/src/updaters/{OnAllCallObserverUpdater_.ts → OnAllCallObserverUpdater.ts} +14 -1
- package/src/updaters/OnAllClientCallUpdater.ts +15 -0
- package/src/updaters/{OnAnyCallObserverUpdater_.ts → OnAnyCallObserverUpdater.ts} +12 -3
- package/src/updaters/OnAnyClientCallUpdater.ts +9 -2
- package/src/utils/MediasoupRemoteTrackResolver.ts +155 -0
- package/src/utils/RemoteTrackResolver.ts +2 -2
- package/src/{ObservedCertificate.ts → webrtc/ObservedCertificate.ts} +1 -1
- package/src/{ObservedCodec.ts → webrtc/ObservedCodec.ts} +1 -1
- package/src/{ObservedDataChannel.ts → webrtc/ObservedDataChannel.ts} +4 -1
- package/src/{ObservedIceCandidate.ts → webrtc/ObservedIceCandidate.ts} +1 -1
- package/src/{ObservedIceCandidatePair.ts → webrtc/ObservedIceCandidatePair.ts} +19 -3
- package/src/{ObservedIceTransport.ts → webrtc/ObservedIceTransport.ts} +1 -1
- package/src/{ObservedInboundRtp.ts → webrtc/ObservedInboundRtp.ts} +2 -2
- package/src/{ObservedInboundTrack.ts → webrtc/ObservedInboundTrack.ts} +9 -4
- package/src/{ObservedMediaPlayout.ts → webrtc/ObservedMediaPlayout.ts} +2 -2
- package/src/{ObservedMediaSource.ts → webrtc/ObservedMediaSource.ts} +2 -2
- package/src/{ObservedOutboundRtp.ts → webrtc/ObservedOutboundRtp.ts} +2 -2
- package/src/{ObservedOutboundTrack.ts → webrtc/ObservedOutboundTrack.ts} +9 -4
- package/src/{ObservedPeerConnection.ts → webrtc/ObservedPeerConnection.ts} +124 -37
- package/src/{ObservedPeerConnectionTransport.ts → webrtc/ObservedPeerConnectionTransport.ts} +1 -1
- package/src/{ObservedRemoteInboundRtp.ts → webrtc/ObservedRemoteInboundRtp.ts} +2 -2
- package/src/{ObservedRemoteOutboundRtp.ts → webrtc/ObservedRemoteOutboundRtp.ts} +2 -2
- package/lib/ObservedCertificate.d.ts.map +0 -1
- package/lib/ObservedCodec.d.ts.map +0 -1
- package/lib/ObservedDataChannel.d.ts.map +0 -1
- package/lib/ObservedIceCandidate.d.ts.map +0 -1
- package/lib/ObservedIceCandidatePair.d.ts.map +0 -1
- package/lib/ObservedIceTransport.d.ts.map +0 -1
- package/lib/ObservedInboundRtp.d.ts.map +0 -1
- package/lib/ObservedInboundTrack.d.ts.map +0 -1
- package/lib/ObservedMediaPlayout.d.ts.map +0 -1
- package/lib/ObservedMediaSource.d.ts.map +0 -1
- package/lib/ObservedOutboundRtp.d.ts.map +0 -1
- package/lib/ObservedOutboundTrack.d.ts.map +0 -1
- package/lib/ObservedPeerConnection.d.ts.map +0 -1
- package/lib/ObservedPeerConnectionTransport.d.ts.map +0 -1
- package/lib/ObservedRemoteInboundRtp.d.ts.map +0 -1
- package/lib/ObservedRemoteOutboundRtp.d.ts.map +0 -1
- package/lib/ObserverSummary.d.ts.map +0 -1
- package/lib/updaters/OnAllCallObserverUpdater_.d.ts.map +0 -1
- package/lib/updaters/OnAnyCallObserverUpdater_.d.ts.map +0 -1
- /package/lib/{ObserverSummary.d.ts → common/ObserverSummary.d.ts} +0 -0
- /package/lib/{ObserverSummary.js → common/ObserverSummary.js} +0 -0
- /package/lib/{ObservedCertificate.js → webrtc/ObservedCertificate.js} +0 -0
- /package/lib/{ObservedCodec.js → webrtc/ObservedCodec.js} +0 -0
- /package/lib/{ObservedIceCandidate.js → webrtc/ObservedIceCandidate.js} +0 -0
- /package/lib/{ObservedIceTransport.js → webrtc/ObservedIceTransport.js} +0 -0
- /package/lib/{ObservedInboundRtp.js → webrtc/ObservedInboundRtp.js} +0 -0
- /package/lib/{ObservedMediaPlayout.js → webrtc/ObservedMediaPlayout.js} +0 -0
- /package/lib/{ObservedMediaSource.js → webrtc/ObservedMediaSource.js} +0 -0
- /package/lib/{ObservedOutboundRtp.js → webrtc/ObservedOutboundRtp.js} +0 -0
- /package/lib/{ObservedPeerConnectionTransport.js → webrtc/ObservedPeerConnectionTransport.js} +0 -0
- /package/lib/{ObservedRemoteInboundRtp.js → webrtc/ObservedRemoteInboundRtp.js} +0 -0
- /package/lib/{ObservedRemoteOutboundRtp.js → webrtc/ObservedRemoteOutboundRtp.js} +0 -0
- /package/src/{ObserverSummary.ts → common/ObserverSummary.ts} +0 -0
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { ObservedCertificate } from './webrtc/ObservedCertificate';
|
|
2
|
+
import { ObservedClient, ObservedClientEvents } from './ObservedClient';
|
|
3
|
+
import { ObservedCodec } from './webrtc/ObservedCodec';
|
|
4
|
+
import { ObservedDataChannel } from './webrtc/ObservedDataChannel';
|
|
5
|
+
import { ObservedIceCandidate } from './webrtc/ObservedIceCandidate';
|
|
6
|
+
import { ObservedIceCandidatePair } from './webrtc/ObservedIceCandidatePair';
|
|
7
|
+
import { ObservedIceTransport } from './webrtc/ObservedIceTransport';
|
|
8
|
+
import { ObservedInboundRtp } from './webrtc/ObservedInboundRtp';
|
|
9
|
+
import { ObservedInboundTrack } from './webrtc/ObservedInboundTrack';
|
|
10
|
+
import { ObservedMediaPlayout } from './webrtc/ObservedMediaPlayout';
|
|
11
|
+
import { ObservedMediaSource } from './webrtc/ObservedMediaSource';
|
|
12
|
+
import { ObservedOutboundRtp } from './webrtc/ObservedOutboundRtp';
|
|
13
|
+
import { ObservedOutboundTrack } from './webrtc/ObservedOutboundTrack';
|
|
14
|
+
import { ObservedPeerConnection } from './webrtc/ObservedPeerConnection';
|
|
15
|
+
import { ClientIssue, ClientMetaData, ExtensionStat } from './schema/ClientSample';
|
|
16
|
+
|
|
17
|
+
export class ObservedClientEventMonitor<AppContext, ClientAppData extends Record<string, unknown> = Record<string, unknown>> {
|
|
18
|
+
public constructor(
|
|
19
|
+
public readonly observedClient: ObservedClient<ClientAppData>,
|
|
20
|
+
public readonly context: AppContext,
|
|
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
|
+
this._onClientUpdated = this._onClientUpdated.bind(this);
|
|
56
|
+
this._onClientExtensionStats = this._onClientExtensionStats.bind(this);
|
|
57
|
+
|
|
58
|
+
this.observedClient.on('newpeerconnection', this._onPeerConnconnectionAdded);
|
|
59
|
+
this.observedClient.on('issue', this._onClientIssue);
|
|
60
|
+
this.observedClient.on('metaData', this._onClientMetadata);
|
|
61
|
+
this.observedClient.on('joined', this._onClientJoined);
|
|
62
|
+
this.observedClient.on('left', this._onClientLeft);
|
|
63
|
+
this.observedClient.on('rejoined', this._onClientJoined);
|
|
64
|
+
this.observedClient.on('usermediaerror', this._onUserMediaError);
|
|
65
|
+
this.observedClient.on('usingturn', this._onUsingTurn);
|
|
66
|
+
this.observedClient.on('update', this._onClientUpdated);
|
|
67
|
+
|
|
68
|
+
this.observedClient.once('close', this._onClientClosed);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public onClientUpdated?: (client: ObservedClient, event: ObservedClientEvents['update'][0], ctx: AppContext) => void;
|
|
72
|
+
private _onClientUpdated(...args: ObservedClientEvents['update']) {
|
|
73
|
+
this.onClientUpdated?.(this.observedClient, args[0], this.context);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
public onClientClosed?: (client: ObservedClient, ctx: AppContext) => void;
|
|
77
|
+
private _onClientClosed() {
|
|
78
|
+
this.onClientClosed?.(this.observedClient, this.context);
|
|
79
|
+
|
|
80
|
+
this.observedClient.off('newpeerconnection', this._onPeerConnconnectionAdded);
|
|
81
|
+
this.observedClient.off('issue', this._onClientIssue);
|
|
82
|
+
this.observedClient.off('metaData', this._onClientMetadata);
|
|
83
|
+
this.observedClient.off('joined', this._onClientJoined);
|
|
84
|
+
this.observedClient.off('left', this._onClientLeft);
|
|
85
|
+
this.observedClient.off('rejoined', this._onClientJoined);
|
|
86
|
+
this.observedClient.off('usermediaerror', this._onUserMediaError);
|
|
87
|
+
this.observedClient.off('usingturn', this._onUsingTurn);
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
public onPeerConnectionAdded?: (peerConnection: ObservedPeerConnection, ctx: AppContext) => void;
|
|
92
|
+
private _onPeerConnconnectionAdded(peerConnection: ObservedPeerConnection) {
|
|
93
|
+
this.onPeerConnectionAdded?.(peerConnection, this.context);
|
|
94
|
+
|
|
95
|
+
peerConnection.once('close', () => this._onPeerConnectionRemoved(peerConnection));
|
|
96
|
+
|
|
97
|
+
peerConnection.on('added-certificate', this._onCertificateAdded);
|
|
98
|
+
peerConnection.on('removed-certificate', this._onCertificateRemoved);
|
|
99
|
+
peerConnection.on('added-inbound-track', this._onInboundTrackAdded);
|
|
100
|
+
peerConnection.on('removed-inbound-track', this._onInboundTrackRemoved);
|
|
101
|
+
peerConnection.on('added-outbound-track', this._onOutboundTrackAdded);
|
|
102
|
+
peerConnection.on('removed-outbound-track', this._onOutboundTrackRemoved);
|
|
103
|
+
peerConnection.on('added-inbound-rtp', this._onInboundRtpAdded);
|
|
104
|
+
peerConnection.on('removed-inbound-rtp', this._onInboundRtpRemoved);
|
|
105
|
+
peerConnection.on('added-outbound-rtp', this._onOutboundRtpAdded);
|
|
106
|
+
peerConnection.on('removed-outbound-rtp', this._onOutboundRtpRemoved);
|
|
107
|
+
peerConnection.on('added-data-channel', this._onDataChannelAdded);
|
|
108
|
+
peerConnection.on('removed-data-channel', this._onDataChannelRemoved);
|
|
109
|
+
peerConnection.on('added-ice-transport', this._onAddedIceTransport);
|
|
110
|
+
peerConnection.on('removed-ice-transport', this._onRemovedIceTransport);
|
|
111
|
+
peerConnection.on('added-ice-candidate', this._onIceCandidateAdded);
|
|
112
|
+
peerConnection.on('removed-ice-candidate', this._onIceCandidateRemoved);
|
|
113
|
+
peerConnection.on('added-ice-candidate-pair', this._onAddedIceCandidatePair);
|
|
114
|
+
peerConnection.on('removed-ice-candidate-pair', this._onRemovedIceCandidatePair);
|
|
115
|
+
peerConnection.on('added-codec', this._onAddedMediaCodec);
|
|
116
|
+
peerConnection.on('removed-codec', this._onRemovedMediaCodec);
|
|
117
|
+
peerConnection.on('added-media-playout', this._onAddedMediaPlayout);
|
|
118
|
+
peerConnection.on('removed-media-playout', this._onRemovedMediaPlayout);
|
|
119
|
+
peerConnection.on('added-media-source', this._onMediaSourceAdded);
|
|
120
|
+
peerConnection.on('removed-media-source', this._onMediaSourceRemoved);
|
|
121
|
+
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
public onPeerConnectionRemoved?: (peerConnection: ObservedPeerConnection, ctx: AppContext) => void;
|
|
125
|
+
private _onPeerConnectionRemoved(peerConnection: ObservedPeerConnection) {
|
|
126
|
+
this.onPeerConnectionRemoved?.(peerConnection, this.context);
|
|
127
|
+
|
|
128
|
+
peerConnection.off('added-certificate', this._onCertificateAdded);
|
|
129
|
+
peerConnection.off('removed-certificate', this._onCertificateRemoved);
|
|
130
|
+
peerConnection.off('added-inbound-track', this._onInboundTrackAdded);
|
|
131
|
+
peerConnection.off('removed-inbound-track', this._onInboundTrackRemoved);
|
|
132
|
+
peerConnection.off('added-outbound-track', this._onOutboundTrackAdded);
|
|
133
|
+
peerConnection.off('removed-outbound-track', this._onOutboundTrackRemoved);
|
|
134
|
+
peerConnection.off('added-inbound-rtp', this._onInboundRtpAdded);
|
|
135
|
+
peerConnection.off('removed-inbound-rtp', this._onInboundRtpRemoved);
|
|
136
|
+
peerConnection.off('added-outbound-rtp', this._onOutboundRtpAdded);
|
|
137
|
+
peerConnection.off('removed-outbound-rtp', this._onOutboundRtpRemoved);
|
|
138
|
+
peerConnection.off('added-data-channel', this._onDataChannelAdded);
|
|
139
|
+
peerConnection.off('removed-data-channel', this._onDataChannelRemoved);
|
|
140
|
+
peerConnection.off('added-ice-transport', this._onAddedIceTransport);
|
|
141
|
+
peerConnection.off('removed-ice-transport', this._onRemovedIceTransport);
|
|
142
|
+
peerConnection.off('added-ice-candidate', this._onIceCandidateAdded);
|
|
143
|
+
peerConnection.off('removed-ice-candidate', this._onIceCandidateRemoved);
|
|
144
|
+
peerConnection.off('added-ice-candidate-pair', this._onAddedIceCandidatePair);
|
|
145
|
+
peerConnection.off('removed-ice-candidate-pair', this._onRemovedIceCandidatePair);
|
|
146
|
+
peerConnection.off('added-codec', this._onAddedMediaCodec);
|
|
147
|
+
peerConnection.off('removed-codec', this._onRemovedMediaCodec);
|
|
148
|
+
peerConnection.off('added-media-playout', this._onAddedMediaPlayout);
|
|
149
|
+
peerConnection.off('removed-media-playout', this._onRemovedMediaPlayout);
|
|
150
|
+
peerConnection.off('added-media-source', this._onMediaSourceAdded);
|
|
151
|
+
peerConnection.off('removed-media-source', this._onMediaSourceRemoved);
|
|
152
|
+
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
public onCertificateAdded?: (certificate: ObservedCertificate, ctx: AppContext) => void;
|
|
156
|
+
private _onCertificateAdded(certificate: ObservedCertificate) {
|
|
157
|
+
this.onCertificateAdded?.(certificate, this.context);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
public onCertificateRemoved?: (certificate: ObservedCertificate, ctx: AppContext) => void;
|
|
161
|
+
private _onCertificateRemoved(certificate: ObservedCertificate) {
|
|
162
|
+
this.onCertificateRemoved?.(certificate, this.context);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
public onInboundTrackAdded?: (inboundTrack: ObservedInboundTrack, ctx: AppContext) => void;
|
|
166
|
+
private _onInboundTrackAdded(inboundTrack: ObservedInboundTrack) {
|
|
167
|
+
this.onInboundTrackAdded?.(inboundTrack, this.context);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
public onInboundTrackRemoved?: (inboundTrack: ObservedInboundTrack, ctx: AppContext) => void;
|
|
171
|
+
private _onInboundTrackRemoved(inboundTrack: ObservedInboundTrack) {
|
|
172
|
+
this.onInboundTrackRemoved?.(inboundTrack, this.context);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
public onOutboundTrackAdded?: (outboundTrack: ObservedOutboundTrack, ctx: AppContext) => void;
|
|
176
|
+
private _onOutboundTrackAdded(outboundTrack: ObservedOutboundTrack) {
|
|
177
|
+
this.onOutboundTrackAdded?.(outboundTrack, this.context);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
public onOutboundTrackRemoved?: (outboundTrack: ObservedOutboundTrack, ctx: AppContext) => void;
|
|
181
|
+
private _onOutboundTrackRemoved(outboundTrack: ObservedOutboundTrack) {
|
|
182
|
+
this.onOutboundTrackRemoved?.(outboundTrack, this.context);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
public onInboundRtpAdded?: (inboundRtp: ObservedInboundRtp, ctx: AppContext) => void;
|
|
186
|
+
private _onInboundRtpAdded(inboundRtp: ObservedInboundRtp) {
|
|
187
|
+
this.onInboundRtpAdded?.(inboundRtp, this.context);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
public onInboundRtpRemoved?: (inboundRtp: ObservedInboundRtp, ctx: AppContext) => void;
|
|
191
|
+
private _onInboundRtpRemoved(inboundRtp: ObservedInboundRtp) {
|
|
192
|
+
this.onInboundRtpRemoved?.(inboundRtp, this.context);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
public onOutboundRtpAdded?: (outboundRtp: ObservedOutboundRtp, ctx: AppContext) => void;
|
|
196
|
+
private _onOutboundRtpAdded(outboundRtp: ObservedOutboundRtp) {
|
|
197
|
+
this.onOutboundRtpAdded?.(outboundRtp, this.context);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
public onOutboundRtpRemoved?: (outboundRtp: ObservedOutboundRtp, ctx: AppContext) => void;
|
|
201
|
+
private _onOutboundRtpRemoved(outboundRtp: ObservedOutboundRtp) {
|
|
202
|
+
this.onOutboundRtpRemoved?.(outboundRtp, this.context);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
public onDataChannelAdded?: (dataChannel: ObservedDataChannel, ctx: AppContext) => void;
|
|
206
|
+
private _onDataChannelAdded(dataChannel: ObservedDataChannel) {
|
|
207
|
+
this.onDataChannelAdded?.(dataChannel, this.context);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
public onDataChannelRemoved?: (dataChannel: ObservedDataChannel, ctx: AppContext) => void;
|
|
211
|
+
private _onDataChannelRemoved(dataChannel: ObservedDataChannel) {
|
|
212
|
+
this.onDataChannelRemoved?.(dataChannel, this.context);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
public onAddedIceTransport?: (iceTransport: ObservedIceTransport, ctx: AppContext) => void;
|
|
216
|
+
private _onAddedIceTransport(iceTransport: ObservedIceTransport) {
|
|
217
|
+
this.onAddedIceTransport?.(iceTransport, this.context);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
public onRemovedIceTransport?: (iceTransport: ObservedIceTransport, ctx: AppContext) => void;
|
|
221
|
+
private _onRemovedIceTransport(iceTransport: ObservedIceTransport) {
|
|
222
|
+
this.onRemovedIceTransport?.(iceTransport, this.context);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
public onIceCandidateAdded?: (iceCandidate: ObservedIceCandidate, ctx: AppContext) => void;
|
|
226
|
+
private _onIceCandidateAdded(iceCandidate: ObservedIceCandidate) {
|
|
227
|
+
this.onIceCandidateAdded?.(iceCandidate, this.context);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
public onIceCandidateRemoved?: (iceCandidate: ObservedIceCandidate, ctx: AppContext) => void;
|
|
231
|
+
private _onIceCandidateRemoved(iceCandidate: ObservedIceCandidate) {
|
|
232
|
+
this.onIceCandidateRemoved?.(iceCandidate, this.context);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
public onAddedIceCandidatePair?: (candidatePair: ObservedIceCandidatePair, ctx: AppContext) => void;
|
|
236
|
+
private _onAddedIceCandidatePair(candidatePair: ObservedIceCandidatePair) {
|
|
237
|
+
this.onAddedIceCandidatePair?.(candidatePair, this.context);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
public onRemovedIceCandidatePair?: (candidatePair: ObservedIceCandidatePair, ctx: AppContext) => void;
|
|
241
|
+
private _onRemovedIceCandidatePair(candidatePair: ObservedIceCandidatePair) {
|
|
242
|
+
this.onRemovedIceCandidatePair?.(candidatePair, this.context);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
public onAddedMediaCodec?: (codec: ObservedCodec, ctx: AppContext) => void;
|
|
246
|
+
private _onAddedMediaCodec(codec: ObservedCodec) {
|
|
247
|
+
this.onAddedMediaCodec?.(codec, this.context);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
public onRemovedMediaCodec?: (codec: ObservedCodec, ctx: AppContext) => void;
|
|
251
|
+
private _onRemovedMediaCodec(codec: ObservedCodec) {
|
|
252
|
+
this.onRemovedMediaCodec?.(codec, this.context);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
public onAddedMediaPlayout?: (mediaPlayout: ObservedMediaPlayout, ctx: AppContext) => void;
|
|
256
|
+
private _onAddedMediaPlayout(mediaPlayout: ObservedMediaPlayout) {
|
|
257
|
+
this.onAddedMediaPlayout?.(mediaPlayout, this.context);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
public onRemovedMediaPlayout?: (mediaPlayout: ObservedMediaPlayout, ctx: AppContext) => void;
|
|
261
|
+
private _onRemovedMediaPlayout(mediaPlayout: ObservedMediaPlayout) {
|
|
262
|
+
this.onRemovedMediaPlayout?.(mediaPlayout, this.context);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
public onMediaSourceAdded?: (mediaSource: ObservedMediaSource, ctx: AppContext) => void;
|
|
266
|
+
private _onMediaSourceAdded(mediaSource: ObservedMediaSource) {
|
|
267
|
+
this.onMediaSourceAdded?.(mediaSource, this.context);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
public onMediaSourceRemoved?: (mediaSource: ObservedMediaSource, ctx: AppContext) => void;
|
|
271
|
+
private _onMediaSourceRemoved(mediaSource: ObservedMediaSource) {
|
|
272
|
+
this.onMediaSourceRemoved?.(mediaSource, this.context);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
public onClientIssue?: (issue: ClientIssue, ctx: AppContext) => void;
|
|
276
|
+
private _onClientIssue(issue: ClientIssue) {
|
|
277
|
+
this.onClientIssue?.(issue, this.context);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
public onClientMetadata?: (metadata: ClientMetaData, ctx: AppContext) => void;
|
|
281
|
+
private _onClientMetadata(metadata: ClientMetaData) {
|
|
282
|
+
this.onClientMetadata?.(metadata, this.context);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
public onClientExtensionStats?: (extensionStats: ExtensionStat, ctx: AppContext) => void;
|
|
286
|
+
private _onClientExtensionStats(extensionStats: ExtensionStat) {
|
|
287
|
+
this.onClientExtensionStats?.(extensionStats, this.context);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
public onClientJoined?: (client: ObservedClient, ctx: AppContext) => void;
|
|
291
|
+
private _onClientJoined() {
|
|
292
|
+
this.onClientJoined?.(this.observedClient, this.context);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
public onClientLeft?: (client: ObservedClient, ctx: AppContext) => void;
|
|
296
|
+
private _onClientLeft() {
|
|
297
|
+
this.onClientLeft?.(this.observedClient, this.context);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
public onUserMediaError?: (error: string, observedClient: ObservedClient, ctx: AppContext) => void;
|
|
301
|
+
private _onUserMediaError(error: string) {
|
|
302
|
+
this.onUserMediaError?.(error, this.observedClient, this.context);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
public onUsingTurn?: (client: ObservedClient, ctx: AppContext) => void;
|
|
306
|
+
private _onUsingTurn() {
|
|
307
|
+
this.onUsingTurn?.(this.observedClient, this.context);
|
|
308
|
+
}
|
|
309
|
+
}
|
package/src/ObservedTURN.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from 'stream';
|
|
2
|
-
import { ObservedPeerConnection } from './ObservedPeerConnection';
|
|
2
|
+
import { ObservedPeerConnection } from './webrtc/ObservedPeerConnection';
|
|
3
3
|
import { ObservedTurnServer } from './ObservedTurnServer';
|
|
4
4
|
import { createLogger } from './common/logger';
|
|
5
5
|
|
|
@@ -34,6 +34,7 @@ export class ObservedTURN extends EventEmitter {
|
|
|
34
34
|
public constructor(
|
|
35
35
|
) {
|
|
36
36
|
super();
|
|
37
|
+
this.setMaxListeners(Infinity);
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
public update() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ObservedIceCandidatePair } from './ObservedIceCandidatePair';
|
|
2
|
-
import { ObservedPeerConnection } from './ObservedPeerConnection';
|
|
1
|
+
import { ObservedIceCandidatePair } from './webrtc/ObservedIceCandidatePair';
|
|
2
|
+
import { ObservedPeerConnection } from './webrtc/ObservedPeerConnection';
|
|
3
3
|
import { ObservedTURN } from './ObservedTURN';
|
|
4
4
|
|
|
5
5
|
export class ObservedTurnServer {
|
package/src/Observer.ts
CHANGED
|
@@ -7,27 +7,30 @@ import { ObservedTURN } from './ObservedTURN';
|
|
|
7
7
|
import { Detectors } from './detectors/Detectors';
|
|
8
8
|
import { Updater } from './updaters/Updater';
|
|
9
9
|
import { OnIntervalUpdater } from './updaters/OnIntervalUpdater';
|
|
10
|
-
import { OnAllCallObserverUpdater } from './updaters/
|
|
11
|
-
import { OnAnyCallObserverUpdater } from './updaters/
|
|
10
|
+
import { OnAllCallObserverUpdater } from './updaters/OnAllCallObserverUpdater';
|
|
11
|
+
import { OnAnyCallObserverUpdater } from './updaters/OnAnyCallObserverUpdater';
|
|
12
|
+
import { ObserverEventMonitor } from './ObserverEventMonitor';
|
|
13
|
+
import { MediasoupRemoteTrackResolver } from './utils/MediasoupRemoteTrackResolver';
|
|
12
14
|
|
|
13
15
|
const logger = createLogger('Observer');
|
|
14
16
|
|
|
15
17
|
export type ObserverEvents = {
|
|
16
18
|
'client-event': [ObservedClient, ClientEvent];
|
|
17
19
|
'call-updated': [ObservedCall],
|
|
18
|
-
'client-issue': [ObservedClient, ClientIssue]
|
|
19
|
-
'client-metadata': [ObservedClient, ClientMetaData]
|
|
20
|
-
'client-extension-stats': [ObservedClient, ExtensionStat]
|
|
20
|
+
'client-issue': [ObservedClient, ClientIssue];
|
|
21
|
+
'client-metadata': [ObservedClient, ClientMetaData];
|
|
22
|
+
'client-extension-stats': [ObservedClient, ExtensionStat];
|
|
21
23
|
'newcall': [ObservedCall],
|
|
22
24
|
'update': [],
|
|
23
25
|
'close': [],
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
export type ObserverConfig = {
|
|
28
|
+
export type ObserverConfig<AppData extends Record<string, unknown> = Record<string, unknown>> = {
|
|
27
29
|
updatePolicy?: 'update-on-any-call-updated' | 'update-when-all-call-updated' | 'update-on-interval',
|
|
28
30
|
updateIntervalInMs?: number,
|
|
29
31
|
defaultCallUpdatePolicy?: ObservedCallSettings['updatePolicy'],
|
|
30
32
|
defaultCallUpdateIntervalInMs?: number,
|
|
33
|
+
appData?: AppData,
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
export declare interface Observer {
|
|
@@ -37,7 +40,7 @@ export declare interface Observer {
|
|
|
37
40
|
emit<U extends keyof ObserverEvents>(event: U, ...args: ObserverEvents[U]): boolean;
|
|
38
41
|
}
|
|
39
42
|
|
|
40
|
-
export class Observer extends EventEmitter {
|
|
43
|
+
export class Observer<AppData extends Record<string, unknown> = Record<string, unknown>> extends EventEmitter {
|
|
41
44
|
public readonly detectors: Detectors;
|
|
42
45
|
|
|
43
46
|
public readonly observedTURN = new ObservedTURN();
|
|
@@ -54,7 +57,7 @@ export class Observer extends EventEmitter {
|
|
|
54
57
|
public totalRttGtOrEq300Measurements = 0;
|
|
55
58
|
public totalClientIssues = 0;
|
|
56
59
|
|
|
57
|
-
public
|
|
60
|
+
public numberOfClientsUsingTurn = 0;
|
|
58
61
|
public numberOfClients = 0;
|
|
59
62
|
public numberOfInboundRtpStreams = 0;
|
|
60
63
|
public numberOfOutboundRtpStreams = 0;
|
|
@@ -65,49 +68,45 @@ export class Observer extends EventEmitter {
|
|
|
65
68
|
return this.observedCalls.size;
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
public constructor(public readonly config: ObserverConfig = {
|
|
71
|
+
public constructor(public readonly config: ObserverConfig<AppData> = {
|
|
71
72
|
updatePolicy: 'update-when-all-call-updated',
|
|
72
73
|
updateIntervalInMs: undefined,
|
|
74
|
+
appData: {} as AppData,
|
|
73
75
|
}) {
|
|
74
76
|
super();
|
|
75
77
|
this.setMaxListeners(Infinity);
|
|
76
78
|
this.update = this.update.bind(this);
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
if (this.config.updatePolicy && this.config.updatePolicy !== 'update-on-interval') {
|
|
80
|
-
throw new Error('update policy must be update-on-interval if updateIntervalInMs is set in config');
|
|
81
|
-
}
|
|
82
|
-
this._timer = setInterval(this.update.bind(this), this.config.updateIntervalInMs);
|
|
83
|
-
}
|
|
80
|
+
const currentUpdatePolicy = (config?.updatePolicy) ?? 'update-when-all-call-updated';
|
|
84
81
|
|
|
85
|
-
|
|
86
|
-
if (this.config.updatePolicy !== 'update-on-interval') {
|
|
87
|
-
throw new Error('updatePolicy must be update-on-interval if updateIntervalInMs is set in config');
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
switch (this.config.updatePolicy) {
|
|
82
|
+
switch (currentUpdatePolicy) {
|
|
91
83
|
case 'update-on-any-call-updated':
|
|
92
|
-
this.updater = new
|
|
84
|
+
this.updater = new OnAnyCallObserverUpdater(this);
|
|
93
85
|
break;
|
|
94
86
|
case 'update-when-all-call-updated':
|
|
95
|
-
this.updater = new
|
|
87
|
+
this.updater = new OnAllCallObserverUpdater(this);
|
|
96
88
|
break;
|
|
97
|
-
case 'update-on-interval':
|
|
98
|
-
|
|
89
|
+
case 'update-on-interval': {
|
|
90
|
+
const interval = config?.updateIntervalInMs;
|
|
91
|
+
|
|
92
|
+
if (!interval) {
|
|
99
93
|
throw new Error('updateIntervalInMs setting in config must be set if updatePolicy is update-on-interval');
|
|
100
94
|
}
|
|
101
95
|
this.updater = new OnIntervalUpdater(
|
|
102
|
-
|
|
96
|
+
interval,
|
|
103
97
|
this.update.bind(this),
|
|
104
98
|
);
|
|
105
99
|
break;
|
|
100
|
+
}
|
|
106
101
|
}
|
|
107
102
|
|
|
108
103
|
this.detectors = new Detectors();
|
|
109
104
|
}
|
|
110
105
|
|
|
106
|
+
public get appData() {
|
|
107
|
+
return this.config.appData;
|
|
108
|
+
}
|
|
109
|
+
|
|
111
110
|
public getObservedCall<T extends Record<string, unknown> = Record<string, unknown>>(callId: string): ObservedCall<T> | undefined {
|
|
112
111
|
if (this.closed || !this.observedCalls.has(callId)) return;
|
|
113
112
|
|
|
@@ -124,12 +123,15 @@ export class Observer extends EventEmitter {
|
|
|
124
123
|
settings.updatePolicy = this.config.defaultCallUpdatePolicy;
|
|
125
124
|
settings.updateIntervalInMs = this.config.defaultCallUpdateIntervalInMs;
|
|
126
125
|
}
|
|
127
|
-
|
|
128
126
|
const observedCall = new ObservedCall(settings, this);
|
|
129
127
|
const onCallUpdated = () => this._onObservedCallUpdated(observedCall);
|
|
130
128
|
|
|
131
129
|
if (this.observedCalls.has(observedCall.callId)) throw new Error(`Observed Call with id ${observedCall.callId} already exists`);
|
|
132
130
|
|
|
131
|
+
if (settings.remoteTrackResolvePolicy === 'mediasoup-sfu') {
|
|
132
|
+
observedCall.remoteTrackResolver = new MediasoupRemoteTrackResolver(observedCall);
|
|
133
|
+
}
|
|
134
|
+
|
|
133
135
|
observedCall.once('close', () => {
|
|
134
136
|
this.observedCalls.delete(observedCall.callId);
|
|
135
137
|
observedCall.off('update', onCallUpdated);
|
|
@@ -150,8 +152,6 @@ export class Observer extends EventEmitter {
|
|
|
150
152
|
return logger.debug('Attempted to close twice');
|
|
151
153
|
}
|
|
152
154
|
this.closed = true;
|
|
153
|
-
clearInterval(this._timer);
|
|
154
|
-
this._timer = undefined;
|
|
155
155
|
|
|
156
156
|
this.observedCalls.forEach((call) => call.close());
|
|
157
157
|
|
|
@@ -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.
|
|
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.
|
|
197
|
+
this.numberOfClientsUsingTurn += call.clientsUsedTurn.size;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
this.observedTURN.update();
|
|
@@ -210,6 +210,10 @@ export class Observer extends EventEmitter {
|
|
|
210
210
|
this.totalClientIssues += call.deltaNumberOfIssues;
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
+
public createEventMonitor<CTX = unknown>(ctx?: CTX): ObserverEventMonitor<CTX> {
|
|
214
|
+
return new ObserverEventMonitor<CTX>(this, ctx ?? {} as CTX);
|
|
215
|
+
}
|
|
216
|
+
|
|
213
217
|
// public resetSummaryMetrics() {
|
|
214
218
|
// this.totalAddedCall = 0;
|
|
215
219
|
// this.totalRemovedCall = 0;
|