@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.
Files changed (166) hide show
  1. package/README.md +535 -1
  2. package/lib/ObservedCall.d.ts +8 -7
  3. package/lib/ObservedCall.d.ts.map +1 -1
  4. package/lib/ObservedCall.js +42 -38
  5. package/lib/ObservedCallEventMonitor.d.ts +104 -0
  6. package/lib/ObservedCallEventMonitor.d.ts.map +1 -0
  7. package/lib/ObservedCallEventMonitor.js +314 -0
  8. package/lib/ObservedClient.d.ts +20 -10
  9. package/lib/ObservedClient.d.ts.map +1 -1
  10. package/lib/ObservedClient.js +330 -13
  11. package/lib/ObservedClientEventMonitor.d.ts +91 -0
  12. package/lib/ObservedClientEventMonitor.d.ts.map +1 -0
  13. package/lib/ObservedClientEventMonitor.js +254 -0
  14. package/lib/ObservedTURN.d.ts +1 -1
  15. package/lib/ObservedTURN.d.ts.map +1 -1
  16. package/lib/ObservedTURN.js +1 -0
  17. package/lib/ObservedTurnServer.d.ts +2 -2
  18. package/lib/ObservedTurnServer.d.ts.map +1 -1
  19. package/lib/Observer.d.ts +9 -6
  20. package/lib/Observer.d.ts.map +1 -1
  21. package/lib/Observer.js +26 -25
  22. package/lib/ObserverEventMonitor.d.ts +138 -0
  23. package/lib/ObserverEventMonitor.d.ts.map +1 -0
  24. package/lib/ObserverEventMonitor.js +433 -0
  25. package/lib/common/ObserverSummary.d.ts.map +1 -0
  26. package/lib/common/SummaryTypes.d.ts +75 -0
  27. package/lib/common/SummaryTypes.d.ts.map +1 -0
  28. package/lib/common/SummaryTypes.js +2 -0
  29. package/lib/index.d.ts +19 -17
  30. package/lib/index.d.ts.map +1 -1
  31. package/lib/index.js +21 -17
  32. package/lib/mediasoup/ObservedMediasoupRouter.d.ts +7 -0
  33. package/lib/mediasoup/ObservedMediasoupRouter.d.ts.map +1 -0
  34. package/lib/mediasoup/ObservedMediasoupRouter.js +12 -0
  35. package/lib/monitors/SummaryMonitor.d.ts +19 -0
  36. package/lib/monitors/SummaryMonitor.d.ts.map +1 -0
  37. package/lib/monitors/SummaryMonitor.js +129 -0
  38. package/lib/schema/ClientEventTypes.d.ts +147 -19
  39. package/lib/schema/ClientEventTypes.d.ts.map +1 -1
  40. package/lib/schema/ClientEventTypes.js +5 -2
  41. package/lib/schema/ClientSample.d.ts +1 -1
  42. package/lib/schema/ClientSample.d.ts.map +1 -1
  43. package/lib/updaters/{OnAllCallObserverUpdater_.d.ts → OnAllCallObserverUpdater.d.ts} +3 -1
  44. package/lib/updaters/OnAllCallObserverUpdater.d.ts.map +1 -0
  45. package/lib/updaters/{OnAllCallObserverUpdater_.js → OnAllCallObserverUpdater.js} +13 -1
  46. package/lib/updaters/OnAllClientCallUpdater.d.ts +2 -0
  47. package/lib/updaters/OnAllClientCallUpdater.d.ts.map +1 -1
  48. package/lib/updaters/OnAllClientCallUpdater.js +16 -0
  49. package/lib/updaters/{OnAnyCallObserverUpdater_.d.ts → OnAnyCallObserverUpdater.d.ts} +2 -1
  50. package/lib/updaters/OnAnyCallObserverUpdater.d.ts.map +1 -0
  51. package/lib/updaters/{OnAnyCallObserverUpdater_.js → OnAnyCallObserverUpdater.js} +11 -1
  52. package/lib/updaters/OnAnyClientCallUpdater.d.ts +1 -0
  53. package/lib/updaters/OnAnyClientCallUpdater.d.ts.map +1 -1
  54. package/lib/updaters/OnAnyClientCallUpdater.js +11 -2
  55. package/lib/utils/MediasoupRemoteTrackResolver.d.ts +25 -0
  56. package/lib/utils/MediasoupRemoteTrackResolver.d.ts.map +1 -0
  57. package/lib/utils/MediasoupRemoteTrackResolver.js +110 -0
  58. package/lib/utils/RemoteTrackResolver.d.ts +2 -2
  59. package/lib/utils/RemoteTrackResolver.d.ts.map +1 -1
  60. package/lib/{ObservedCertificate.d.ts → webrtc/ObservedCertificate.d.ts} +1 -1
  61. package/lib/webrtc/ObservedCertificate.d.ts.map +1 -0
  62. package/lib/{ObservedCodec.d.ts → webrtc/ObservedCodec.d.ts} +1 -1
  63. package/lib/webrtc/ObservedCodec.d.ts.map +1 -0
  64. package/lib/{ObservedDataChannel.d.ts → webrtc/ObservedDataChannel.d.ts} +3 -1
  65. package/lib/webrtc/ObservedDataChannel.d.ts.map +1 -0
  66. package/lib/{ObservedDataChannel.js → webrtc/ObservedDataChannel.js} +2 -0
  67. package/lib/{ObservedIceCandidate.d.ts → webrtc/ObservedIceCandidate.d.ts} +1 -1
  68. package/lib/webrtc/ObservedIceCandidate.d.ts.map +1 -0
  69. package/lib/{ObservedIceCandidatePair.d.ts → webrtc/ObservedIceCandidatePair.d.ts} +3 -2
  70. package/lib/webrtc/ObservedIceCandidatePair.d.ts.map +1 -0
  71. package/lib/{ObservedIceCandidatePair.js → webrtc/ObservedIceCandidatePair.js} +17 -1
  72. package/lib/{ObservedIceTransport.d.ts → webrtc/ObservedIceTransport.d.ts} +1 -1
  73. package/lib/webrtc/ObservedIceTransport.d.ts.map +1 -0
  74. package/lib/{ObservedInboundRtp.d.ts → webrtc/ObservedInboundRtp.d.ts} +2 -2
  75. package/lib/webrtc/ObservedInboundRtp.d.ts.map +1 -0
  76. package/lib/{ObservedInboundTrack.d.ts → webrtc/ObservedInboundTrack.d.ts} +7 -4
  77. package/lib/webrtc/ObservedInboundTrack.d.ts.map +1 -0
  78. package/lib/{ObservedInboundTrack.js → webrtc/ObservedInboundTrack.js} +4 -1
  79. package/lib/{ObservedMediaPlayout.d.ts → webrtc/ObservedMediaPlayout.d.ts} +2 -2
  80. package/lib/webrtc/ObservedMediaPlayout.d.ts.map +1 -0
  81. package/lib/{ObservedMediaSource.d.ts → webrtc/ObservedMediaSource.d.ts} +2 -2
  82. package/lib/webrtc/ObservedMediaSource.d.ts.map +1 -0
  83. package/lib/{ObservedOutboundRtp.d.ts → webrtc/ObservedOutboundRtp.d.ts} +2 -2
  84. package/lib/webrtc/ObservedOutboundRtp.d.ts.map +1 -0
  85. package/lib/{ObservedOutboundTrack.d.ts → webrtc/ObservedOutboundTrack.d.ts} +7 -4
  86. package/lib/webrtc/ObservedOutboundTrack.d.ts.map +1 -0
  87. package/lib/{ObservedOutboundTrack.js → webrtc/ObservedOutboundTrack.js} +4 -1
  88. package/lib/{ObservedPeerConnection.d.ts → webrtc/ObservedPeerConnection.d.ts} +26 -4
  89. package/lib/webrtc/ObservedPeerConnection.d.ts.map +1 -0
  90. package/lib/{ObservedPeerConnection.js → webrtc/ObservedPeerConnection.js} +82 -17
  91. package/lib/{ObservedPeerConnectionTransport.d.ts → webrtc/ObservedPeerConnectionTransport.d.ts} +1 -1
  92. package/lib/webrtc/ObservedPeerConnectionTransport.d.ts.map +1 -0
  93. package/lib/{ObservedRemoteInboundRtp.d.ts → webrtc/ObservedRemoteInboundRtp.d.ts} +2 -2
  94. package/lib/webrtc/ObservedRemoteInboundRtp.d.ts.map +1 -0
  95. package/lib/{ObservedRemoteOutboundRtp.d.ts → webrtc/ObservedRemoteOutboundRtp.d.ts} +2 -2
  96. package/lib/webrtc/ObservedRemoteOutboundRtp.d.ts.map +1 -0
  97. package/package.json +1 -1
  98. package/src/ObservedCall.ts +44 -48
  99. package/src/ObservedCallEventMonitor.ts +392 -0
  100. package/src/ObservedClient.ts +363 -22
  101. package/src/ObservedClientEventMonitor.ts +309 -0
  102. package/src/ObservedTURN.ts +2 -1
  103. package/src/ObservedTurnServer.ts +2 -2
  104. package/src/Observer.ts +37 -33
  105. package/src/ObserverEventMonitor.ts +551 -0
  106. package/src/common/SummaryTypes.ts +91 -0
  107. package/src/index.ts +19 -18
  108. package/src/mediasoup/ObservedMediasoupRouter.ts +12 -0
  109. package/src/monitors/SummaryMonitor.ts +181 -0
  110. package/src/schema/ClientEventTypes.ts +187 -19
  111. package/src/schema/ClientSample.ts +1 -1
  112. package/src/updaters/{OnAllCallObserverUpdater_.ts → OnAllCallObserverUpdater.ts} +14 -1
  113. package/src/updaters/OnAllClientCallUpdater.ts +15 -0
  114. package/src/updaters/{OnAnyCallObserverUpdater_.ts → OnAnyCallObserverUpdater.ts} +12 -3
  115. package/src/updaters/OnAnyClientCallUpdater.ts +9 -2
  116. package/src/utils/MediasoupRemoteTrackResolver.ts +155 -0
  117. package/src/utils/RemoteTrackResolver.ts +2 -2
  118. package/src/{ObservedCertificate.ts → webrtc/ObservedCertificate.ts} +1 -1
  119. package/src/{ObservedCodec.ts → webrtc/ObservedCodec.ts} +1 -1
  120. package/src/{ObservedDataChannel.ts → webrtc/ObservedDataChannel.ts} +4 -1
  121. package/src/{ObservedIceCandidate.ts → webrtc/ObservedIceCandidate.ts} +1 -1
  122. package/src/{ObservedIceCandidatePair.ts → webrtc/ObservedIceCandidatePair.ts} +19 -3
  123. package/src/{ObservedIceTransport.ts → webrtc/ObservedIceTransport.ts} +1 -1
  124. package/src/{ObservedInboundRtp.ts → webrtc/ObservedInboundRtp.ts} +2 -2
  125. package/src/{ObservedInboundTrack.ts → webrtc/ObservedInboundTrack.ts} +9 -4
  126. package/src/{ObservedMediaPlayout.ts → webrtc/ObservedMediaPlayout.ts} +2 -2
  127. package/src/{ObservedMediaSource.ts → webrtc/ObservedMediaSource.ts} +2 -2
  128. package/src/{ObservedOutboundRtp.ts → webrtc/ObservedOutboundRtp.ts} +2 -2
  129. package/src/{ObservedOutboundTrack.ts → webrtc/ObservedOutboundTrack.ts} +9 -4
  130. package/src/{ObservedPeerConnection.ts → webrtc/ObservedPeerConnection.ts} +124 -37
  131. package/src/{ObservedPeerConnectionTransport.ts → webrtc/ObservedPeerConnectionTransport.ts} +1 -1
  132. package/src/{ObservedRemoteInboundRtp.ts → webrtc/ObservedRemoteInboundRtp.ts} +2 -2
  133. package/src/{ObservedRemoteOutboundRtp.ts → webrtc/ObservedRemoteOutboundRtp.ts} +2 -2
  134. package/lib/ObservedCertificate.d.ts.map +0 -1
  135. package/lib/ObservedCodec.d.ts.map +0 -1
  136. package/lib/ObservedDataChannel.d.ts.map +0 -1
  137. package/lib/ObservedIceCandidate.d.ts.map +0 -1
  138. package/lib/ObservedIceCandidatePair.d.ts.map +0 -1
  139. package/lib/ObservedIceTransport.d.ts.map +0 -1
  140. package/lib/ObservedInboundRtp.d.ts.map +0 -1
  141. package/lib/ObservedInboundTrack.d.ts.map +0 -1
  142. package/lib/ObservedMediaPlayout.d.ts.map +0 -1
  143. package/lib/ObservedMediaSource.d.ts.map +0 -1
  144. package/lib/ObservedOutboundRtp.d.ts.map +0 -1
  145. package/lib/ObservedOutboundTrack.d.ts.map +0 -1
  146. package/lib/ObservedPeerConnection.d.ts.map +0 -1
  147. package/lib/ObservedPeerConnectionTransport.d.ts.map +0 -1
  148. package/lib/ObservedRemoteInboundRtp.d.ts.map +0 -1
  149. package/lib/ObservedRemoteOutboundRtp.d.ts.map +0 -1
  150. package/lib/ObserverSummary.d.ts.map +0 -1
  151. package/lib/updaters/OnAllCallObserverUpdater_.d.ts.map +0 -1
  152. package/lib/updaters/OnAnyCallObserverUpdater_.d.ts.map +0 -1
  153. /package/lib/{ObserverSummary.d.ts → common/ObserverSummary.d.ts} +0 -0
  154. /package/lib/{ObserverSummary.js → common/ObserverSummary.js} +0 -0
  155. /package/lib/{ObservedCertificate.js → webrtc/ObservedCertificate.js} +0 -0
  156. /package/lib/{ObservedCodec.js → webrtc/ObservedCodec.js} +0 -0
  157. /package/lib/{ObservedIceCandidate.js → webrtc/ObservedIceCandidate.js} +0 -0
  158. /package/lib/{ObservedIceTransport.js → webrtc/ObservedIceTransport.js} +0 -0
  159. /package/lib/{ObservedInboundRtp.js → webrtc/ObservedInboundRtp.js} +0 -0
  160. /package/lib/{ObservedMediaPlayout.js → webrtc/ObservedMediaPlayout.js} +0 -0
  161. /package/lib/{ObservedMediaSource.js → webrtc/ObservedMediaSource.js} +0 -0
  162. /package/lib/{ObservedOutboundRtp.js → webrtc/ObservedOutboundRtp.js} +0 -0
  163. /package/lib/{ObservedPeerConnectionTransport.js → webrtc/ObservedPeerConnectionTransport.js} +0 -0
  164. /package/lib/{ObservedRemoteInboundRtp.js → webrtc/ObservedRemoteInboundRtp.js} +0 -0
  165. /package/lib/{ObservedRemoteOutboundRtp.js → webrtc/ObservedRemoteOutboundRtp.js} +0 -0
  166. /package/src/{ObserverSummary.ts → common/ObserverSummary.ts} +0 -0
@@ -0,0 +1,551 @@
1
+ import { ObservedCall } from './ObservedCall';
2
+ import { ObservedCertificate } from './webrtc/ObservedCertificate';
3
+ import { ObservedClient, ObservedClientEvents } from './ObservedClient';
4
+ import { ObservedCodec } from './webrtc/ObservedCodec';
5
+ import { ObservedDataChannel } from './webrtc/ObservedDataChannel';
6
+ import { ObservedIceCandidate } from './webrtc/ObservedIceCandidate';
7
+ import { ObservedIceCandidatePair } from './webrtc/ObservedIceCandidatePair';
8
+ import { ObservedIceTransport } from './webrtc/ObservedIceTransport';
9
+ import { ObservedInboundRtp } from './webrtc/ObservedInboundRtp';
10
+ import { ObservedInboundTrack } from './webrtc/ObservedInboundTrack';
11
+ import { ObservedMediaPlayout } from './webrtc/ObservedMediaPlayout';
12
+ import { ObservedMediaSource } from './webrtc/ObservedMediaSource';
13
+ import { ObservedOutboundRtp } from './webrtc/ObservedOutboundRtp';
14
+ import { ObservedOutboundTrack } from './webrtc/ObservedOutboundTrack';
15
+ import { ObservedPeerConnection } from './webrtc/ObservedPeerConnection';
16
+ import { Observer } from './Observer';
17
+ import { ClientEvent, ClientIssue, ClientMetaData, ClientSample, ExtensionStat } from './schema/ClientSample';
18
+
19
+ export class ObserverEventMonitor<Context> {
20
+ public constructor(
21
+ public readonly observer: Observer,
22
+ public readonly context: Context,
23
+ ) {
24
+ this._onPeerConnconnectionAdded = this._onPeerConnconnectionAdded.bind(this);
25
+ this._onPeerConnectionRemoved = this._onPeerConnectionRemoved.bind(this);
26
+ this._onCertificateAdded = this._onCertificateAdded.bind(this);
27
+ this._onCertificateRemoved = this._onCertificateRemoved.bind(this);
28
+ this._onInboundTrackAdded = this._onInboundTrackAdded.bind(this);
29
+ this._onInboundTrackRemoved = this._onInboundTrackRemoved.bind(this);
30
+ this._onOutboundTrackAdded = this._onOutboundTrackAdded.bind(this);
31
+ this._onOutboundTrackRemoved = this._onOutboundTrackRemoved.bind(this);
32
+ this._onOutboundTrackMuted = this._onOutboundTrackMuted.bind(this);
33
+ this._onOutboundTrackUnmuted = this._onOutboundTrackUnmuted.bind(this);
34
+ this._onInboundRtpAdded = this._onInboundRtpAdded.bind(this);
35
+ this._onInboundRtpRemoved = this._onInboundRtpRemoved.bind(this);
36
+ this._onInboundRtpUpdated = this._onInboundRtpUpdated.bind(this);
37
+ this._onOutboundTrackUpdated = this._onOutboundTrackUpdated.bind(this);
38
+ this._onInboundTrackUpdated = this._onInboundTrackUpdated.bind(this);
39
+ this._onOutboundRtpAdded = this._onOutboundRtpAdded.bind(this);
40
+ this._onOutboundRtpRemoved = this._onOutboundRtpRemoved.bind(this);
41
+ this._onDataChannelAdded = this._onDataChannelAdded.bind(this);
42
+ this._onDataChannelRemoved = this._onDataChannelRemoved.bind(this);
43
+ this._onAddedIceTransport = this._onAddedIceTransport.bind(this);
44
+ this._onRemovedIceTransport = this._onRemovedIceTransport.bind(this);
45
+ this._onIceCandidateAdded = this._onIceCandidateAdded.bind(this);
46
+ this._onIceCandidateRemoved = this._onIceCandidateRemoved.bind(this);
47
+ this._onAddedIceCandidatePair = this._onAddedIceCandidatePair.bind(this);
48
+ this._onRemovedIceCandidatePair = this._onRemovedIceCandidatePair.bind(this);
49
+ this._onAddedMediaCodec = this._onAddedMediaCodec.bind(this);
50
+ this._onRemovedMediaCodec = this._onRemovedMediaCodec.bind(this);
51
+ this._onAddedMediaPlayout = this._onAddedMediaPlayout.bind(this);
52
+ this._onRemovedMediaPlayout = this._onRemovedMediaPlayout.bind(this);
53
+ this._onMediaSourceAdded = this._onMediaSourceAdded.bind(this);
54
+ this._onMediaSourceRemoved = this._onMediaSourceRemoved.bind(this);
55
+ this._onClientIssue = this._onClientIssue.bind(this);
56
+ this._onClientMetadata = this._onClientMetadata.bind(this);
57
+ this._onClientJoined = this._onClientJoined.bind(this);
58
+ this._onClientLeft = this._onClientLeft.bind(this);
59
+ this._onUserMediaError = this._onUserMediaError.bind(this);
60
+ this._onUsingTurn = this._onUsingTurn.bind(this);
61
+ this._onClientAdded = this._onClientAdded.bind(this);
62
+ this._onCallAdded = this._onCallAdded.bind(this);
63
+ this._onClientRejoined = this._onClientRejoined.bind(this);
64
+ this._onClientExtensionStats = this._onClientExtensionStats.bind(this);
65
+ this._onCertificateUpdated = this._onCertificateUpdated.bind(this);
66
+ this._onInboundRtpUpdated = this._onInboundRtpUpdated.bind(this);
67
+ this._onOutboundRtpUpdated = this._onOutboundRtpUpdated.bind(this);
68
+ this._onInboundTrackUpdated = this._onInboundTrackUpdated.bind(this);
69
+ this._onOutboundTrackUpdated = this._onOutboundTrackUpdated.bind(this);
70
+ this._onDataChannelUpdated = this._onDataChannelUpdated.bind(this);
71
+ this._onIceTransportUpdated = this._onIceTransportUpdated.bind(this);
72
+ this._onIceCandidatePairUpdated = this._onIceCandidatePairUpdated.bind(this);
73
+ this._onMediaCodecUpdated = this._onMediaCodecUpdated.bind(this);
74
+ this._onMediaPlayoutUpdated = this._onMediaPlayoutUpdated.bind(this);
75
+ this._onMediaSourceUpdated = this._onMediaSourceUpdated.bind(this);
76
+ this._onIceCandidateUpdated = this._onIceCandidateUpdated.bind(this);
77
+
78
+ this.observer.once('close', () => {
79
+ this.observer.off('newcall', this._onCallAdded);
80
+ });
81
+ this.observer.on('newcall', this._onCallAdded);
82
+ }
83
+
84
+ // Public event handlers
85
+ public onCallAdded?: (call: ObservedCall, ctx: Context) => void;
86
+ public onCallRemoved?: (call: ObservedCall, ctx: Context) => void;
87
+ public onCallEmpty?: (call: ObservedCall, ctx: Context) => void;
88
+ public onCallNotEmpty?: (call: ObservedCall, ctx: Context) => void;
89
+ public onCallUpdated?: (call: ObservedCall, ctx: Context) => void;
90
+
91
+ public onClientAdded?: (client: ObservedClient, ctx: Context) => void;
92
+ public onClientClosed?: (client: ObservedClient, ctx: Context) => void;
93
+ public onClientRejoined?: (client: ObservedClient, ctx: Context) => void;
94
+ public onClientIssue?: (observedClent: ObservedClient, issue: ClientIssue, ctx: Context) => void;
95
+ public onClientMetadata?: (observedClient: ObservedClient, metadata: ClientMetaData, ctx: Context) => void;
96
+ public onClientExtensionStats?: (observedClient: ObservedClient, extensionStats: ExtensionStat, ctx: Context) => void;
97
+ public onClientJoined?: (client: ObservedClient, ctx: Context) => void;
98
+ public onClientLeft?: (client: ObservedClient, ctx: Context) => void;
99
+ public onClientUserMediaError?: (observedClient: ObservedClient, error: string, ctx: Context) => void;
100
+ public onClientUsingTurn?: (client: ObservedClient, usingTurn: boolean, ctx: Context) => void;
101
+ public onClientUpdated?: (client: ObservedClient, sample: ClientSample, ctx: Context) => void;
102
+ public onClientEvent?: (client: ObservedClient, event: ClientEvent, ctx: Context) => void;
103
+
104
+ public onPeerConnectionAdded?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
105
+ public onPeerConnectionRemoved?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
106
+ public onSelectedCandidatePairChanged?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
107
+ public onIceGatheringStateChange?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
108
+ public onIceConnectionStateChange?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
109
+ public onConnectionStateChange?: (peerConnection: ObservedPeerConnection, ctx: Context) => void;
110
+
111
+ public onCertificateAdded?: (certificate: ObservedCertificate, ctx: Context) => void;
112
+ public onCertificateRemoved?: (certificate: ObservedCertificate, ctx: Context) => void;
113
+ public onCertificateUpdated?: (certificate: ObservedCertificate, ctx: Context) => void;
114
+
115
+ public onInboundTrackAdded?: (inboundTrack: ObservedInboundTrack, ctx: Context) => void;
116
+ public onInboundTrackRemoved?: (inboundTrack: ObservedInboundTrack, ctx: Context) => void;
117
+ public onInboundTrackUpdated?: (inboundTrack: ObservedInboundTrack, ctx: Context) => void;
118
+ public onInboundTrackMuted?: (inboundTrack: ObservedInboundTrack, ctx: Context) => void;
119
+ public onInboundTrackUnmuted?: (inboundTrack: ObservedInboundTrack, ctx: Context) => void;
120
+
121
+ public onOutboundTrackAdded?: (outboundTrack: ObservedOutboundTrack, ctx: Context) => void;
122
+ public onOutboundTrackRemoved?: (outboundTrack: ObservedOutboundTrack, ctx: Context) => void;
123
+ public onOutboundTrackUpdated?: (outboundTrack: ObservedOutboundTrack, ctx: Context) => void;
124
+ public onOutboundTrackMuted?: (outboundTrack: ObservedOutboundTrack, ctx: Context) => void;
125
+ public onOutboundTrackUnmuted?: (outboundTrack: ObservedOutboundTrack, ctx: Context) => void;
126
+
127
+ public onInboundRtpAdded?: (inboundRtp: ObservedInboundRtp, ctx: Context) => void;
128
+ public onInboundRtpRemoved?: (inboundRtp: ObservedInboundRtp, ctx: Context) => void;
129
+ public onInboundRtpUpdated?: (inboundRtp: ObservedInboundRtp, ctx: Context) => void;
130
+
131
+ public onOutboundRtpAdded?: (outboundRtp: ObservedOutboundRtp, ctx: Context) => void;
132
+ public onOutboundRtpRemoved?: (outboundRtp: ObservedOutboundRtp, ctx: Context) => void;
133
+ public onOutboundRtpUpdated?: (outboundRtp: ObservedOutboundRtp, ctx: Context) => void;
134
+
135
+ public onDataChannelAdded?: (dataChannel: ObservedDataChannel, ctx: Context) => void;
136
+ public onDataChannelRemoved?: (dataChannel: ObservedDataChannel, ctx: Context) => void;
137
+ public onDataChannelUpdated?: (dataChannel: ObservedDataChannel, ctx: Context) => void;
138
+
139
+ public onAddedIceTransport?: (iceTransport: ObservedIceTransport, ctx: Context) => void;
140
+ public onRemovedIceTransport?: (iceTransport: ObservedIceTransport, ctx: Context) => void;
141
+ public onIceTransportUpdated?: (iceTransport: ObservedIceTransport, ctx: Context) => void;
142
+
143
+ public onIceCandidateAdded?: (iceCandidate: ObservedIceCandidate, ctx: Context) => void;
144
+ public onIceCandidateRemoved?: (iceCandidate: ObservedIceCandidate, ctx: Context) => void;
145
+ public onIceCandidateUpdated?: (iceCandidate: ObservedIceCandidate, ctx: Context) => void;
146
+
147
+ public onAddedIceCandidatePair?: (candidatePair: ObservedIceCandidatePair, ctx: Context) => void;
148
+ public onRemovedIceCandidatePair?: (candidatePair: ObservedIceCandidatePair, ctx: Context) => void;
149
+ public onIceCandidatePairUpdated?: (candidatePair: ObservedIceCandidatePair, ctx: Context) => void;
150
+
151
+ public onAddedMediaCodec?: (codec: ObservedCodec, ctx: Context) => void;
152
+ public onRemovedMediaCodec?: (codec: ObservedCodec, ctx: Context) => void;
153
+ public onMediaCodecUpdated?: (codec: ObservedCodec, ctx: Context) => void;
154
+
155
+ public onAddedMediaPlayout?: (mediaPlayout: ObservedMediaPlayout, ctx: Context) => void;
156
+ public onRemovedMediaPlayout?: (mediaPlayout: ObservedMediaPlayout, ctx: Context) => void;
157
+ public onMediaPlayoutUpdated?: (mediaPlayout: ObservedMediaPlayout, ctx: Context) => void;
158
+
159
+ public onMediaSourceAdded?: (mediaSource: ObservedMediaSource, ctx: Context) => void;
160
+ public onMediaSourceRemoved?: (mediaSource: ObservedMediaSource, ctx: Context) => void;
161
+ public onMediaSourceUpdated?: (mediaSource: ObservedMediaSource, ctx: Context) => void;
162
+
163
+ private _onCallAdded(call: ObservedCall) {
164
+ const onCallEmpty = () => this.onCallEmpty?.(call, this.context);
165
+ const onCallNotEmpty = () => this.onCallNotEmpty?.(call, this.context);
166
+ const onCallUpdated = () => this.onCallUpdated?.(call, this.context);
167
+
168
+ call.once('close', () => {
169
+ call.off('newclient', this._onClientAdded);
170
+ call.off('empty', onCallEmpty);
171
+ call.off('not-empty', onCallNotEmpty);
172
+ call.off('update', onCallUpdated);
173
+
174
+ this.onCallRemoved?.(call, this.context);
175
+ });
176
+ call.on('newclient', this._onClientAdded);
177
+ call.on('empty', onCallEmpty);
178
+ call.on('not-empty', onCallNotEmpty);
179
+ call.on('update', onCallUpdated);
180
+
181
+ this.onCallAdded?.(call, this.context);
182
+ }
183
+
184
+ private _onClientAdded(observedClient: ObservedClient) {
185
+ const onClientIssue = (issue: ClientIssue) => this._onClientIssue(observedClient, issue);
186
+ const onClientMetadata = (metaData: ClientMetaData) => this._onClientMetadata(observedClient, metaData);
187
+ const onClientJoined = () => this._onClientJoined(observedClient);
188
+ const onClientLeft = () => this._onClientLeft(observedClient);
189
+ const onClientRejoined = () => this._onClientRejoined(observedClient);
190
+ const onClientExtensionStats = (extensionStats: ExtensionStat) => this._onClientExtensionStats(observedClient, extensionStats);
191
+ const onUsingTurn = (usingTurn: boolean) => this._onUsingTurn(observedClient, usingTurn);
192
+ const onUserMediaError = (error: string) => this._onUserMediaError(observedClient, error);
193
+ const onClientUpdated = (...args: ObservedClientEvents['update']) => this.onClientUpdated?.(observedClient, args[0], this.context);
194
+ const onClientEvent = (event: ClientEvent) => this.onClientEvent?.(observedClient, event, this.context);
195
+
196
+ observedClient.once('close', () => {
197
+ observedClient.off('newpeerconnection', this._onPeerConnconnectionAdded);
198
+ observedClient.off('issue', onClientIssue);
199
+ observedClient.off('metaData', onClientMetadata);
200
+ observedClient.off('joined', onClientJoined);
201
+ observedClient.off('left', onClientLeft);
202
+ observedClient.off('rejoined', onClientJoined);
203
+ observedClient.off('usermediaerror', onUserMediaError);
204
+ observedClient.off('usingturn', onUsingTurn);
205
+ observedClient.off('extensionStats', onClientExtensionStats);
206
+ observedClient.off('update', onClientUpdated);
207
+ observedClient.off('clientEvent', onClientEvent);
208
+
209
+ this.onClientClosed?.(observedClient, this.context);
210
+ });
211
+
212
+ observedClient.on('newpeerconnection', this._onPeerConnconnectionAdded);
213
+ observedClient.on('issue', onClientIssue);
214
+ observedClient.on('metaData', onClientMetadata);
215
+ observedClient.on('joined', onClientJoined);
216
+ observedClient.on('left', onClientLeft);
217
+ observedClient.on('rejoined', onClientRejoined);
218
+ observedClient.on('usermediaerror', onUserMediaError);
219
+ observedClient.on('usingturn', onUsingTurn);
220
+ observedClient.on('extensionStats', onClientExtensionStats);
221
+ observedClient.on('update', onClientUpdated);
222
+ observedClient.on('clientEvent', onClientEvent);
223
+
224
+ this.onClientAdded?.(observedClient, this.context);
225
+ }
226
+
227
+ private _onClientRejoined(observedClient: ObservedClient) {
228
+ this.onClientRejoined?.(observedClient, this.context);
229
+ }
230
+
231
+ private _onPeerConnconnectionAdded(peerConnection: ObservedPeerConnection) {
232
+ const onSelectedCandidatePairChanged = () => this.onSelectedCandidatePairChanged?.(peerConnection, this.context);
233
+ const onIceGatheringStateChange = () => this.onIceGatheringStateChange?.(peerConnection, this.context);
234
+ const onIceConnectionStateChange = () => this.onIceConnectionStateChange?.(peerConnection, this.context);
235
+ const onConnectionStateChange = () => this.onConnectionStateChange?.(peerConnection, this.context);
236
+
237
+ peerConnection.once('close', () => {
238
+ peerConnection.off('added-certificate', this._onCertificateAdded);
239
+ peerConnection.off('removed-certificate', this._onCertificateRemoved);
240
+ peerConnection.off('updated-certificate', this._onCertificateUpdated);
241
+
242
+ peerConnection.off('added-inbound-track', this._onInboundTrackAdded);
243
+ peerConnection.off('removed-inbound-track', this._onInboundTrackRemoved);
244
+ peerConnection.off('updated-inbound-track', this._onInboundTrackUpdated);
245
+ peerConnection.off('muted-inbound-track', this._onInboundTrackMuted);
246
+ peerConnection.off('unmuted-inbound-track', this._onInboundTrackUnmuted);
247
+
248
+ peerConnection.off('added-outbound-track', this._onOutboundTrackAdded);
249
+ peerConnection.off('removed-outbound-track', this._onOutboundTrackRemoved);
250
+ peerConnection.off('updated-outbound-track', this._onOutboundTrackUpdated);
251
+ peerConnection.off('muted-outbound-track', this._onOutboundTrackMuted);
252
+ peerConnection.off('unmuted-outbound-track', this._onOutboundTrackUnmuted);
253
+
254
+ peerConnection.off('added-inbound-rtp', this._onInboundRtpAdded);
255
+ peerConnection.off('removed-inbound-rtp', this._onInboundRtpRemoved);
256
+ peerConnection.off('updated-inbound-rtp', this._onInboundRtpUpdated);
257
+
258
+ peerConnection.off('added-outbound-rtp', this._onOutboundRtpAdded);
259
+ peerConnection.off('removed-outbound-rtp', this._onOutboundRtpRemoved);
260
+ peerConnection.off('updated-outbound-rtp', this._onOutboundRtpUpdated);
261
+
262
+ peerConnection.off('added-data-channel', this._onDataChannelAdded);
263
+ peerConnection.off('removed-data-channel', this._onDataChannelRemoved);
264
+ peerConnection.off('updated-data-channel', this._onDataChannelUpdated);
265
+
266
+ peerConnection.off('added-ice-transport', this._onAddedIceTransport);
267
+ peerConnection.off('removed-ice-transport', this._onRemovedIceTransport);
268
+ peerConnection.off('updated-ice-transport', this._onIceTransportUpdated);
269
+
270
+ peerConnection.off('added-ice-candidate', this._onIceCandidateAdded);
271
+ peerConnection.off('removed-ice-candidate', this._onIceCandidateRemoved);
272
+ peerConnection.off('updated-ice-candidate', this._onIceCandidateUpdated);
273
+
274
+ peerConnection.off('added-ice-candidate-pair', this._onAddedIceCandidatePair);
275
+ peerConnection.off('removed-ice-candidate-pair', this._onRemovedIceCandidatePair);
276
+ peerConnection.off('updated-ice-candidate-pair', this._onIceCandidatePairUpdated);
277
+
278
+ peerConnection.off('added-codec', this._onAddedMediaCodec);
279
+ peerConnection.off('removed-codec', this._onRemovedMediaCodec);
280
+ peerConnection.off('updated-codec', this._onMediaCodecUpdated);
281
+
282
+ peerConnection.off('added-media-playout', this._onAddedMediaPlayout);
283
+ peerConnection.off('removed-media-playout', this._onRemovedMediaPlayout);
284
+ peerConnection.off('updated-media-playout', this._onMediaPlayoutUpdated);
285
+
286
+ peerConnection.off('added-media-source', this._onMediaSourceAdded);
287
+ peerConnection.off('removed-media-source', this._onMediaSourceRemoved);
288
+ peerConnection.off('updated-media-source', this._onMediaSourceUpdated);
289
+
290
+ peerConnection.off('selectedcandidatepair', onSelectedCandidatePairChanged);
291
+ peerConnection.off('icegatheringstatechange', onIceGatheringStateChange);
292
+ peerConnection.off('iceconnectionstatechange', onIceConnectionStateChange);
293
+ peerConnection.off('connectionstatechange', onConnectionStateChange);
294
+
295
+ this.onPeerConnectionRemoved?.(peerConnection, this.context);
296
+ });
297
+
298
+ peerConnection.on('added-certificate', this._onCertificateAdded);
299
+ peerConnection.on('removed-certificate', this._onCertificateRemoved);
300
+ peerConnection.on('updated-certificate', this._onCertificateUpdated);
301
+
302
+ peerConnection.on('added-inbound-track', this._onInboundTrackAdded);
303
+ peerConnection.on('removed-inbound-track', this._onInboundTrackRemoved);
304
+ peerConnection.on('updated-inbound-track', this._onInboundTrackUpdated);
305
+ peerConnection.on('muted-inbound-track', this._onInboundTrackMuted);
306
+ peerConnection.on('unmuted-inbound-track', this._onInboundTrackUnmuted);
307
+
308
+ peerConnection.on('added-outbound-track', this._onOutboundTrackAdded);
309
+ peerConnection.on('removed-outbound-track', this._onOutboundTrackRemoved);
310
+ peerConnection.on('updated-outbound-track', this._onOutboundTrackUpdated);
311
+ peerConnection.on('muted-outbound-track', this._onOutboundTrackMuted);
312
+ peerConnection.on('unmuted-outbound-track', this._onOutboundTrackUnmuted);
313
+
314
+ peerConnection.on('added-inbound-rtp', this._onInboundRtpAdded);
315
+ peerConnection.on('removed-inbound-rtp', this._onInboundRtpRemoved);
316
+ peerConnection.on('updated-inbound-rtp', this._onInboundRtpUpdated);
317
+
318
+ peerConnection.on('added-outbound-rtp', this._onOutboundRtpAdded);
319
+ peerConnection.on('removed-outbound-rtp', this._onOutboundRtpRemoved);
320
+ peerConnection.on('updated-outbound-rtp', this._onOutboundRtpUpdated);
321
+
322
+ peerConnection.on('added-data-channel', this._onDataChannelAdded);
323
+ peerConnection.on('removed-data-channel', this._onDataChannelRemoved);
324
+ peerConnection.on('updated-data-channel', this._onDataChannelUpdated);
325
+
326
+ peerConnection.on('added-ice-transport', this._onAddedIceTransport);
327
+ peerConnection.on('removed-ice-transport', this._onRemovedIceTransport);
328
+ peerConnection.on('updated-ice-transport', this._onIceTransportUpdated);
329
+
330
+ peerConnection.on('added-ice-candidate', this._onIceCandidateAdded);
331
+ peerConnection.on('removed-ice-candidate', this._onIceCandidateRemoved);
332
+ peerConnection.on('updated-ice-candidate', this._onIceCandidateUpdated);
333
+
334
+ peerConnection.on('added-ice-candidate-pair', this._onAddedIceCandidatePair);
335
+ peerConnection.on('removed-ice-candidate-pair', this._onRemovedIceCandidatePair);
336
+ peerConnection.on('updated-ice-candidate-pair', this._onIceCandidatePairUpdated);
337
+
338
+ peerConnection.on('added-codec', this._onAddedMediaCodec);
339
+ peerConnection.on('removed-codec', this._onRemovedMediaCodec);
340
+ peerConnection.on('updated-codec', this._onMediaCodecUpdated);
341
+
342
+ peerConnection.on('added-media-playout', this._onAddedMediaPlayout);
343
+ peerConnection.on('removed-media-playout', this._onRemovedMediaPlayout);
344
+ peerConnection.on('updated-media-playout', this._onMediaPlayoutUpdated);
345
+
346
+ peerConnection.on('added-media-source', this._onMediaSourceAdded);
347
+ peerConnection.on('removed-media-source', this._onMediaSourceRemoved);
348
+ peerConnection.on('updated-media-source', this._onMediaSourceUpdated);
349
+
350
+ peerConnection.on('selectedcandidatepair', onSelectedCandidatePairChanged);
351
+ peerConnection.on('icegatheringstatechange', onIceGatheringStateChange);
352
+ peerConnection.on('iceconnectionstatechange', onIceConnectionStateChange);
353
+ peerConnection.on('connectionstatechange', onConnectionStateChange);
354
+
355
+ this.onPeerConnectionAdded?.(peerConnection, this.context);
356
+
357
+ }
358
+
359
+ private _onPeerConnectionRemoved(peerConnection: ObservedPeerConnection) {
360
+ this.onPeerConnectionRemoved?.(peerConnection, this.context);
361
+
362
+ }
363
+
364
+ private _onCertificateAdded(certificate: ObservedCertificate) {
365
+ this.onCertificateAdded?.(certificate, this.context);
366
+ }
367
+
368
+ private _onCertificateRemoved(certificate: ObservedCertificate) {
369
+ this.onCertificateRemoved?.(certificate, this.context);
370
+ }
371
+
372
+ private _onCertificateUpdated(certificate: ObservedCertificate) {
373
+ this.onCertificateUpdated?.(certificate, this.context);
374
+ }
375
+
376
+ private _onInboundTrackAdded(inboundTrack: ObservedInboundTrack) {
377
+ this.onInboundTrackAdded?.(inboundTrack, this.context);
378
+ }
379
+
380
+ private _onInboundTrackRemoved(inboundTrack: ObservedInboundTrack) {
381
+ this.onInboundTrackRemoved?.(inboundTrack, this.context);
382
+ }
383
+
384
+ private _onInboundTrackUpdated(inboundTrack: ObservedInboundTrack) {
385
+ this.onInboundTrackUpdated?.(inboundTrack, this.context);
386
+ }
387
+
388
+ private _onOutboundTrackMuted(outboundTrack: ObservedOutboundTrack) {
389
+ this.onOutboundTrackMuted?.(outboundTrack, this.context);
390
+ }
391
+
392
+ private _onOutboundTrackUnmuted(outboundTrack: ObservedOutboundTrack) {
393
+ this.onOutboundTrackUnmuted?.(outboundTrack, this.context);
394
+ }
395
+
396
+ private _onOutboundTrackAdded(outboundTrack: ObservedOutboundTrack) {
397
+ this.onOutboundTrackAdded?.(outboundTrack, this.context);
398
+ }
399
+
400
+ private _onOutboundTrackRemoved(outboundTrack: ObservedOutboundTrack) {
401
+ this.onOutboundTrackRemoved?.(outboundTrack, this.context);
402
+ }
403
+
404
+ private _onOutboundTrackUpdated(outboundTrack: ObservedOutboundTrack) {
405
+ this.onOutboundTrackUpdated?.(outboundTrack, this.context);
406
+ }
407
+
408
+ private _onInboundTrackMuted(inboundTrack: ObservedInboundTrack) {
409
+ this.onInboundTrackMuted?.(inboundTrack, this.context);
410
+ }
411
+
412
+ private _onInboundTrackUnmuted(inboundTrack: ObservedInboundTrack) {
413
+ this.onInboundTrackUnmuted?.(inboundTrack, this.context);
414
+ }
415
+
416
+ private _onInboundRtpAdded(inboundRtp: ObservedInboundRtp) {
417
+ this.onInboundRtpAdded?.(inboundRtp, this.context);
418
+ }
419
+
420
+ private _onInboundRtpRemoved(inboundRtp: ObservedInboundRtp) {
421
+ this.onInboundRtpRemoved?.(inboundRtp, this.context);
422
+ }
423
+
424
+ private _onInboundRtpUpdated(inboundRtp: ObservedInboundRtp) {
425
+ this.onInboundRtpUpdated?.(inboundRtp, this.context);
426
+ }
427
+
428
+ private _onOutboundRtpAdded(outboundRtp: ObservedOutboundRtp) {
429
+ this.onOutboundRtpAdded?.(outboundRtp, this.context);
430
+ }
431
+
432
+ private _onOutboundRtpRemoved(outboundRtp: ObservedOutboundRtp) {
433
+ this.onOutboundRtpRemoved?.(outboundRtp, this.context);
434
+ }
435
+
436
+ private _onOutboundRtpUpdated(outboundRtp: ObservedOutboundRtp) {
437
+ this.onOutboundRtpUpdated?.(outboundRtp, this.context);
438
+ }
439
+
440
+ private _onDataChannelAdded(dataChannel: ObservedDataChannel) {
441
+ this.onDataChannelAdded?.(dataChannel, this.context);
442
+ }
443
+
444
+ private _onDataChannelRemoved(dataChannel: ObservedDataChannel) {
445
+ this.onDataChannelRemoved?.(dataChannel, this.context);
446
+ }
447
+
448
+ private _onDataChannelUpdated(dataChannel: ObservedDataChannel) {
449
+ this.onDataChannelUpdated?.(dataChannel, this.context);
450
+ }
451
+
452
+ private _onAddedIceTransport(iceTransport: ObservedIceTransport) {
453
+ this.onAddedIceTransport?.(iceTransport, this.context);
454
+ }
455
+
456
+ private _onRemovedIceTransport(iceTransport: ObservedIceTransport) {
457
+ this.onRemovedIceTransport?.(iceTransport, this.context);
458
+ }
459
+
460
+ private _onIceTransportUpdated(iceTransport: ObservedIceTransport) {
461
+ this.onIceTransportUpdated?.(iceTransport, this.context);
462
+ }
463
+
464
+ private _onIceCandidateAdded(iceCandidate: ObservedIceCandidate) {
465
+ this.onIceCandidateAdded?.(iceCandidate, this.context);
466
+ }
467
+
468
+ private _onIceCandidateRemoved(iceCandidate: ObservedIceCandidate) {
469
+ this.onIceCandidateRemoved?.(iceCandidate, this.context);
470
+ }
471
+
472
+ private _onIceCandidateUpdated(iceCandidate: ObservedIceCandidate) {
473
+ this.onIceCandidateUpdated?.(iceCandidate, this.context);
474
+ }
475
+
476
+ private _onAddedIceCandidatePair(candidatePair: ObservedIceCandidatePair) {
477
+ this.onAddedIceCandidatePair?.(candidatePair, this.context);
478
+ }
479
+
480
+ private _onRemovedIceCandidatePair(candidatePair: ObservedIceCandidatePair) {
481
+ this.onRemovedIceCandidatePair?.(candidatePair, this.context);
482
+ }
483
+
484
+ private _onIceCandidatePairUpdated(candidatePair: ObservedIceCandidatePair) {
485
+ this.onIceCandidatePairUpdated?.(candidatePair, this.context);
486
+ }
487
+
488
+ private _onAddedMediaCodec(codec: ObservedCodec) {
489
+ this.onAddedMediaCodec?.(codec, this.context);
490
+ }
491
+
492
+ private _onRemovedMediaCodec(codec: ObservedCodec) {
493
+ this.onRemovedMediaCodec?.(codec, this.context);
494
+ }
495
+
496
+ private _onMediaCodecUpdated(codec: ObservedCodec) {
497
+ this.onMediaCodecUpdated?.(codec, this.context);
498
+ }
499
+
500
+ private _onAddedMediaPlayout(mediaPlayout: ObservedMediaPlayout) {
501
+ this.onAddedMediaPlayout?.(mediaPlayout, this.context);
502
+ }
503
+
504
+ private _onRemovedMediaPlayout(mediaPlayout: ObservedMediaPlayout) {
505
+ this.onRemovedMediaPlayout?.(mediaPlayout, this.context);
506
+ }
507
+
508
+ private _onMediaPlayoutUpdated(mediaPlayout: ObservedMediaPlayout) {
509
+ this.onMediaPlayoutUpdated?.(mediaPlayout, this.context);
510
+ }
511
+
512
+ private _onMediaSourceAdded(mediaSource: ObservedMediaSource) {
513
+ this.onMediaSourceAdded?.(mediaSource, this.context);
514
+ }
515
+
516
+ private _onMediaSourceRemoved(mediaSource: ObservedMediaSource) {
517
+ this.onMediaSourceRemoved?.(mediaSource, this.context);
518
+ }
519
+
520
+ private _onMediaSourceUpdated(mediaSource: ObservedMediaSource) {
521
+ this.onMediaSourceUpdated?.(mediaSource, this.context);
522
+ }
523
+
524
+ private _onClientIssue(observedClent: ObservedClient, issue: ClientIssue) {
525
+ this.onClientIssue?.(observedClent, issue, this.context);
526
+ }
527
+
528
+ private _onClientMetadata(observedClient: ObservedClient, metadata: ClientMetaData) {
529
+ this.onClientMetadata?.(observedClient, metadata, this.context);
530
+ }
531
+
532
+ private _onClientExtensionStats(observedClient: ObservedClient, extensionStats: ExtensionStat) {
533
+ this.onClientExtensionStats?.(observedClient, extensionStats, this.context);
534
+ }
535
+
536
+ private _onClientJoined(observedClient: ObservedClient) {
537
+ this.onClientJoined?.(observedClient, this.context);
538
+ }
539
+
540
+ private _onClientLeft(observedClient: ObservedClient) {
541
+ this.onClientLeft?.(observedClient, this.context);
542
+ }
543
+
544
+ private _onUserMediaError(observedClient: ObservedClient, error: string) {
545
+ this.onClientUserMediaError?.(observedClient, error, this.context);
546
+ }
547
+
548
+ private _onUsingTurn(observedClient: ObservedClient, usingTurn: boolean) {
549
+ this.onClientUsingTurn?.(observedClient, usingTurn, this.context);
550
+ }
551
+ }
@@ -0,0 +1,91 @@
1
+ import { MediaKind } from "./types"
2
+
3
+ export type CallSummary = {
4
+ startedAt: number; // the timestamp when the call started
5
+ endedAt?: number; // the timestamp when the call ended
6
+ id: string; // the call ID
7
+ attachments: Record<string, unknown>; // will contain the merged attachments
8
+ clients: Record<string, ClientSummary>; // client ID -> client report
9
+ issues: Record<string, number>;
10
+ totalScore: number;
11
+ numberOfScores: number;
12
+ scoreReasons: Record<string, number>;
13
+
14
+ liveState?: {
15
+
16
+ };
17
+ }
18
+
19
+ export type ClientSummary = {
20
+ id: string; // the client ID
21
+ attachments: Record<string, unknown>; // will contain the merged attachments
22
+ joinedAt: number; // the timestamp when the client joined the call
23
+ leftAt?: number; // the timestamp when the client left the call
24
+ peerConnections: Record<string, PeerConnectionSummary>; // peer connection ID -> peer connection report
25
+ issues: Record<string, number>;
26
+ totalScore: number;
27
+ numberOfScores: number;
28
+ scoreReasons: Record<string, number>;
29
+
30
+ liveState?: {
31
+ score?: number; // the current score of the client
32
+
33
+ };
34
+ }
35
+
36
+ export type PeerConnectionSummary = {
37
+ id: string; // the peer connection ID
38
+ attachments: Record<string, unknown>; // will contain the merged attachments
39
+ openedAt: number; // the timestamp when the peer connection was opened
40
+ closedAt?: number; // the timestamp when the peer connection was closed
41
+
42
+ inboundTracks: Record<string, InboundTrackSummary>; // track ID -> inbound track report
43
+ outboundTracks: Record<string, OutboundTrackSummary>; // track ID -> outbound track report
44
+
45
+ liveState?: {
46
+ score?: number;
47
+ };
48
+ }
49
+
50
+ type InboundTrackSummary = {
51
+ callId: string; // the call ID this track belongs to
52
+ clientId: string; // the client ID this track belongs to
53
+ peerConnectionId: string; // the peer connection ID this track belongs to
54
+
55
+ id: string;
56
+ attachments: Record<string, unknown>; // will contain the merged attachments
57
+ createdAt: number;
58
+ closedAt?: number;
59
+ kind: MediaKind;
60
+
61
+ totalScore: number;
62
+ numberOfScores: number;
63
+ scoreReasons: Record<string, number>;
64
+
65
+ liveState?: {
66
+ score?: number;
67
+ remoteTrackMuted?: boolean;
68
+ muted?: boolean;
69
+ };
70
+ }
71
+
72
+ type OutboundTrackSummary = {
73
+ callId: string; // the call ID this track belongs to
74
+ clientId: string; // the client ID this track belongs to
75
+ peerConnectionId: string; // the peer connection ID this track belongs to
76
+
77
+ id: string;
78
+ attachments: Record<string, unknown>; // will contain the merged attachments
79
+ createdAt: number;
80
+ closedAt?: number;
81
+ kind: MediaKind;
82
+
83
+ totalScore: number;
84
+ numberOfScores: number;
85
+ scoreReasons: Record<string, number>;
86
+
87
+ liveState?: {
88
+ score?: number;
89
+ muted?: boolean;
90
+ };
91
+ }