@abrar71/lib-jitsi-meet 0.0.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 (350) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +26 -0
  3. package/dist/esm/JitsiConference.js +3692 -0
  4. package/dist/esm/JitsiConference.js.map +1 -0
  5. package/dist/esm/JitsiConferenceErrors.js +126 -0
  6. package/dist/esm/JitsiConferenceErrors.js.map +1 -0
  7. package/dist/esm/JitsiConferenceEventManager.js +424 -0
  8. package/dist/esm/JitsiConferenceEventManager.js.map +1 -0
  9. package/dist/esm/JitsiConferenceEvents.js +431 -0
  10. package/dist/esm/JitsiConferenceEvents.js.map +1 -0
  11. package/dist/esm/JitsiConnection.js +187 -0
  12. package/dist/esm/JitsiConnection.js.map +1 -0
  13. package/dist/esm/JitsiConnectionErrors.js +52 -0
  14. package/dist/esm/JitsiConnectionErrors.js.map +1 -0
  15. package/dist/esm/JitsiConnectionEvents.js +57 -0
  16. package/dist/esm/JitsiConnectionEvents.js.map +1 -0
  17. package/dist/esm/JitsiMediaDevices.js +221 -0
  18. package/dist/esm/JitsiMediaDevices.js.map +1 -0
  19. package/dist/esm/JitsiMediaDevicesEvents.js +29 -0
  20. package/dist/esm/JitsiMediaDevicesEvents.js.map +1 -0
  21. package/dist/esm/JitsiMeetJS.js +499 -0
  22. package/dist/esm/JitsiMeetJS.js.map +1 -0
  23. package/dist/esm/JitsiParticipant.js +323 -0
  24. package/dist/esm/JitsiParticipant.js.map +1 -0
  25. package/dist/esm/JitsiTrackError.js +122 -0
  26. package/dist/esm/JitsiTrackError.js.map +1 -0
  27. package/dist/esm/JitsiTrackErrors.js +91 -0
  28. package/dist/esm/JitsiTrackErrors.js.map +1 -0
  29. package/dist/esm/JitsiTrackEvents.js +60 -0
  30. package/dist/esm/JitsiTrackEvents.js.map +1 -0
  31. package/dist/esm/JitsiTranscriptionStatus.js +15 -0
  32. package/dist/esm/JitsiTranscriptionStatus.js.map +1 -0
  33. package/dist/esm/modules/RTC/BridgeChannel.js +398 -0
  34. package/dist/esm/modules/RTC/BridgeChannel.js.map +1 -0
  35. package/dist/esm/modules/RTC/JitsiLocalTrack.js +896 -0
  36. package/dist/esm/modules/RTC/JitsiLocalTrack.js.map +1 -0
  37. package/dist/esm/modules/RTC/JitsiRemoteTrack.js +427 -0
  38. package/dist/esm/modules/RTC/JitsiRemoteTrack.js.map +1 -0
  39. package/dist/esm/modules/RTC/JitsiTrack.js +453 -0
  40. package/dist/esm/modules/RTC/JitsiTrack.js.map +1 -0
  41. package/dist/esm/modules/RTC/MockClasses.js +388 -0
  42. package/dist/esm/modules/RTC/MockClasses.js.map +1 -0
  43. package/dist/esm/modules/RTC/RTC.js +658 -0
  44. package/dist/esm/modules/RTC/RTC.js.map +1 -0
  45. package/dist/esm/modules/RTC/RTCUtils.js +762 -0
  46. package/dist/esm/modules/RTC/RTCUtils.js.map +1 -0
  47. package/dist/esm/modules/RTC/ScreenObtainer.js +380 -0
  48. package/dist/esm/modules/RTC/ScreenObtainer.js.map +1 -0
  49. package/dist/esm/modules/RTC/TPCUtils.js +803 -0
  50. package/dist/esm/modules/RTC/TPCUtils.js.map +1 -0
  51. package/dist/esm/modules/RTC/TraceablePeerConnection.js +2223 -0
  52. package/dist/esm/modules/RTC/TraceablePeerConnection.js.map +1 -0
  53. package/dist/esm/modules/RTCStats/DefaulLogStorage.js +35 -0
  54. package/dist/esm/modules/RTCStats/DefaulLogStorage.js.map +1 -0
  55. package/dist/esm/modules/RTCStats/RTCStats.js +219 -0
  56. package/dist/esm/modules/RTCStats/RTCStats.js.map +1 -0
  57. package/dist/esm/modules/RTCStats/RTCStatsEvents.js +92 -0
  58. package/dist/esm/modules/RTCStats/RTCStatsEvents.js.map +1 -0
  59. package/dist/esm/modules/RTCStats/interfaces.js +2 -0
  60. package/dist/esm/modules/RTCStats/interfaces.js.map +1 -0
  61. package/dist/esm/modules/browser/BrowserCapabilities.js +345 -0
  62. package/dist/esm/modules/browser/BrowserCapabilities.js.map +1 -0
  63. package/dist/esm/modules/browser/index.js +3 -0
  64. package/dist/esm/modules/browser/index.js.map +1 -0
  65. package/dist/esm/modules/connectivity/ConnectionQuality.js +389 -0
  66. package/dist/esm/modules/connectivity/ConnectionQuality.js.map +1 -0
  67. package/dist/esm/modules/connectivity/IceFailedHandling.js +84 -0
  68. package/dist/esm/modules/connectivity/IceFailedHandling.js.map +1 -0
  69. package/dist/esm/modules/connectivity/NetworkInfo.js +49 -0
  70. package/dist/esm/modules/connectivity/NetworkInfo.js.map +1 -0
  71. package/dist/esm/modules/connectivity/TrackStreamingStatus.js +453 -0
  72. package/dist/esm/modules/connectivity/TrackStreamingStatus.js.map +1 -0
  73. package/dist/esm/modules/detection/ActiveDeviceDetector.js +79 -0
  74. package/dist/esm/modules/detection/ActiveDeviceDetector.js.map +1 -0
  75. package/dist/esm/modules/detection/DetectionEvents.js +58 -0
  76. package/dist/esm/modules/detection/DetectionEvents.js.map +1 -0
  77. package/dist/esm/modules/detection/NoAudioSignalDetection.js +127 -0
  78. package/dist/esm/modules/detection/NoAudioSignalDetection.js.map +1 -0
  79. package/dist/esm/modules/detection/P2PDominantSpeakerDetection.js +47 -0
  80. package/dist/esm/modules/detection/P2PDominantSpeakerDetection.js.map +1 -0
  81. package/dist/esm/modules/detection/TrackVADEmitter.js +190 -0
  82. package/dist/esm/modules/detection/TrackVADEmitter.js.map +1 -0
  83. package/dist/esm/modules/detection/VADAudioAnalyser.js +199 -0
  84. package/dist/esm/modules/detection/VADAudioAnalyser.js.map +1 -0
  85. package/dist/esm/modules/detection/VADNoiseDetection.js +168 -0
  86. package/dist/esm/modules/detection/VADNoiseDetection.js.map +1 -0
  87. package/dist/esm/modules/detection/VADReportingService.js +203 -0
  88. package/dist/esm/modules/detection/VADReportingService.js.map +1 -0
  89. package/dist/esm/modules/detection/VADTalkMutedDetection.js +131 -0
  90. package/dist/esm/modules/detection/VADTalkMutedDetection.js.map +1 -0
  91. package/dist/esm/modules/e2ee/Context.js +274 -0
  92. package/dist/esm/modules/e2ee/Context.js.map +1 -0
  93. package/dist/esm/modules/e2ee/E2EEContext.js +158 -0
  94. package/dist/esm/modules/e2ee/E2EEContext.js.map +1 -0
  95. package/dist/esm/modules/e2ee/E2EEErrors.js +10 -0
  96. package/dist/esm/modules/e2ee/E2EEErrors.js.map +1 -0
  97. package/dist/esm/modules/e2ee/E2EEncryption.js +87 -0
  98. package/dist/esm/modules/e2ee/E2EEncryption.js.map +1 -0
  99. package/dist/esm/modules/e2ee/ExternallyManagedKeyHandler.js +24 -0
  100. package/dist/esm/modules/e2ee/ExternallyManagedKeyHandler.js.map +1 -0
  101. package/dist/esm/modules/e2ee/KeyHandler.js +137 -0
  102. package/dist/esm/modules/e2ee/KeyHandler.js.map +1 -0
  103. package/dist/esm/modules/e2ee/ManagedKeyHandler.js +182 -0
  104. package/dist/esm/modules/e2ee/ManagedKeyHandler.js.map +1 -0
  105. package/dist/esm/modules/e2ee/OlmAdapter.js +860 -0
  106. package/dist/esm/modules/e2ee/OlmAdapter.js.map +1 -0
  107. package/dist/esm/modules/e2ee/SAS.js +128 -0
  108. package/dist/esm/modules/e2ee/SAS.js.map +1 -0
  109. package/dist/esm/modules/e2ee/Worker.js +102 -0
  110. package/dist/esm/modules/e2ee/Worker.js.map +1 -0
  111. package/dist/esm/modules/e2ee/crypto-utils.js +53 -0
  112. package/dist/esm/modules/e2ee/crypto-utils.js.map +1 -0
  113. package/dist/esm/modules/e2ee/utils.js +15 -0
  114. package/dist/esm/modules/e2ee/utils.js.map +1 -0
  115. package/dist/esm/modules/e2eping/e2eping.js +314 -0
  116. package/dist/esm/modules/e2eping/e2eping.js.map +1 -0
  117. package/dist/esm/modules/flags/FeatureFlags.js +36 -0
  118. package/dist/esm/modules/flags/FeatureFlags.js.map +1 -0
  119. package/dist/esm/modules/litemode/LiteModeContext.js +50 -0
  120. package/dist/esm/modules/litemode/LiteModeContext.js.map +1 -0
  121. package/dist/esm/modules/proxyconnection/CustomSignalingLayer.js +98 -0
  122. package/dist/esm/modules/proxyconnection/CustomSignalingLayer.js.map +1 -0
  123. package/dist/esm/modules/proxyconnection/ProxyConnectionPC.js +348 -0
  124. package/dist/esm/modules/proxyconnection/ProxyConnectionPC.js.map +1 -0
  125. package/dist/esm/modules/proxyconnection/ProxyConnectionService.js +279 -0
  126. package/dist/esm/modules/proxyconnection/ProxyConnectionService.js.map +1 -0
  127. package/dist/esm/modules/proxyconnection/constants.js +14 -0
  128. package/dist/esm/modules/proxyconnection/constants.js.map +1 -0
  129. package/dist/esm/modules/qualitycontrol/CodecSelection.js +222 -0
  130. package/dist/esm/modules/qualitycontrol/CodecSelection.js.map +1 -0
  131. package/dist/esm/modules/qualitycontrol/MockClasses.js +120 -0
  132. package/dist/esm/modules/qualitycontrol/MockClasses.js.map +1 -0
  133. package/dist/esm/modules/qualitycontrol/QualityController.js +366 -0
  134. package/dist/esm/modules/qualitycontrol/QualityController.js.map +1 -0
  135. package/dist/esm/modules/qualitycontrol/ReceiveAudioController.js +73 -0
  136. package/dist/esm/modules/qualitycontrol/ReceiveAudioController.js.map +1 -0
  137. package/dist/esm/modules/qualitycontrol/ReceiveVideoController.js +216 -0
  138. package/dist/esm/modules/qualitycontrol/ReceiveVideoController.js.map +1 -0
  139. package/dist/esm/modules/qualitycontrol/SendVideoController.js +133 -0
  140. package/dist/esm/modules/qualitycontrol/SendVideoController.js.map +1 -0
  141. package/dist/esm/modules/recording/JibriSession.js +279 -0
  142. package/dist/esm/modules/recording/JibriSession.js.map +1 -0
  143. package/dist/esm/modules/recording/RecordingManager.js +257 -0
  144. package/dist/esm/modules/recording/RecordingManager.js.map +1 -0
  145. package/dist/esm/modules/recording/recordingConstants.js +21 -0
  146. package/dist/esm/modules/recording/recordingConstants.js.map +1 -0
  147. package/dist/esm/modules/recording/recordingXMLUtils.js +69 -0
  148. package/dist/esm/modules/recording/recordingXMLUtils.js.map +1 -0
  149. package/dist/esm/modules/red/red.js +108 -0
  150. package/dist/esm/modules/red/red.js.map +1 -0
  151. package/dist/esm/modules/sdp/LocalSdpMunger.js +143 -0
  152. package/dist/esm/modules/sdp/LocalSdpMunger.js.map +1 -0
  153. package/dist/esm/modules/sdp/RtxModifier.js +179 -0
  154. package/dist/esm/modules/sdp/RtxModifier.js.map +1 -0
  155. package/dist/esm/modules/sdp/SDP.js +848 -0
  156. package/dist/esm/modules/sdp/SDP.js.map +1 -0
  157. package/dist/esm/modules/sdp/SDPDiffer.js +96 -0
  158. package/dist/esm/modules/sdp/SDPDiffer.js.map +1 -0
  159. package/dist/esm/modules/sdp/SDPUtil.js +798 -0
  160. package/dist/esm/modules/sdp/SDPUtil.js.map +1 -0
  161. package/dist/esm/modules/sdp/SampleSdpStrings.js +589 -0
  162. package/dist/esm/modules/sdp/SampleSdpStrings.js.map +1 -0
  163. package/dist/esm/modules/sdp/SdpSimulcast.js +196 -0
  164. package/dist/esm/modules/sdp/SdpSimulcast.js.map +1 -0
  165. package/dist/esm/modules/sdp/SdpTransformUtil.js +337 -0
  166. package/dist/esm/modules/sdp/SdpTransformUtil.js.map +1 -0
  167. package/dist/esm/modules/sdp/constants.js +2 -0
  168. package/dist/esm/modules/sdp/constants.js.map +1 -0
  169. package/dist/esm/modules/settings/Settings.js +95 -0
  170. package/dist/esm/modules/settings/Settings.js.map +1 -0
  171. package/dist/esm/modules/statistics/AnalyticsAdapter.js +277 -0
  172. package/dist/esm/modules/statistics/AnalyticsAdapter.js.map +1 -0
  173. package/dist/esm/modules/statistics/AvgRTPStatsReporter.js +817 -0
  174. package/dist/esm/modules/statistics/AvgRTPStatsReporter.js.map +1 -0
  175. package/dist/esm/modules/statistics/LocalStatsCollector.js +149 -0
  176. package/dist/esm/modules/statistics/LocalStatsCollector.js.map +1 -0
  177. package/dist/esm/modules/statistics/PreCallTest.js +15 -0
  178. package/dist/esm/modules/statistics/PreCallTest.js.map +1 -0
  179. package/dist/esm/modules/statistics/RTPStatsCollector.js +601 -0
  180. package/dist/esm/modules/statistics/RTPStatsCollector.js.map +1 -0
  181. package/dist/esm/modules/statistics/SpeakerStats.js +163 -0
  182. package/dist/esm/modules/statistics/SpeakerStats.js.map +1 -0
  183. package/dist/esm/modules/statistics/SpeakerStatsCollector.js +161 -0
  184. package/dist/esm/modules/statistics/SpeakerStatsCollector.js.map +1 -0
  185. package/dist/esm/modules/statistics/constants.js +7 -0
  186. package/dist/esm/modules/statistics/constants.js.map +1 -0
  187. package/dist/esm/modules/statistics/statistics.js +362 -0
  188. package/dist/esm/modules/statistics/statistics.js.map +1 -0
  189. package/dist/esm/modules/util/AsyncQueue.js +102 -0
  190. package/dist/esm/modules/util/AsyncQueue.js.map +1 -0
  191. package/dist/esm/modules/util/Deferred.js +41 -0
  192. package/dist/esm/modules/util/Deferred.js.map +1 -0
  193. package/dist/esm/modules/util/EventEmitter.js +17 -0
  194. package/dist/esm/modules/util/EventEmitter.js.map +1 -0
  195. package/dist/esm/modules/util/EventEmitterForwarder.js +52 -0
  196. package/dist/esm/modules/util/EventEmitterForwarder.js.map +1 -0
  197. package/dist/esm/modules/util/Listenable.js +106 -0
  198. package/dist/esm/modules/util/Listenable.js.map +1 -0
  199. package/dist/esm/modules/util/MathUtil.js +103 -0
  200. package/dist/esm/modules/util/MathUtil.js.map +1 -0
  201. package/dist/esm/modules/util/RandomUtil.js +66 -0
  202. package/dist/esm/modules/util/RandomUtil.js.map +1 -0
  203. package/dist/esm/modules/util/Retry.js +15 -0
  204. package/dist/esm/modules/util/Retry.js.map +1 -0
  205. package/dist/esm/modules/util/ScriptUtil.js +58 -0
  206. package/dist/esm/modules/util/ScriptUtil.js.map +1 -0
  207. package/dist/esm/modules/util/StringUtils.js +21 -0
  208. package/dist/esm/modules/util/StringUtils.js.map +1 -0
  209. package/dist/esm/modules/util/TestUtils.js +14 -0
  210. package/dist/esm/modules/util/TestUtils.js.map +1 -0
  211. package/dist/esm/modules/util/UsernameGenerator.js +436 -0
  212. package/dist/esm/modules/util/UsernameGenerator.js.map +1 -0
  213. package/dist/esm/modules/util/XMLUtils.js +135 -0
  214. package/dist/esm/modules/util/XMLUtils.js.map +1 -0
  215. package/dist/esm/modules/version/ComponentsVersions.js +52 -0
  216. package/dist/esm/modules/version/ComponentsVersions.js.map +1 -0
  217. package/dist/esm/modules/videosipgw/JitsiVideoSIPGWSession.js +137 -0
  218. package/dist/esm/modules/videosipgw/JitsiVideoSIPGWSession.js.map +1 -0
  219. package/dist/esm/modules/videosipgw/VideoSIPGW.js +102 -0
  220. package/dist/esm/modules/videosipgw/VideoSIPGW.js.map +1 -0
  221. package/dist/esm/modules/videosipgw/VideoSIPGWConstants.js +65 -0
  222. package/dist/esm/modules/videosipgw/VideoSIPGWConstants.js.map +1 -0
  223. package/dist/esm/modules/watchRTC/WatchRTC.js +69 -0
  224. package/dist/esm/modules/watchRTC/WatchRTC.js.map +1 -0
  225. package/dist/esm/modules/watchRTC/functions.js +31 -0
  226. package/dist/esm/modules/watchRTC/functions.js.map +1 -0
  227. package/dist/esm/modules/watchRTC/interfaces.js +2 -0
  228. package/dist/esm/modules/watchRTC/interfaces.js.map +1 -0
  229. package/dist/esm/modules/webaudio/AudioMixer.js +74 -0
  230. package/dist/esm/modules/webaudio/AudioMixer.js.map +1 -0
  231. package/dist/esm/modules/webaudio/WebAudioUtils.js +13 -0
  232. package/dist/esm/modules/webaudio/WebAudioUtils.js.map +1 -0
  233. package/dist/esm/modules/xmpp/AVModeration.js +156 -0
  234. package/dist/esm/modules/xmpp/AVModeration.js.map +1 -0
  235. package/dist/esm/modules/xmpp/BreakoutRooms.js +230 -0
  236. package/dist/esm/modules/xmpp/BreakoutRooms.js.map +1 -0
  237. package/dist/esm/modules/xmpp/Caps.js +223 -0
  238. package/dist/esm/modules/xmpp/Caps.js.map +1 -0
  239. package/dist/esm/modules/xmpp/ChatRoom.js +1877 -0
  240. package/dist/esm/modules/xmpp/ChatRoom.js.map +1 -0
  241. package/dist/esm/modules/xmpp/ConnectionPlugin.js +37 -0
  242. package/dist/esm/modules/xmpp/ConnectionPlugin.js.map +1 -0
  243. package/dist/esm/modules/xmpp/FileSharing.js +95 -0
  244. package/dist/esm/modules/xmpp/FileSharing.js.map +1 -0
  245. package/dist/esm/modules/xmpp/JingleHelperFunctions.js +168 -0
  246. package/dist/esm/modules/xmpp/JingleHelperFunctions.js.map +1 -0
  247. package/dist/esm/modules/xmpp/JingleSession.js +166 -0
  248. package/dist/esm/modules/xmpp/JingleSession.js.map +1 -0
  249. package/dist/esm/modules/xmpp/JingleSessionPC.js +1969 -0
  250. package/dist/esm/modules/xmpp/JingleSessionPC.js.map +1 -0
  251. package/dist/esm/modules/xmpp/JingleSessionState.js +23 -0
  252. package/dist/esm/modules/xmpp/JingleSessionState.js.map +1 -0
  253. package/dist/esm/modules/xmpp/Lobby.js +384 -0
  254. package/dist/esm/modules/xmpp/Lobby.js.map +1 -0
  255. package/dist/esm/modules/xmpp/MediaSessionEvents.js +12 -0
  256. package/dist/esm/modules/xmpp/MediaSessionEvents.js.map +1 -0
  257. package/dist/esm/modules/xmpp/MockClasses.js +77 -0
  258. package/dist/esm/modules/xmpp/MockClasses.js.map +1 -0
  259. package/dist/esm/modules/xmpp/Polls.js +87 -0
  260. package/dist/esm/modules/xmpp/Polls.js.map +1 -0
  261. package/dist/esm/modules/xmpp/ResumeTask.js +149 -0
  262. package/dist/esm/modules/xmpp/ResumeTask.js.map +1 -0
  263. package/dist/esm/modules/xmpp/RoomMetadata.js +96 -0
  264. package/dist/esm/modules/xmpp/RoomMetadata.js.map +1 -0
  265. package/dist/esm/modules/xmpp/SignalingLayerImpl.js +313 -0
  266. package/dist/esm/modules/xmpp/SignalingLayerImpl.js.map +1 -0
  267. package/dist/esm/modules/xmpp/StropheErrorHandler.js +53 -0
  268. package/dist/esm/modules/xmpp/StropheErrorHandler.js.map +1 -0
  269. package/dist/esm/modules/xmpp/StropheLastSuccess.js +52 -0
  270. package/dist/esm/modules/xmpp/StropheLastSuccess.js.map +1 -0
  271. package/dist/esm/modules/xmpp/XmppConnection.js +579 -0
  272. package/dist/esm/modules/xmpp/XmppConnection.js.map +1 -0
  273. package/dist/esm/modules/xmpp/moderator.js +524 -0
  274. package/dist/esm/modules/xmpp/moderator.js.map +1 -0
  275. package/dist/esm/modules/xmpp/sha1.js +165 -0
  276. package/dist/esm/modules/xmpp/sha1.js.map +1 -0
  277. package/dist/esm/modules/xmpp/strophe.disco.js +222 -0
  278. package/dist/esm/modules/xmpp/strophe.disco.js.map +1 -0
  279. package/dist/esm/modules/xmpp/strophe.emuc.js +206 -0
  280. package/dist/esm/modules/xmpp/strophe.emuc.js.map +1 -0
  281. package/dist/esm/modules/xmpp/strophe.jingle.js +404 -0
  282. package/dist/esm/modules/xmpp/strophe.jingle.js.map +1 -0
  283. package/dist/esm/modules/xmpp/strophe.logger.js +44 -0
  284. package/dist/esm/modules/xmpp/strophe.logger.js.map +1 -0
  285. package/dist/esm/modules/xmpp/strophe.ping.js +170 -0
  286. package/dist/esm/modules/xmpp/strophe.ping.js.map +1 -0
  287. package/dist/esm/modules/xmpp/strophe.rayo.js +117 -0
  288. package/dist/esm/modules/xmpp/strophe.rayo.js.map +1 -0
  289. package/dist/esm/modules/xmpp/strophe.stream-management.js +365 -0
  290. package/dist/esm/modules/xmpp/strophe.stream-management.js.map +1 -0
  291. package/dist/esm/modules/xmpp/strophe.util.js +116 -0
  292. package/dist/esm/modules/xmpp/strophe.util.js.map +1 -0
  293. package/dist/esm/modules/xmpp/xmpp.js +973 -0
  294. package/dist/esm/modules/xmpp/xmpp.js.map +1 -0
  295. package/dist/esm/service/RTC/BridgeVideoType.js +24 -0
  296. package/dist/esm/service/RTC/BridgeVideoType.js.map +1 -0
  297. package/dist/esm/service/RTC/CameraFacingMode.js +21 -0
  298. package/dist/esm/service/RTC/CameraFacingMode.js.map +1 -0
  299. package/dist/esm/service/RTC/CodecMimeType.js +36 -0
  300. package/dist/esm/service/RTC/CodecMimeType.js.map +1 -0
  301. package/dist/esm/service/RTC/MediaDirection.js +23 -0
  302. package/dist/esm/service/RTC/MediaDirection.js.map +1 -0
  303. package/dist/esm/service/RTC/MediaType.js +20 -0
  304. package/dist/esm/service/RTC/MediaType.js.map +1 -0
  305. package/dist/esm/service/RTC/RTCEvents.js +111 -0
  306. package/dist/esm/service/RTC/RTCEvents.js.map +1 -0
  307. package/dist/esm/service/RTC/ReceiverAudioSubscription.js +27 -0
  308. package/dist/esm/service/RTC/ReceiverAudioSubscription.js.map +1 -0
  309. package/dist/esm/service/RTC/Resolutions.js +56 -0
  310. package/dist/esm/service/RTC/Resolutions.js.map +1 -0
  311. package/dist/esm/service/RTC/SignalingEvents.js +42 -0
  312. package/dist/esm/service/RTC/SignalingEvents.js.map +1 -0
  313. package/dist/esm/service/RTC/SignalingLayer.js +153 -0
  314. package/dist/esm/service/RTC/SignalingLayer.js.map +1 -0
  315. package/dist/esm/service/RTC/StandardVideoQualitySettings.js +180 -0
  316. package/dist/esm/service/RTC/StandardVideoQualitySettings.js.map +1 -0
  317. package/dist/esm/service/RTC/VideoEncoderScalabilityMode.js +36 -0
  318. package/dist/esm/service/RTC/VideoEncoderScalabilityMode.js.map +1 -0
  319. package/dist/esm/service/RTC/VideoType.js +19 -0
  320. package/dist/esm/service/RTC/VideoType.js.map +1 -0
  321. package/dist/esm/service/authentication/AuthenticationEvents.js +13 -0
  322. package/dist/esm/service/authentication/AuthenticationEvents.js.map +1 -0
  323. package/dist/esm/service/connectivity/ConnectionQualityEvents.js +13 -0
  324. package/dist/esm/service/connectivity/ConnectionQualityEvents.js.map +1 -0
  325. package/dist/esm/service/connectivity/Constants.js +3 -0
  326. package/dist/esm/service/connectivity/Constants.js.map +1 -0
  327. package/dist/esm/service/e2eping/E2ePingEvents.js +8 -0
  328. package/dist/esm/service/e2eping/E2ePingEvents.js.map +1 -0
  329. package/dist/esm/service/statistics/AnalyticsEvents.js +521 -0
  330. package/dist/esm/service/statistics/AnalyticsEvents.js.map +1 -0
  331. package/dist/esm/service/statistics/Events.js +36 -0
  332. package/dist/esm/service/statistics/Events.js.map +1 -0
  333. package/dist/esm/service/statistics/constants.js +2 -0
  334. package/dist/esm/service/statistics/constants.js.map +1 -0
  335. package/dist/esm/service/xmpp/XMPPEvents.js +359 -0
  336. package/dist/esm/service/xmpp/XMPPEvents.js.map +1 -0
  337. package/dist/esm/service/xmpp/XMPPExtensioProtocols.js +64 -0
  338. package/dist/esm/service/xmpp/XMPPExtensioProtocols.js.map +1 -0
  339. package/dist/esm/test-setup-polyfill.js +34 -0
  340. package/dist/esm/test-setup-polyfill.js.map +1 -0
  341. package/dist/esm/tools/gen-version.js +15 -0
  342. package/dist/esm/tools/gen-version.js.map +1 -0
  343. package/dist/esm/version.js +3 -0
  344. package/dist/esm/version.js.map +1 -0
  345. package/dist/umd/lib-jitsi-meet.e2ee-worker.js +484 -0
  346. package/dist/umd/lib-jitsi-meet.min.js +3 -0
  347. package/dist/umd/lib-jitsi-meet.min.js.LICENSE.txt +18 -0
  348. package/dist/umd/lib-jitsi-meet.min.map +1 -0
  349. package/package.json +93 -0
  350. package/types/index.d.ts +16180 -0
@@ -0,0 +1,817 @@
1
+ import { getLogger } from '@jitsi/logger';
2
+ import { isEqual } from 'lodash-es';
3
+ import { JitsiConferenceEvents as ConferenceEvents } from '../../JitsiConferenceEvents';
4
+ import { MediaType } from '../../service/RTC/MediaType';
5
+ import { VideoType } from '../../service/RTC/VideoType';
6
+ import { ConnectionQualityEvents } from '../../service/connectivity/ConnectionQualityEvents';
7
+ import { createRtpStatsEvent, createTransportStatsEvent } from '../../service/statistics/AnalyticsEvents';
8
+ import browser from '../browser';
9
+ import { isValidNumber } from '../util/MathUtil';
10
+ import Statistics from './statistics';
11
+ const logger = getLogger('stats:AvgRTPStatsReporter');
12
+ /**
13
+ * This will calculate an average for one, named stat and submit it to
14
+ * the analytics module when requested. It automatically counts the samples.
15
+ */
16
+ class AverageStatReport {
17
+ /**
18
+ * Creates new <tt>AverageStatReport</tt> for given name.
19
+ * @param {string} name that's the name of the event that will be reported
20
+ * to the analytics module.
21
+ */
22
+ constructor(name) {
23
+ this._name = name;
24
+ this._count = 0;
25
+ this._sum = 0;
26
+ this._samples = [];
27
+ }
28
+ /**
29
+ * Adds the next value that will be included in the average when
30
+ * {@link calculate} is called.
31
+ * @param {Optional<number>} nextValue
32
+ */
33
+ addNext(nextValue) {
34
+ if (typeof nextValue === 'undefined') {
35
+ return;
36
+ }
37
+ if (typeof nextValue !== 'number') {
38
+ logger.error(`${this._name} - invalid value for idx: ${this._count}`, nextValue);
39
+ }
40
+ else if (isValidNumber(nextValue)) {
41
+ this._sum += nextValue;
42
+ this._samples.push(nextValue);
43
+ this._count += 1;
44
+ }
45
+ }
46
+ /**
47
+ * Calculates an average for the samples collected using {@link addNext}.
48
+ * @return {number|NaN} an average of all collected samples or <tt>NaN</tt>
49
+ * if no samples were collected.
50
+ */
51
+ calculate() {
52
+ return this._count === 0 ? NaN : this._sum / this._count;
53
+ }
54
+ /**
55
+ * Appends the report to the analytics "data" object. The object will be
56
+ * set under <tt>prefix</tt> + {@link this.name} key.
57
+ * @param {Object} report the analytics "data" object
58
+ */
59
+ appendReport(report) {
60
+ report[`${this._name}_avg`] = this.calculate();
61
+ report[`${this._name}_samples`] = JSON.stringify(this._samples);
62
+ }
63
+ /**
64
+ * Clears all memory of any samples collected, so that new average can be
65
+ * calculated using this instance.
66
+ */
67
+ reset() {
68
+ this._samples = [];
69
+ this._sum = 0;
70
+ this._count = 0;
71
+ }
72
+ }
73
+ /**
74
+ * Class gathers the stats that are calculated and reported for a
75
+ * {@link TraceablePeerConnection} even if it's not currently active. For
76
+ * example we want to monitor RTT for the JVB connection while in P2P mode.
77
+ */
78
+ class ConnectionAvgStats {
79
+ /**
80
+ * Creates new <tt>ConnectionAvgStats</tt>
81
+ * @param {AvgRTPStatsReporter} avgRtpStatsReporter
82
+ * @param {boolean} isP2P
83
+ * @param {number} n the number of samples, before arithmetic mean is to be
84
+ * calculated and values submitted to the analytics module.
85
+ */
86
+ constructor(avgRtpStatsReporter, isP2P, n) {
87
+ /**
88
+ * Is this instance for JVB or P2P connection ?
89
+ * @type {boolean}
90
+ */
91
+ this.isP2P = isP2P;
92
+ /**
93
+ * How many samples are to be included in arithmetic mean calculation.
94
+ * @type {number}
95
+ * @private
96
+ */
97
+ this._n = n;
98
+ /**
99
+ * The current sample index. Starts from 0 and goes up to {@link _n})
100
+ * when analytics report will be submitted.
101
+ * @type {number}
102
+ * @private
103
+ */
104
+ this._sampleIdx = 0;
105
+ /**
106
+ * Average round trip time reported by the ICE candidate pair.
107
+ * @type {AverageStatReport}
108
+ */
109
+ this._avgRTT = new AverageStatReport('rtt');
110
+ /**
111
+ * Map stores average RTT to the JVB reported by remote participants.
112
+ * Mapped per participant id {@link JitsiParticipant.getId}.
113
+ *
114
+ * This is used only when {@link ConnectionAvgStats.isP2P} equals to
115
+ * <tt>false</tt>.
116
+ *
117
+ * @type {Map<string,AverageStatReport>}
118
+ * @private
119
+ */
120
+ this._avgRemoteRTTMap = new Map();
121
+ /**
122
+ * The conference for which stats will be collected and reported.
123
+ * @type {JitsiConference}
124
+ * @private
125
+ */
126
+ this._avgRtpStatsReporter = avgRtpStatsReporter;
127
+ /**
128
+ * The latest average E2E RTT for the JVB connection only.
129
+ *
130
+ * This is used only when {@link ConnectionAvgStats.isP2P} equals to
131
+ * <tt>false</tt>.
132
+ *
133
+ * @type {number}
134
+ */
135
+ this._avgEnd2EndRTT = undefined;
136
+ this._onConnectionStats = (tpc) => {
137
+ if (this.isP2P === tpc.isP2P) {
138
+ this._calculateAvgStats(tpc.getStats());
139
+ }
140
+ };
141
+ const conference = avgRtpStatsReporter._conference;
142
+ conference.statistics.addConnectionStatsListener(this._onConnectionStats);
143
+ if (!this.isP2P) {
144
+ this._onUserLeft = (id) => this._avgRemoteRTTMap.delete(id);
145
+ conference.on(ConferenceEvents.USER_LEFT, this._onUserLeft);
146
+ this._onRemoteStatsUpdated
147
+ = (id, data) => this._processRemoteStats(id, data);
148
+ conference.on(ConnectionQualityEvents.REMOTE_STATS_UPDATED, this._onRemoteStatsUpdated);
149
+ }
150
+ }
151
+ /**
152
+ * Processes next batch of stats.
153
+ * @param {go figure} data
154
+ * @private
155
+ */
156
+ _calculateAvgStats(data) {
157
+ if (!data) {
158
+ logger.error('No stats');
159
+ return;
160
+ }
161
+ if (browser.supportsRTTStatistics()) {
162
+ if (data.transport?.length) {
163
+ this._avgRTT.addNext(data.transport[0].rtt);
164
+ }
165
+ }
166
+ this._sampleIdx += 1;
167
+ if (this._sampleIdx >= this._n) {
168
+ if (browser.supportsRTTStatistics()) {
169
+ const conference = this._avgRtpStatsReporter._conference;
170
+ const batchReport = {
171
+ 'conference_size': conference.getParticipantCount(),
172
+ p2p: this.isP2P
173
+ };
174
+ if (data.transport?.length) {
175
+ Object.assign(batchReport, {
176
+ 'local_candidate_type': data.transport[0].localCandidateType,
177
+ 'remote_candidate_type': data.transport[0].remoteCandidateType,
178
+ 'transport_type': data.transport[0].type
179
+ });
180
+ }
181
+ this._avgRTT.appendReport(batchReport);
182
+ if (this.isP2P) {
183
+ // Report RTT diff only for P2P.
184
+ const jvbEnd2EndRTT = this
185
+ ._avgRtpStatsReporter.jvbStatsMonitor._avgEnd2EndRTT;
186
+ if (isValidNumber(jvbEnd2EndRTT)) {
187
+ batchReport.rtt_diff
188
+ = this._avgRTT.calculate() - jvbEnd2EndRTT;
189
+ }
190
+ }
191
+ else {
192
+ // Report end to end RTT only for JVB.
193
+ const avgRemoteRTT = this._calculateAvgRemoteRTT();
194
+ const avgLocalRTT = this._avgRTT.calculate();
195
+ this._avgEnd2EndRTT = avgLocalRTT + avgRemoteRTT;
196
+ if (isValidNumber(avgLocalRTT) && isValidNumber(avgRemoteRTT)) {
197
+ batchReport.end2end_rtt_avg = this._avgEnd2EndRTT;
198
+ }
199
+ }
200
+ Statistics.sendAnalytics(createRtpStatsEvent(batchReport));
201
+ }
202
+ this._resetAvgStats();
203
+ }
204
+ }
205
+ /**
206
+ * Calculates arithmetic mean of all RTTs towards the JVB reported by
207
+ * participants.
208
+ * @return {number|NaN} NaN if not available (not enough data)
209
+ * @private
210
+ */
211
+ _calculateAvgRemoteRTT() {
212
+ let count = 0, sum = 0;
213
+ // FIXME should we ignore RTT for participant
214
+ // who "is having connectivity issues" ?
215
+ for (const remoteAvg of this._avgRemoteRTTMap.values()) {
216
+ const avg = remoteAvg.calculate();
217
+ if (isValidNumber(avg)) {
218
+ sum += avg;
219
+ count += 1;
220
+ remoteAvg.reset();
221
+ }
222
+ }
223
+ return count === 0 ? NaN : sum / count;
224
+ }
225
+ /**
226
+ * Processes {@link ConnectionQualityEvents.REMOTE_STATS_UPDATED} to analyse
227
+ * RTT towards the JVB reported by each participant.
228
+ * @param {string} id {@link JitsiParticipant.getId}
229
+ * @param {go figure in ConnectionQuality.js} data
230
+ * @private
231
+ */
232
+ _processRemoteStats(id, data) {
233
+ const validData = typeof data.jvbRTT === 'number';
234
+ let rttAvg = this._avgRemoteRTTMap.get(id);
235
+ if (!rttAvg && validData) {
236
+ rttAvg = new AverageStatReport(`${id}_stat_rtt`);
237
+ this._avgRemoteRTTMap.set(id, rttAvg);
238
+ }
239
+ if (validData) {
240
+ rttAvg.addNext(data.jvbRTT);
241
+ }
242
+ else if (rttAvg) {
243
+ this._avgRemoteRTTMap.delete(id);
244
+ }
245
+ }
246
+ /**
247
+ * Reset cache of all averages and {@link _sampleIdx}.
248
+ * @internal
249
+ */
250
+ _resetAvgStats() {
251
+ this._avgRTT.reset();
252
+ if (this._avgRemoteRTTMap) {
253
+ this._avgRemoteRTTMap.clear();
254
+ }
255
+ this._sampleIdx = 0;
256
+ }
257
+ /**
258
+ *
259
+ */
260
+ dispose() {
261
+ const conference = this._avgRtpStatsReporter._conference;
262
+ conference.statistics.removeConnectionStatsListener(this._onConnectionStats);
263
+ if (!this.isP2P) {
264
+ conference.off(ConnectionQualityEvents.REMOTE_STATS_UPDATED, this._onRemoteStatsUpdated);
265
+ conference.off(ConferenceEvents.USER_LEFT, this._onUserLeft);
266
+ }
267
+ }
268
+ }
269
+ /**
270
+ * Reports average RTP statistics values (arithmetic mean) to the analytics
271
+ * module for things like bit rate, bandwidth, packet loss etc. It keeps track
272
+ * of the P2P vs JVB conference modes and submits the values under different
273
+ * namespaces (the events for P2P mode have 'p2p.' prefix). Every switch between
274
+ * P2P mode resets the data collected so far and averages are calculated from
275
+ * scratch.
276
+ */
277
+ export default class AvgRTPStatsReporter {
278
+ /**
279
+ * Creates new instance of <tt>AvgRTPStatsReporter</tt>
280
+ * @param {JitsiConference} conference
281
+ * @param {number} n the number of samples, before arithmetic mean is to be
282
+ * calculated and values submitted to the analytics module.
283
+ */
284
+ constructor(conference, n) {
285
+ /**
286
+ * How many {@link ConnectionQualityEvents.LOCAL_STATS_UPDATED} samples
287
+ * are to be included in arithmetic mean calculation.
288
+ * @type {number}
289
+ * @private
290
+ */
291
+ this._n = n;
292
+ if (n > 0) {
293
+ logger.info(`Avg RTP stats will be calculated every ${n} samples`);
294
+ }
295
+ else {
296
+ logger.info('Avg RTP stats reports are disabled.');
297
+ // Do not initialize
298
+ return;
299
+ }
300
+ /**
301
+ * The current sample index. Starts from 0 and goes up to {@link _n})
302
+ * when analytics report will be submitted.
303
+ * @type {number}
304
+ * @private
305
+ */
306
+ this._sampleIdx = 0;
307
+ /**
308
+ * The conference for which stats will be collected and reported.
309
+ * @type {JitsiConference}
310
+ * @private
311
+ */
312
+ this._conference = conference;
313
+ /**
314
+ * Average audio upload bitrate
315
+ * XXX What are the units?
316
+ * @type {AverageStatReport}
317
+ * @private
318
+ */
319
+ this._avgAudioBitrateUp
320
+ = new AverageStatReport('bitrate_audio_upload');
321
+ /**
322
+ * Average audio download bitrate
323
+ * XXX What are the units?
324
+ * @type {AverageStatReport}
325
+ * @private
326
+ */
327
+ this._avgAudioBitrateDown
328
+ = new AverageStatReport('bitrate_audio_download');
329
+ /**
330
+ * Average video upload bitrate
331
+ * XXX What are the units?
332
+ * @type {AverageStatReport}
333
+ * @private
334
+ */
335
+ this._avgVideoBitrateUp
336
+ = new AverageStatReport('bitrate_video_upload');
337
+ /**
338
+ * Average video download bitrate
339
+ * XXX What are the units?
340
+ * @type {AverageStatReport}
341
+ * @private
342
+ */
343
+ this._avgVideoBitrateDown
344
+ = new AverageStatReport('bitrate_video_download');
345
+ /**
346
+ * Average upload bandwidth
347
+ * XXX What are the units?
348
+ * @type {AverageStatReport}
349
+ * @private
350
+ */
351
+ this._avgBandwidthUp
352
+ = new AverageStatReport('bandwidth_upload');
353
+ /**
354
+ * Average download bandwidth
355
+ * XXX What are the units?
356
+ * @type {AverageStatReport}
357
+ * @private
358
+ */
359
+ this._avgBandwidthDown
360
+ = new AverageStatReport('bandwidth_download');
361
+ /**
362
+ * Average total packet loss
363
+ * XXX What are the units?
364
+ * @type {AverageStatReport}
365
+ * @private
366
+ */
367
+ this._avgPacketLossTotal
368
+ = new AverageStatReport('packet_loss_total');
369
+ /**
370
+ * Average upload packet loss
371
+ * XXX What are the units?
372
+ * @type {AverageStatReport}
373
+ * @private
374
+ */
375
+ this._avgPacketLossUp
376
+ = new AverageStatReport('packet_loss_upload');
377
+ /**
378
+ * Average download packet loss
379
+ * XXX What are the units?
380
+ * @type {AverageStatReport}
381
+ * @private
382
+ */
383
+ this._avgPacketLossDown
384
+ = new AverageStatReport('packet_loss_download');
385
+ /**
386
+ * Average FPS for remote videos
387
+ * @type {AverageStatReport}
388
+ * @private
389
+ */
390
+ this._avgRemoteFPS = new AverageStatReport('framerate_remote');
391
+ /**
392
+ * Average FPS for remote screen streaming videos (reported only if not
393
+ * a <tt>NaN</tt>).
394
+ * @type {AverageStatReport}
395
+ * @private
396
+ */
397
+ this._avgRemoteScreenFPS
398
+ = new AverageStatReport('framerate_screen_remote');
399
+ /**
400
+ * Average FPS for local video (camera)
401
+ * @type {AverageStatReport}
402
+ * @private
403
+ */
404
+ this._avgLocalFPS = new AverageStatReport('framerate_local');
405
+ /**
406
+ * Average FPS for local screen streaming video (reported only if not
407
+ * a <tt>NaN</tt>).
408
+ * @type {AverageStatReport}
409
+ * @private
410
+ */
411
+ this._avgLocalScreenFPS
412
+ = new AverageStatReport('framerate_screen_local');
413
+ /**
414
+ * Average pixels for remote screen streaming videos (reported only if
415
+ * not a <tt>NaN</tt>).
416
+ * @type {AverageStatReport}
417
+ * @private
418
+ */
419
+ this._avgRemoteCameraPixels
420
+ = new AverageStatReport('pixels_remote');
421
+ /**
422
+ * Average pixels for remote screen streaming videos (reported only if
423
+ * not a <tt>NaN</tt>).
424
+ * @type {AverageStatReport}
425
+ * @private
426
+ */
427
+ this._avgRemoteScreenPixels
428
+ = new AverageStatReport('pixels_screen_remote');
429
+ /**
430
+ * Average pixels for local video (camera)
431
+ * @type {AverageStatReport}
432
+ * @private
433
+ */
434
+ this._avgLocalCameraPixels
435
+ = new AverageStatReport('pixels_local');
436
+ /**
437
+ * Average pixels for local screen streaming video (reported only if not
438
+ * a <tt>NaN</tt>).
439
+ * @type {AverageStatReport}
440
+ * @private
441
+ */
442
+ this._avgLocalScreenPixels
443
+ = new AverageStatReport('pixels_screen_local');
444
+ /**
445
+ * Average connection quality as defined by
446
+ * the {@link ConnectionQuality} module.
447
+ * @type {AverageStatReport}
448
+ * @private
449
+ */
450
+ this._avgCQ = new AverageStatReport('connection_quality');
451
+ this._cachedTransportStats = undefined;
452
+ this._onLocalStatsUpdated = (data) => {
453
+ this._calculateAvgStats(data);
454
+ this._maybeSendTransportAnalyticsEvent(data);
455
+ };
456
+ conference.on(ConnectionQualityEvents.LOCAL_STATS_UPDATED, this._onLocalStatsUpdated);
457
+ this._onP2PStatusChanged = () => {
458
+ logger.debug('Resetting average stats calculation');
459
+ this._resetAvgStats();
460
+ this.jvbStatsMonitor._resetAvgStats();
461
+ this.p2pStatsMonitor._resetAvgStats();
462
+ };
463
+ conference.on(ConferenceEvents.P2P_STATUS, this._onP2PStatusChanged);
464
+ this._onJvb121StatusChanged = activeSession => {
465
+ if (activeSession === conference.jvbJingleSession) {
466
+ logger.info('Resetting JVB avg RTP stats');
467
+ this._resetAvgJvbStats();
468
+ }
469
+ };
470
+ conference.on(ConferenceEvents._MEDIA_SESSION_ACTIVE_CHANGED, this._onJvb121StatusChanged);
471
+ this.jvbStatsMonitor
472
+ = new ConnectionAvgStats(this, false /* JVB */, n);
473
+ this.p2pStatsMonitor
474
+ = new ConnectionAvgStats(this, true /* P2P */, n);
475
+ }
476
+ /**
477
+ * Processes next batch of stats reported on
478
+ * {@link ConnectionQualityEvents.LOCAL_STATS_UPDATED}.
479
+ * @param {*} data
480
+ * @private
481
+ */
482
+ _calculateAvgStats(data) {
483
+ if (!data) {
484
+ logger.error('No stats');
485
+ return;
486
+ }
487
+ const isP2P = this._conference.isP2PActive();
488
+ const confSize = this._conference.getParticipantCount();
489
+ if (!isP2P && confSize < 2) {
490
+ // There's no point in collecting stats for a JVB conference of 1.
491
+ // That happens for short period of time after everyone leaves
492
+ // the room, until Jicofo terminates the session.
493
+ return;
494
+ }
495
+ /* Uncomment to figure out stats structure
496
+ for (const key in data) {
497
+ if (data.hasOwnProperty(key)) {
498
+ logger.info(`local stat ${key}: `, data[key]);
499
+ }
500
+ } */
501
+ const bitrate = data.bitrate;
502
+ const bandwidth = data.bandwidth;
503
+ const packetLoss = data.packetLoss;
504
+ const frameRate = data.framerate;
505
+ const resolution = data.resolution;
506
+ if (!bitrate) {
507
+ logger.error('No "bitrate"');
508
+ return;
509
+ }
510
+ else if (!bandwidth) {
511
+ logger.error('No "bandwidth"');
512
+ return;
513
+ }
514
+ else if (!packetLoss) {
515
+ logger.error('No "packetloss"');
516
+ return;
517
+ }
518
+ else if (!frameRate) {
519
+ logger.error('No "framerate"');
520
+ return;
521
+ }
522
+ else if (!resolution) {
523
+ logger.error('No resolution');
524
+ return;
525
+ }
526
+ this._avgAudioBitrateUp.addNext(bitrate.audio.upload);
527
+ this._avgAudioBitrateDown.addNext(bitrate.audio.download);
528
+ this._avgVideoBitrateUp.addNext(bitrate.video.upload);
529
+ this._avgVideoBitrateDown.addNext(bitrate.video.download);
530
+ if (browser.supportsBandwidthStatistics()) {
531
+ this._avgBandwidthUp.addNext(bandwidth.upload);
532
+ this._avgBandwidthDown.addNext(bandwidth.download);
533
+ }
534
+ this._avgPacketLossUp.addNext(packetLoss.upload);
535
+ this._avgPacketLossDown.addNext(packetLoss.download);
536
+ this._avgPacketLossTotal.addNext(packetLoss.total);
537
+ this._avgCQ.addNext(data.connectionQuality);
538
+ if (frameRate) {
539
+ this._avgRemoteFPS.addNext(this._calculateAvgVideoFps(frameRate, false /* remote */, VideoType.CAMERA));
540
+ this._avgRemoteScreenFPS.addNext(this._calculateAvgVideoFps(frameRate, false /* remote */, VideoType.DESKTOP));
541
+ this._avgLocalFPS.addNext(this._calculateAvgVideoFps(frameRate, true /* local */, VideoType.CAMERA));
542
+ this._avgLocalScreenFPS.addNext(this._calculateAvgVideoFps(frameRate, true /* local */, VideoType.DESKTOP));
543
+ }
544
+ if (resolution) {
545
+ this._avgRemoteCameraPixels.addNext(this._calculateAvgVideoPixels(resolution, false /* remote */, VideoType.CAMERA));
546
+ this._avgRemoteScreenPixels.addNext(this._calculateAvgVideoPixels(resolution, false /* remote */, VideoType.DESKTOP));
547
+ this._avgLocalCameraPixels.addNext(this._calculateAvgVideoPixels(resolution, true /* local */, VideoType.CAMERA));
548
+ this._avgLocalScreenPixels.addNext(this._calculateAvgVideoPixels(resolution, true /* local */, VideoType.DESKTOP));
549
+ }
550
+ this._sampleIdx += 1;
551
+ if (this._sampleIdx >= this._n) {
552
+ const batchReport = {
553
+ 'conference_size': confSize,
554
+ p2p: isP2P
555
+ };
556
+ if (data.transport?.length) {
557
+ Object.assign(batchReport, {
558
+ 'local_candidate_type': data.transport[0].localCandidateType,
559
+ 'remote_candidate_type': data.transport[0].remoteCandidateType,
560
+ 'transport_type': data.transport[0].type
561
+ });
562
+ }
563
+ this._avgAudioBitrateUp.appendReport(batchReport);
564
+ this._avgAudioBitrateDown.appendReport(batchReport);
565
+ this._avgVideoBitrateUp.appendReport(batchReport);
566
+ this._avgVideoBitrateDown.appendReport(batchReport);
567
+ if (browser.supportsBandwidthStatistics()) {
568
+ this._avgBandwidthUp.appendReport(batchReport);
569
+ this._avgBandwidthDown.appendReport(batchReport);
570
+ }
571
+ this._avgPacketLossUp.appendReport(batchReport);
572
+ this._avgPacketLossDown.appendReport(batchReport);
573
+ this._avgPacketLossTotal.appendReport(batchReport);
574
+ this._avgRemoteFPS.appendReport(batchReport);
575
+ if (isValidNumber(this._avgRemoteScreenFPS.calculate())) {
576
+ this._avgRemoteScreenFPS.appendReport(batchReport);
577
+ }
578
+ this._avgLocalFPS.appendReport(batchReport);
579
+ if (isValidNumber(this._avgLocalScreenFPS.calculate())) {
580
+ this._avgLocalScreenFPS.appendReport(batchReport);
581
+ }
582
+ this._avgRemoteCameraPixels.appendReport(batchReport);
583
+ if (isValidNumber(this._avgRemoteScreenPixels.calculate())) {
584
+ this._avgRemoteScreenPixels.appendReport(batchReport);
585
+ }
586
+ this._avgLocalCameraPixels.appendReport(batchReport);
587
+ if (isValidNumber(this._avgLocalScreenPixels.calculate())) {
588
+ this._avgLocalScreenPixels.appendReport(batchReport);
589
+ }
590
+ this._avgCQ.appendReport(batchReport);
591
+ Statistics.sendAnalytics(createRtpStatsEvent(batchReport));
592
+ this._resetAvgStats();
593
+ }
594
+ }
595
+ /**
596
+ * Calculates average number of pixels for the report
597
+ *
598
+ * @param {map} peerResolutions a map of peer resolutions
599
+ * @param {boolean} isLocal if the average is to be calculated for the local
600
+ * video or <tt>false</tt> if for remote videos.
601
+ * @param {VideoType} videoType
602
+ * @return {number|NaN} average number of pixels or <tt>NaN</tt> if there
603
+ * are no samples.
604
+ * @private
605
+ */
606
+ _calculateAvgVideoPixels(peerResolutions, isLocal, videoType) {
607
+ let peerPixelsSum = 0;
608
+ let peerCount = 0;
609
+ const myID = this._conference.myUserId();
610
+ for (const peerID of Object.keys(peerResolutions)) {
611
+ if (isLocal ? peerID === myID : peerID !== myID) {
612
+ const participant = isLocal
613
+ ? null
614
+ : this._conference.getParticipantById(peerID);
615
+ const videosResolution = peerResolutions[peerID];
616
+ // Do not continue without participant for non local peerID
617
+ if ((isLocal || participant) && videosResolution) {
618
+ const peerAvgPixels = this._calculatePeerAvgVideoPixels(videosResolution, participant, videoType);
619
+ if (isValidNumber(peerAvgPixels)) {
620
+ peerPixelsSum += peerAvgPixels;
621
+ peerCount += 1;
622
+ }
623
+ }
624
+ }
625
+ }
626
+ return peerCount === 0 ? NaN : peerPixelsSum / peerCount;
627
+ }
628
+ /**
629
+ * Calculate average pixels for either remote or local participant
630
+ * @param {object} videos maps resolution per video SSRC
631
+ * @param {JitsiParticipant|null} participant remote participant or
632
+ * <tt>null</tt> for local video pixels calculation.
633
+ * @param {VideoType} videoType the type of the video for which an average
634
+ * will be calculated.
635
+ * @return {number|NaN} average video pixels of all participant's videos or
636
+ * <tt>NaN</tt> if currently not available
637
+ * @private
638
+ */
639
+ _calculatePeerAvgVideoPixels(videos, participant, videoType) {
640
+ let ssrcs = Object.keys(videos).map(ssrc => Number(ssrc));
641
+ let videoTracks = null;
642
+ // NOTE that this method is supposed to be called for the stats
643
+ // received from the current peerconnection.
644
+ const tpc = this._conference.getActivePeerConnection();
645
+ if (participant) {
646
+ videoTracks = participant.getTracksByMediaType(MediaType.VIDEO);
647
+ if (videoTracks) {
648
+ ssrcs
649
+ = ssrcs.filter(ssrc => videoTracks.find(track => !track.isMuted()
650
+ && track.getSsrc() === ssrc
651
+ && track.videoType === videoType));
652
+ }
653
+ }
654
+ else {
655
+ videoTracks = this._conference.getLocalTracks(MediaType.VIDEO);
656
+ ssrcs
657
+ = ssrcs.filter(ssrc => videoTracks.find(track => !track.isMuted()
658
+ && tpc.getLocalSSRC(track) === ssrc
659
+ && track.videoType === videoType));
660
+ }
661
+ let peerPixelsSum = 0;
662
+ let peerSsrcCount = 0;
663
+ for (const ssrc of ssrcs) {
664
+ const peerSsrcPixels = Number(videos[ssrc].height) * Number(videos[ssrc].width);
665
+ // FPS is reported as 0 for users with no video
666
+ if (isValidNumber(peerSsrcPixels) && peerSsrcPixels > 0) {
667
+ peerPixelsSum += peerSsrcPixels;
668
+ peerSsrcCount += 1;
669
+ }
670
+ }
671
+ return peerSsrcCount === 0 ? NaN : peerPixelsSum / peerSsrcCount;
672
+ }
673
+ /**
674
+ * Calculates average FPS for the report
675
+ * @param {go figure} frameRate
676
+ * @param {boolean} isLocal if the average is to be calculated for the local
677
+ * video or <tt>false</tt> if for remote videos.
678
+ * @param {VideoType} videoType
679
+ * @return {number|NaN} average FPS or <tt>NaN</tt> if there are no samples.
680
+ * @private
681
+ */
682
+ _calculateAvgVideoFps(frameRate, isLocal, videoType) {
683
+ let peerFpsSum = 0;
684
+ let peerCount = 0;
685
+ const myID = this._conference.myUserId();
686
+ for (const peerID of Object.keys(frameRate)) {
687
+ if (isLocal ? peerID === myID : peerID !== myID) {
688
+ const participant = isLocal
689
+ ? null : this._conference.getParticipantById(peerID);
690
+ const videosFps = frameRate[peerID];
691
+ // Do not continue without participant for non local peerID
692
+ if ((isLocal || participant) && videosFps) {
693
+ const peerAvgFPS = this._calculatePeerAvgVideoFps(videosFps, participant, videoType);
694
+ if (isValidNumber(peerAvgFPS)) {
695
+ peerFpsSum += peerAvgFPS;
696
+ peerCount += 1;
697
+ }
698
+ }
699
+ }
700
+ }
701
+ return peerCount === 0 ? NaN : peerFpsSum / peerCount;
702
+ }
703
+ /**
704
+ * Calculate average FPS for either remote or local participant
705
+ * @param {object} videos maps FPS per video SSRC
706
+ * @param {JitsiParticipant|null} participant remote participant or
707
+ * <tt>null</tt> for local FPS calculation.
708
+ * @param {VideoType} videoType the type of the video for which an average
709
+ * will be calculated.
710
+ * @return {number|NaN} average FPS of all participant's videos or
711
+ * <tt>NaN</tt> if currently not available
712
+ * @private
713
+ */
714
+ _calculatePeerAvgVideoFps(videos, participant, videoType) {
715
+ let ssrcs = Object.keys(videos).map(ssrc => Number(ssrc));
716
+ let videoTracks = null;
717
+ // NOTE that this method is supposed to be called for the stats
718
+ // received from the current peerconnection.
719
+ const tpc = this._conference.getActivePeerConnection();
720
+ if (participant) {
721
+ videoTracks = participant.getTracksByMediaType(MediaType.VIDEO);
722
+ if (videoTracks) {
723
+ ssrcs
724
+ = ssrcs.filter(ssrc => videoTracks.find(track => !track.isMuted()
725
+ && track.getSsrc() === ssrc
726
+ && track.videoType === videoType));
727
+ }
728
+ }
729
+ else {
730
+ videoTracks = this._conference.getLocalTracks(MediaType.VIDEO);
731
+ ssrcs
732
+ = ssrcs.filter(ssrc => videoTracks.find(track => !track.isMuted()
733
+ && tpc.getLocalSSRC(track) === ssrc
734
+ && track.videoType === videoType));
735
+ }
736
+ let peerFpsSum = 0;
737
+ let peerSsrcCount = 0;
738
+ for (const ssrc of ssrcs) {
739
+ const peerSsrcFps = Number(videos[ssrc]);
740
+ // FPS is reported as 0 for users with no video
741
+ if (isValidNumber(peerSsrcFps) && peerSsrcFps > 0) {
742
+ peerFpsSum += peerSsrcFps;
743
+ peerSsrcCount += 1;
744
+ }
745
+ }
746
+ return peerSsrcCount === 0 ? NaN : peerFpsSum / peerSsrcCount;
747
+ }
748
+ /**
749
+ * Sends the 'transport.stats' analytics event whenever we detect that
750
+ * there is a change in the local or remote candidate type on the transport
751
+ * that is currently selected.
752
+ * @param {*} data
753
+ * @private
754
+ */
755
+ _maybeSendTransportAnalyticsEvent(data) {
756
+ if (!data?.transport?.length) {
757
+ return;
758
+ }
759
+ const transportStats = {
760
+ 'local_candidate_type': data.transport[0].localCandidateType,
761
+ 'p2p': data.transport[0].p2p,
762
+ 'remote_candidate_type': data.transport[0].remoteCandidateType,
763
+ 'transport_type': data.transport[0].type
764
+ };
765
+ if (!this._cachedTransportStats || !isEqual(transportStats, this._cachedTransportStats)) {
766
+ this._cachedTransportStats = transportStats;
767
+ Statistics.sendAnalytics(createTransportStatsEvent(transportStats));
768
+ }
769
+ }
770
+ /**
771
+ * Resets the stats related to JVB connection. Must not be called when in
772
+ * P2P mode, because then the {@link AverageStatReport} instances are
773
+ * tracking P2P stats. Note that this should never happen unless something
774
+ * is wrong with the P2P and JVB121 events.
775
+ * @private
776
+ */
777
+ _resetAvgJvbStats() {
778
+ this._resetAvgStats();
779
+ this.jvbStatsMonitor._resetAvgStats();
780
+ }
781
+ /**
782
+ * Reset cache of all averages and {@link _sampleIdx}.
783
+ * @private
784
+ */
785
+ _resetAvgStats() {
786
+ this._avgAudioBitrateUp.reset();
787
+ this._avgAudioBitrateDown.reset();
788
+ this._avgVideoBitrateUp.reset();
789
+ this._avgVideoBitrateDown.reset();
790
+ this._avgBandwidthUp.reset();
791
+ this._avgBandwidthDown.reset();
792
+ this._avgPacketLossUp.reset();
793
+ this._avgPacketLossDown.reset();
794
+ this._avgPacketLossTotal.reset();
795
+ this._avgRemoteFPS.reset();
796
+ this._avgRemoteScreenFPS.reset();
797
+ this._avgLocalFPS.reset();
798
+ this._avgLocalScreenFPS.reset();
799
+ this._avgRemoteCameraPixels.reset();
800
+ this._avgRemoteScreenPixels.reset();
801
+ this._avgLocalCameraPixels.reset();
802
+ this._avgLocalScreenPixels.reset();
803
+ this._avgCQ.reset();
804
+ this._sampleIdx = 0;
805
+ }
806
+ /**
807
+ * Unregisters all event listeners and stops working.
808
+ */
809
+ dispose() {
810
+ this._conference.off(ConferenceEvents.P2P_STATUS, this._onP2PStatusChanged);
811
+ this._conference.off(ConnectionQualityEvents.LOCAL_STATS_UPDATED, this._onLocalStatsUpdated);
812
+ this._conference.off(ConferenceEvents._MEDIA_SESSION_ACTIVE_CHANGED, this._onJvb121StatusChanged);
813
+ this.jvbStatsMonitor.dispose();
814
+ this.p2pStatsMonitor.dispose();
815
+ }
816
+ }
817
+ //# sourceMappingURL=AvgRTPStatsReporter.js.map