@textrp/briij-js-sdk 41.0.0 → 42.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 (375) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/LICENSE +177 -177
  3. package/README.md +47 -46
  4. package/lib/@types/AESEncryptedSecretStoragePayload.js.map +1 -1
  5. package/lib/@types/IIdentityServerProvider.js.map +1 -1
  6. package/lib/@types/PushRules.js +14 -14
  7. package/lib/@types/PushRules.js.map +1 -1
  8. package/lib/@types/another-json.d.js.map +1 -1
  9. package/lib/@types/auth.d.ts +19 -1
  10. package/lib/@types/auth.d.ts.map +1 -1
  11. package/lib/@types/auth.js +55 -54
  12. package/lib/@types/auth.js.map +1 -1
  13. package/lib/@types/beacon.js +100 -100
  14. package/lib/@types/beacon.js.map +1 -1
  15. package/lib/@types/common.js.map +1 -1
  16. package/lib/@types/crypto.js.map +1 -1
  17. package/lib/@types/event.d.ts +27 -0
  18. package/lib/@types/event.d.ts.map +1 -1
  19. package/lib/@types/event.js +105 -102
  20. package/lib/@types/event.js.map +1 -1
  21. package/lib/@types/events.js.map +1 -1
  22. package/lib/@types/extensible_events.js +53 -53
  23. package/lib/@types/extensible_events.js.map +1 -1
  24. package/lib/@types/local_notifications.js.map +1 -1
  25. package/lib/@types/location.js +41 -41
  26. package/lib/@types/location.js.map +1 -1
  27. package/lib/@types/matrix-sdk-crypto-wasm.d.js.map +1 -1
  28. package/lib/@types/media.js.map +1 -1
  29. package/lib/@types/membership.js +39 -39
  30. package/lib/@types/membership.js.map +1 -1
  31. package/lib/@types/partials.js +25 -25
  32. package/lib/@types/partials.js.map +1 -1
  33. package/lib/@types/polls.js +46 -46
  34. package/lib/@types/polls.js.map +1 -1
  35. package/lib/@types/read_receipts.js +14 -14
  36. package/lib/@types/read_receipts.js.map +1 -1
  37. package/lib/@types/registration.js.map +1 -1
  38. package/lib/@types/search.js +14 -14
  39. package/lib/@types/search.js.map +1 -1
  40. package/lib/@types/signed.js.map +1 -1
  41. package/lib/@types/spaces.js.map +1 -1
  42. package/lib/@types/state_events.js.map +1 -1
  43. package/lib/@types/synapse.js.map +1 -1
  44. package/lib/@types/sync.js +18 -18
  45. package/lib/@types/sync.js.map +1 -1
  46. package/lib/@types/threepids.js +14 -14
  47. package/lib/@types/threepids.js.map +1 -1
  48. package/lib/@types/topic.js +47 -47
  49. package/lib/@types/topic.js.map +1 -1
  50. package/lib/@types/uia.js.map +1 -1
  51. package/lib/NamespacedValue.js +20 -20
  52. package/lib/NamespacedValue.js.map +1 -1
  53. package/lib/ReEmitter.js +16 -16
  54. package/lib/ReEmitter.js.map +1 -1
  55. package/lib/base64.js +32 -32
  56. package/lib/base64.js.map +1 -1
  57. package/lib/briij.d.ts +3 -0
  58. package/lib/briij.d.ts.map +1 -1
  59. package/lib/briij.js +3 -0
  60. package/lib/briij.js.map +1 -1
  61. package/lib/client.d.ts +18 -1
  62. package/lib/client.d.ts.map +1 -1
  63. package/lib/client.js +166 -103
  64. package/lib/client.js.map +1 -1
  65. package/lib/common-crypto/key-passphrase.js +19 -19
  66. package/lib/common-crypto/key-passphrase.js.map +1 -1
  67. package/lib/content-helpers.js +57 -57
  68. package/lib/content-helpers.js.map +1 -1
  69. package/lib/content-repo.js +36 -36
  70. package/lib/content-repo.js.map +1 -1
  71. package/lib/crypto/store/base.js +69 -69
  72. package/lib/crypto/store/base.js.map +1 -1
  73. package/lib/crypto/store/indexeddb-crypto-store-backend.js +58 -58
  74. package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +1 -1
  75. package/lib/crypto/store/indexeddb-crypto-store.js +193 -193
  76. package/lib/crypto/store/indexeddb-crypto-store.js.map +1 -1
  77. package/lib/crypto/store/localStorage-crypto-store.js +72 -72
  78. package/lib/crypto/store/localStorage-crypto-store.js.map +1 -1
  79. package/lib/crypto/store/memory-crypto-store.js +74 -74
  80. package/lib/crypto/store/memory-crypto-store.js.map +1 -1
  81. package/lib/crypto-api/CryptoEventHandlerMap.js.map +1 -1
  82. package/lib/crypto-api/key-passphrase.js +22 -22
  83. package/lib/crypto-api/key-passphrase.js.map +1 -1
  84. package/lib/crypto-api/keybackup.js.map +1 -1
  85. package/lib/crypto-api/recovery-key.js +20 -20
  86. package/lib/crypto-api/recovery-key.js.map +1 -1
  87. package/lib/digest.js +21 -21
  88. package/lib/digest.js.map +1 -1
  89. package/lib/extensible_events_v1/ExtensibleEvent.js +39 -39
  90. package/lib/extensible_events_v1/ExtensibleEvent.js.map +1 -1
  91. package/lib/extensible_events_v1/InvalidEventError.js +16 -16
  92. package/lib/extensible_events_v1/InvalidEventError.js.map +1 -1
  93. package/lib/extensible_events_v1/MessageEvent.js +39 -39
  94. package/lib/extensible_events_v1/MessageEvent.js.map +1 -1
  95. package/lib/extensible_events_v1/PollEndEvent.js +29 -29
  96. package/lib/extensible_events_v1/PollEndEvent.js.map +1 -1
  97. package/lib/extensible_events_v1/PollResponseEvent.js +39 -39
  98. package/lib/extensible_events_v1/PollResponseEvent.js.map +1 -1
  99. package/lib/extensible_events_v1/PollStartEvent.js +52 -52
  100. package/lib/extensible_events_v1/PollStartEvent.js.map +1 -1
  101. package/lib/extensible_events_v1/utilities.js +22 -22
  102. package/lib/extensible_events_v1/utilities.js.map +1 -1
  103. package/lib/feature.js +16 -16
  104. package/lib/feature.js.map +1 -1
  105. package/lib/http-api/method.js +14 -14
  106. package/lib/http-api/method.js.map +1 -1
  107. package/lib/http-api/prefix.js +26 -26
  108. package/lib/http-api/prefix.js.map +1 -1
  109. package/lib/indexeddb-helpers.js +21 -21
  110. package/lib/indexeddb-helpers.js.map +1 -1
  111. package/lib/indexeddb-worker.js +18 -18
  112. package/lib/indexeddb-worker.js.map +1 -1
  113. package/lib/matrixrtc/IKeyTransport.js +17 -17
  114. package/lib/matrixrtc/IKeyTransport.js.map +1 -1
  115. package/lib/matrixrtc/IMembershipManager.js +27 -27
  116. package/lib/matrixrtc/IMembershipManager.js.map +1 -1
  117. package/lib/matrixrtc/LivekitTransport.js +19 -19
  118. package/lib/matrixrtc/LivekitTransport.js.map +1 -1
  119. package/lib/matrixrtc/index.js +14 -14
  120. package/lib/matrixrtc/index.js.map +1 -1
  121. package/lib/matrixrtc/utils.js +27 -27
  122. package/lib/matrixrtc/utils.js.map +1 -1
  123. package/lib/models/ToDeviceMessage.js.map +1 -1
  124. package/lib/models/device.js +24 -24
  125. package/lib/models/device.js.map +1 -1
  126. package/lib/models/event-status.js +17 -17
  127. package/lib/models/event-status.js.map +1 -1
  128. package/lib/models/invites-ignorer-types.js +25 -25
  129. package/lib/models/invites-ignorer-types.js.map +1 -1
  130. package/lib/models/profile-keys.js +26 -26
  131. package/lib/models/profile-keys.js.map +1 -1
  132. package/lib/models/room-summary.js +26 -26
  133. package/lib/models/room-summary.js.map +1 -1
  134. package/lib/models/search-result.js +22 -22
  135. package/lib/models/search-result.js.map +1 -1
  136. package/lib/models/typed-event-emitter.js +122 -122
  137. package/lib/models/typed-event-emitter.js.map +1 -1
  138. package/lib/oidc/authorize.js +76 -76
  139. package/lib/oidc/authorize.js.map +1 -1
  140. package/lib/oidc/error.js +17 -17
  141. package/lib/oidc/error.js.map +1 -1
  142. package/lib/oidc/index.js +17 -17
  143. package/lib/oidc/index.js.map +1 -1
  144. package/lib/oidc/register.js +41 -41
  145. package/lib/oidc/register.js.map +1 -1
  146. package/lib/oidc/tokenRefresher.js +51 -51
  147. package/lib/oidc/tokenRefresher.js.map +1 -1
  148. package/lib/oidc/validate.js +59 -59
  149. package/lib/oidc/validate.js.map +1 -1
  150. package/lib/randomstring.js +35 -35
  151. package/lib/randomstring.js.map +1 -1
  152. package/lib/realtime-callbacks.js +39 -39
  153. package/lib/realtime-callbacks.js.map +1 -1
  154. package/lib/receipt-accumulator.js +44 -44
  155. package/lib/receipt-accumulator.js.map +1 -1
  156. package/lib/rendezvous/RendezvousChannel.js.map +1 -1
  157. package/lib/rendezvous/RendezvousCode.js.map +1 -1
  158. package/lib/rendezvous/RendezvousError.js +14 -14
  159. package/lib/rendezvous/RendezvousError.js.map +1 -1
  160. package/lib/rendezvous/RendezvousFailureReason.js +14 -14
  161. package/lib/rendezvous/RendezvousFailureReason.js.map +1 -1
  162. package/lib/rendezvous/RendezvousIntent.js +14 -14
  163. package/lib/rendezvous/RendezvousIntent.js.map +1 -1
  164. package/lib/rendezvous/RendezvousTransport.js.map +1 -1
  165. package/lib/rendezvous/channels/MSC4108SecureChannel.js +63 -63
  166. package/lib/rendezvous/channels/MSC4108SecureChannel.js.map +1 -1
  167. package/lib/rendezvous/channels/index.js +14 -14
  168. package/lib/rendezvous/channels/index.js.map +1 -1
  169. package/lib/rendezvous/index.js +14 -14
  170. package/lib/rendezvous/index.js.map +1 -1
  171. package/lib/rendezvous/transports/index.js +14 -14
  172. package/lib/rendezvous/transports/index.js.map +1 -1
  173. package/lib/rust-crypto/CrossSigningIdentity.js +29 -29
  174. package/lib/rust-crypto/CrossSigningIdentity.js.map +1 -1
  175. package/lib/rust-crypto/OutgoingRequestsManager.js +37 -37
  176. package/lib/rust-crypto/OutgoingRequestsManager.js.map +1 -1
  177. package/lib/rust-crypto/device-converter.js +30 -30
  178. package/lib/rust-crypto/device-converter.js.map +1 -1
  179. package/lib/rust-crypto/secret-storage.js +30 -30
  180. package/lib/rust-crypto/secret-storage.js.map +1 -1
  181. package/lib/service-types.js +14 -14
  182. package/lib/service-types.js.map +1 -1
  183. package/lib/store/local-storage-events-emitter.js +21 -21
  184. package/lib/store/local-storage-events-emitter.js.map +1 -1
  185. package/lib/sync-accumulator.js +50 -50
  186. package/lib/sync-accumulator.js.map +1 -1
  187. package/lib/thread-utils.js +20 -20
  188. package/lib/thread-utils.js.map +1 -1
  189. package/lib/types.js +34 -34
  190. package/lib/types.js.map +1 -1
  191. package/lib/utils/decryptAESSecretStorageItem.js +22 -22
  192. package/lib/utils/decryptAESSecretStorageItem.js.map +1 -1
  193. package/lib/utils/encryptAESSecretStorageItem.js +26 -26
  194. package/lib/utils/encryptAESSecretStorageItem.js.map +1 -1
  195. package/lib/utils/internal/deriveKeys.js +21 -21
  196. package/lib/utils/internal/deriveKeys.js.map +1 -1
  197. package/lib/utils/roomVersion.js +26 -26
  198. package/lib/utils/roomVersion.js.map +1 -1
  199. package/lib/version-support.js +26 -26
  200. package/lib/version-support.js.map +1 -1
  201. package/lib/webrtc/audioContext.js +24 -24
  202. package/lib/webrtc/audioContext.js.map +1 -1
  203. package/lib/webrtc/callEventTypes.js.map +1 -1
  204. package/lib/webrtc/stats/callFeedStatsReporter.js +14 -14
  205. package/lib/webrtc/stats/callFeedStatsReporter.js.map +1 -1
  206. package/lib/webrtc/stats/callStatsReportGatherer.js +14 -14
  207. package/lib/webrtc/stats/callStatsReportGatherer.js.map +1 -1
  208. package/lib/webrtc/stats/callStatsReportSummary.js.map +1 -1
  209. package/lib/webrtc/stats/connectionStats.js +14 -14
  210. package/lib/webrtc/stats/connectionStats.js.map +1 -1
  211. package/lib/webrtc/stats/connectionStatsBuilder.js +14 -14
  212. package/lib/webrtc/stats/connectionStatsBuilder.js.map +1 -1
  213. package/lib/webrtc/stats/connectionStatsReportBuilder.js +14 -14
  214. package/lib/webrtc/stats/connectionStatsReportBuilder.js.map +1 -1
  215. package/lib/webrtc/stats/groupCallStats.js +14 -14
  216. package/lib/webrtc/stats/groupCallStats.js.map +1 -1
  217. package/lib/webrtc/stats/media/mediaSsrcHandler.js +14 -14
  218. package/lib/webrtc/stats/media/mediaSsrcHandler.js.map +1 -1
  219. package/lib/webrtc/stats/media/mediaTrackHandler.js +14 -14
  220. package/lib/webrtc/stats/media/mediaTrackHandler.js.map +1 -1
  221. package/lib/webrtc/stats/media/mediaTrackStats.js +27 -27
  222. package/lib/webrtc/stats/media/mediaTrackStats.js.map +1 -1
  223. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js +20 -20
  224. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +1 -1
  225. package/lib/webrtc/stats/statsReport.js +14 -14
  226. package/lib/webrtc/stats/statsReport.js.map +1 -1
  227. package/lib/webrtc/stats/statsReportEmitter.js +14 -14
  228. package/lib/webrtc/stats/statsReportEmitter.js.map +1 -1
  229. package/lib/webrtc/stats/trackStatsBuilder.js +4 -4
  230. package/lib/webrtc/stats/trackStatsBuilder.js.map +1 -1
  231. package/lib/webrtc/stats/transportStats.js.map +1 -1
  232. package/lib/webrtc/stats/transportStatsBuilder.js.map +1 -1
  233. package/lib/webrtc/stats/valueFormatter.js +11 -11
  234. package/lib/webrtc/stats/valueFormatter.js.map +1 -1
  235. package/lib/xrpl/identity.d.ts +28 -0
  236. package/lib/xrpl/identity.d.ts.map +1 -0
  237. package/lib/xrpl/identity.js +213 -0
  238. package/lib/xrpl/identity.js.map +1 -0
  239. package/lib/xrpl/trust.d.ts +8 -0
  240. package/lib/xrpl/trust.d.ts.map +1 -0
  241. package/lib/xrpl/trust.js +61 -0
  242. package/lib/xrpl/trust.js.map +1 -0
  243. package/lib/xrpl/verification.d.ts +26 -0
  244. package/lib/xrpl/verification.d.ts.map +1 -0
  245. package/lib/xrpl/verification.js +295 -0
  246. package/lib/xrpl/verification.js.map +1 -0
  247. package/package.json +128 -129
  248. package/src/@types/AESEncryptedSecretStoragePayload.ts +29 -29
  249. package/src/@types/IIdentityServerProvider.ts +24 -24
  250. package/src/@types/PushRules.ts +208 -208
  251. package/src/@types/another-json.d.ts +19 -19
  252. package/src/@types/auth.ts +280 -258
  253. package/src/@types/beacon.ts +140 -140
  254. package/src/@types/common.ts +24 -24
  255. package/src/@types/crypto.ts +71 -71
  256. package/src/@types/event.ts +476 -449
  257. package/src/@types/events.ts +119 -119
  258. package/src/@types/extensible_events.ts +147 -147
  259. package/src/@types/local_notifications.ts +19 -19
  260. package/src/@types/location.ts +92 -92
  261. package/src/@types/matrix-sdk-crypto-wasm.d.ts +39 -39
  262. package/src/@types/media.ts +245 -245
  263. package/src/@types/membership.ts +57 -57
  264. package/src/@types/partials.ts +103 -103
  265. package/src/@types/polls.ts +120 -120
  266. package/src/@types/read_receipts.ts +61 -61
  267. package/src/@types/registration.ts +102 -102
  268. package/src/@types/search.ts +119 -119
  269. package/src/@types/signed.ts +25 -25
  270. package/src/@types/spaces.ts +37 -37
  271. package/src/@types/state_events.ts +153 -153
  272. package/src/@types/synapse.ts +40 -40
  273. package/src/@types/sync.ts +27 -27
  274. package/src/@types/threepids.ts +29 -29
  275. package/src/@types/topic.ts +69 -69
  276. package/src/@types/uia.ts +24 -24
  277. package/src/NamespacedValue.ts +121 -121
  278. package/src/ReEmitter.ts +93 -93
  279. package/src/base64.ts +86 -86
  280. package/src/briij.ts +3 -0
  281. package/src/client.ts +90 -10
  282. package/src/common-crypto/README.md +4 -4
  283. package/src/common-crypto/key-passphrase.ts +43 -43
  284. package/src/content-helpers.ts +298 -298
  285. package/src/content-repo.ts +122 -122
  286. package/src/crypto/store/base.ts +388 -388
  287. package/src/crypto/store/indexeddb-crypto-store-backend.ts +655 -655
  288. package/src/crypto/store/indexeddb-crypto-store.ts +555 -555
  289. package/src/crypto/store/localStorage-crypto-store.ts +409 -409
  290. package/src/crypto/store/memory-crypto-store.ts +326 -326
  291. package/src/crypto-api/CryptoEventHandlerMap.ts +42 -42
  292. package/src/crypto-api/key-passphrase.ts +58 -58
  293. package/src/crypto-api/keybackup.ts +114 -114
  294. package/src/crypto-api/recovery-key.ts +69 -69
  295. package/src/digest.ts +34 -34
  296. package/src/extensible_events_v1/ExtensibleEvent.ts +58 -58
  297. package/src/extensible_events_v1/InvalidEventError.ts +24 -24
  298. package/src/extensible_events_v1/MessageEvent.ts +143 -143
  299. package/src/extensible_events_v1/PollEndEvent.ts +97 -97
  300. package/src/extensible_events_v1/PollResponseEvent.ts +148 -148
  301. package/src/extensible_events_v1/PollStartEvent.ts +207 -207
  302. package/src/extensible_events_v1/utilities.ts +35 -35
  303. package/src/feature.ts +88 -88
  304. package/src/http-api/method.ts +25 -25
  305. package/src/http-api/prefix.ts +48 -48
  306. package/src/indexeddb-helpers.ts +50 -50
  307. package/src/indexeddb-worker.ts +24 -24
  308. package/src/matrixrtc/IKeyTransport.ts +63 -63
  309. package/src/matrixrtc/IMembershipManager.ts +120 -120
  310. package/src/matrixrtc/LivekitTransport.ts +46 -46
  311. package/src/matrixrtc/index.ts +24 -24
  312. package/src/matrixrtc/utils.ts +71 -71
  313. package/src/models/ToDeviceMessage.ts +38 -38
  314. package/src/models/device.ts +85 -85
  315. package/src/models/event-status.ts +39 -39
  316. package/src/models/invites-ignorer-types.ts +58 -58
  317. package/src/models/profile-keys.ts +33 -33
  318. package/src/models/room-summary.ts +78 -78
  319. package/src/models/search-result.ts +57 -57
  320. package/src/models/typed-event-emitter.ts +246 -246
  321. package/src/oidc/authorize.ts +279 -279
  322. package/src/oidc/error.ts +33 -33
  323. package/src/oidc/index.ts +33 -33
  324. package/src/oidc/register.ts +163 -163
  325. package/src/oidc/tokenRefresher.ts +184 -184
  326. package/src/oidc/validate.ts +265 -265
  327. package/src/randomstring.ts +103 -103
  328. package/src/realtime-callbacks.ts +191 -191
  329. package/src/receipt-accumulator.ts +189 -189
  330. package/src/rendezvous/RendezvousChannel.ts +48 -48
  331. package/src/rendezvous/RendezvousCode.ts +25 -25
  332. package/src/rendezvous/RendezvousError.ts +26 -26
  333. package/src/rendezvous/RendezvousFailureReason.ts +49 -49
  334. package/src/rendezvous/RendezvousIntent.ts +20 -20
  335. package/src/rendezvous/RendezvousTransport.ts +58 -58
  336. package/src/rendezvous/channels/MSC4108SecureChannel.ts +270 -270
  337. package/src/rendezvous/channels/index.ts +17 -17
  338. package/src/rendezvous/index.ts +25 -25
  339. package/src/rendezvous/transports/index.ts +17 -17
  340. package/src/rust-crypto/CrossSigningIdentity.ts +195 -195
  341. package/src/rust-crypto/OutgoingRequestsManager.ts +170 -170
  342. package/src/rust-crypto/device-converter.ts +128 -128
  343. package/src/rust-crypto/secret-storage.ts +60 -60
  344. package/src/service-types.ts +20 -20
  345. package/src/store/local-storage-events-emitter.ts +46 -46
  346. package/src/sync-accumulator.ts +779 -779
  347. package/src/thread-utils.ts +31 -31
  348. package/src/types.ts +59 -59
  349. package/src/utils/decryptAESSecretStorageItem.ts +54 -54
  350. package/src/utils/encryptAESSecretStorageItem.ts +73 -73
  351. package/src/utils/internal/deriveKeys.ts +63 -63
  352. package/src/utils/roomVersion.ts +35 -35
  353. package/src/version-support.ts +50 -50
  354. package/src/webrtc/audioContext.ts +44 -44
  355. package/src/webrtc/callEventTypes.ts +101 -101
  356. package/src/webrtc/stats/callFeedStatsReporter.ts +91 -91
  357. package/src/webrtc/stats/callStatsReportGatherer.ts +219 -219
  358. package/src/webrtc/stats/callStatsReportSummary.ts +30 -30
  359. package/src/webrtc/stats/connectionStats.ts +47 -47
  360. package/src/webrtc/stats/connectionStatsBuilder.ts +28 -28
  361. package/src/webrtc/stats/connectionStatsReportBuilder.ts +140 -140
  362. package/src/webrtc/stats/groupCallStats.ts +93 -93
  363. package/src/webrtc/stats/media/mediaSsrcHandler.ts +57 -57
  364. package/src/webrtc/stats/media/mediaTrackHandler.ts +70 -70
  365. package/src/webrtc/stats/media/mediaTrackStats.ts +176 -176
  366. package/src/webrtc/stats/media/mediaTrackStatsHandler.ts +90 -90
  367. package/src/webrtc/stats/statsReport.ts +133 -133
  368. package/src/webrtc/stats/statsReportEmitter.ts +49 -49
  369. package/src/webrtc/stats/trackStatsBuilder.ts +207 -207
  370. package/src/webrtc/stats/transportStats.ts +26 -26
  371. package/src/webrtc/stats/transportStatsBuilder.ts +48 -48
  372. package/src/webrtc/stats/valueFormatter.ts +27 -27
  373. package/src/xrpl/identity.ts +245 -0
  374. package/src/xrpl/trust.ts +64 -0
  375. package/src/xrpl/verification.ts +284 -0
@@ -1 +1 @@
1
- {"version":3,"file":"mediaTrackStats.js","names":["MediaTrackStats","constructor","trackId","type","kind","_defineProperty","packetsTotal","packetsLost","isDownloadStream","download","upload","width","height","concealedAudio","totalAudioDuration","getType","setLoss","loss","getLoss","setResolution","resolution","getResolution","setFramerate","framerate","getFramerate","setBitrate","bitrate","getBitrate","setCodec","codecShortType","codec","getCodec","resetBitrate","alive","isAlive","muted","isMuted","enabled","isEnabled","setJitter","jitter","getJitter","setAudioConcealment","concealedAudioDuration","audioConcealment","getAudioConcealment"],"sources":["../../../../src/webrtc/stats/media/mediaTrackStats.ts"],"sourcesContent":["/*\r\nCopyright 2023 The Matrix.org Foundation C.I.C.\r\n\r\nLicensed under the Apache License, Version 2.0 (the \"License\");\r\nyou may not use this file except in compliance with the License.\r\nYou may obtain a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nUnless required by applicable law or agreed to in writing, software\r\ndistributed under the License is distributed on an \"AS IS\" BASIS,\r\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\nSee the License for the specific language governing permissions and\r\nlimitations under the License.\r\n*/\r\n\r\nimport { type AudioConcealment } from \"../statsReport.ts\";\r\nimport { type TrackId } from \"./mediaTrackHandler.ts\";\r\n\r\nexport interface PacketLoss {\r\n packetsTotal: number;\r\n packetsLost: number;\r\n isDownloadStream: boolean;\r\n}\r\n\r\nexport interface Bitrate {\r\n /**\r\n * bytes per second\r\n */\r\n download: number;\r\n /**\r\n * bytes per second\r\n */\r\n upload: number;\r\n}\r\nexport interface ConcealedAudio {\r\n /**\r\n * duration in ms\r\n */\r\n duration: number;\r\n\r\n ratio: number;\r\n}\r\nexport interface Resolution {\r\n width: number;\r\n height: number;\r\n}\r\n\r\nexport type TrackStatsType = \"local\" | \"remote\";\r\n\r\nexport class MediaTrackStats {\r\n private loss: PacketLoss = { packetsTotal: 0, packetsLost: 0, isDownloadStream: false };\r\n private bitrate: Bitrate = { download: 0, upload: 0 };\r\n private resolution: Resolution = { width: -1, height: -1 };\r\n private audioConcealment: AudioConcealment = { concealedAudio: 0, totalAudioDuration: 0 };\r\n private framerate = 0;\r\n private jitter = 0;\r\n private codec = \"\";\r\n private isAlive = true;\r\n private isMuted = false;\r\n private isEnabled = true;\r\n\r\n public constructor(\r\n public readonly trackId: TrackId,\r\n public readonly type: TrackStatsType,\r\n public readonly kind: \"audio\" | \"video\",\r\n ) {}\r\n\r\n public getType(): TrackStatsType {\r\n return this.type;\r\n }\r\n\r\n public setLoss(loss: PacketLoss): void {\r\n this.loss = loss;\r\n }\r\n\r\n public getLoss(): PacketLoss {\r\n return this.loss;\r\n }\r\n\r\n public setResolution(resolution: Resolution): void {\r\n this.resolution = resolution;\r\n }\r\n\r\n public getResolution(): Resolution {\r\n return this.resolution;\r\n }\r\n\r\n public setFramerate(framerate: number): void {\r\n this.framerate = framerate;\r\n }\r\n\r\n public getFramerate(): number {\r\n return this.framerate;\r\n }\r\n\r\n public setBitrate(bitrate: Bitrate): void {\r\n this.bitrate = bitrate;\r\n }\r\n\r\n public getBitrate(): Bitrate {\r\n return this.bitrate;\r\n }\r\n\r\n public setCodec(codecShortType: string): boolean {\r\n this.codec = codecShortType;\r\n return true;\r\n }\r\n\r\n public getCodec(): string {\r\n return this.codec;\r\n }\r\n\r\n public resetBitrate(): void {\r\n this.bitrate = { download: 0, upload: 0 };\r\n }\r\n\r\n public set alive(isAlive: boolean) {\r\n this.isAlive = isAlive;\r\n }\r\n\r\n /**\r\n * A MediaTrackState is alive if the corresponding MediaStreamTrack track bound to a transceiver and the\r\n * MediaStreamTrack is in state MediaStreamTrack.readyState === live\r\n */\r\n public get alive(): boolean {\r\n return this.isAlive;\r\n }\r\n\r\n public set muted(isMuted: boolean) {\r\n this.isMuted = isMuted;\r\n }\r\n\r\n /**\r\n * A MediaTrackState.isMuted corresponding to MediaStreamTrack.muted.\r\n * But these values only match if MediaTrackState.isAlive.\r\n */\r\n public get muted(): boolean {\r\n return this.isMuted;\r\n }\r\n\r\n public set enabled(isEnabled: boolean) {\r\n this.isEnabled = isEnabled;\r\n }\r\n\r\n /**\r\n * A MediaTrackState.isEnabled corresponding to MediaStreamTrack.enabled.\r\n * But these values only match if MediaTrackState.isAlive.\r\n */\r\n public get enabled(): boolean {\r\n return this.isEnabled;\r\n }\r\n\r\n public setJitter(jitter: number): void {\r\n this.jitter = jitter;\r\n }\r\n\r\n /**\r\n * Jitter in milliseconds\r\n */\r\n public getJitter(): number {\r\n return this.jitter;\r\n }\r\n\r\n /**\r\n * Audio concealment ration (conceled duration / total duration)\r\n */\r\n public setAudioConcealment(concealedAudioDuration: number, totalAudioDuration: number): void {\r\n this.audioConcealment.concealedAudio = concealedAudioDuration;\r\n this.audioConcealment.totalAudioDuration = totalAudioDuration;\r\n }\r\n\r\n public getAudioConcealment(): AudioConcealment {\r\n return this.audioConcealment;\r\n }\r\n}\r\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoCA,OAAO,MAAMA,eAAe,CAAC;EAYlBC,WAAWA,CACEC,OAAgB,EAChBC,IAAoB,EACpBC,IAAuB,EACzC;IAAA,KAHkBF,OAAgB,GAAhBA,OAAgB;IAAA,KAChBC,IAAoB,GAApBA,IAAoB;IAAA,KACpBC,IAAuB,GAAvBA,IAAuB;IAAAC,eAAA,eAdhB;MAAEC,YAAY,EAAE,CAAC;MAAEC,WAAW,EAAE,CAAC;MAAEC,gBAAgB,EAAE;IAAM,CAAC;IAAAH,eAAA,kBAC5D;MAAEI,QAAQ,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAE,CAAC;IAAAL,eAAA,qBACpB;MAAEM,KAAK,EAAE,CAAC,CAAC;MAAEC,MAAM,EAAE,CAAC;IAAE,CAAC;IAAAP,eAAA,2BACb;MAAEQ,cAAc,EAAE,CAAC;MAAEC,kBAAkB,EAAE;IAAE,CAAC;IAAAT,eAAA,oBACrE,CAAC;IAAAA,eAAA,iBACJ,CAAC;IAAAA,eAAA,gBACF,EAAE;IAAAA,eAAA,kBACA,IAAI;IAAAA,eAAA,kBACJ,KAAK;IAAAA,eAAA,oBACH,IAAI;EAMrB;EAEIU,OAAOA,CAAA,EAAmB;IAC7B,OAAO,IAAI,CAACZ,IAAI;EACpB;EAEOa,OAAOA,CAACC,I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I,CAACA,SAAS,GAAGA,SAAS;EAC9B;;EAEA;AACJ;AACA;AACA;EACI,IAAWD,OAAOA,CAAA,EAAY;IAC1B,OAAO,IAAI,CAACC,SAAS;EACzB;EAEOC,SAASA,CAACC,MAAc,EAAQ;IACnC,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;;EAEA;AACJ;AACA;EACWC,SAASA,CAAA,EAAW;IACvB,OAAO,IAAI,CAACD,MAAM;EACtB;;EAEA;AACJ;AACA;EACWE,mBAAmBA,CAACC,sBAA8B,EAAE7B,kBAA0B,EAAQ;IACzF,IAAI,CAAC8B,gBAAgB,CAAC/B,cAAc,GAAG8B,sBAAsB;IAC7D,IAAI,CAACC,gBAAgB,CAAC9B,kBAAkB,GAAGA,kBAAkB;EACjE;EAEO+B,mBAAmBA,CAAA,EAAqB;IAC3C,OAAO,IAAI,CAACD,gBAAgB;EAChC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"mediaTrackStats.js","names":["MediaTrackStats","constructor","trackId","type","kind","_defineProperty","packetsTotal","packetsLost","isDownloadStream","download","upload","width","height","concealedAudio","totalAudioDuration","getType","setLoss","loss","getLoss","setResolution","resolution","getResolution","setFramerate","framerate","getFramerate","setBitrate","bitrate","getBitrate","setCodec","codecShortType","codec","getCodec","resetBitrate","alive","isAlive","muted","isMuted","enabled","isEnabled","setJitter","jitter","getJitter","setAudioConcealment","concealedAudioDuration","audioConcealment","getAudioConcealment"],"sources":["../../../../src/webrtc/stats/media/mediaTrackStats.ts"],"sourcesContent":["/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type AudioConcealment } from \"../statsReport.ts\";\nimport { type TrackId } from \"./mediaTrackHandler.ts\";\n\nexport interface PacketLoss {\n packetsTotal: number;\n packetsLost: number;\n isDownloadStream: boolean;\n}\n\nexport interface Bitrate {\n /**\n * bytes per second\n */\n download: number;\n /**\n * bytes per second\n */\n upload: number;\n}\nexport interface ConcealedAudio {\n /**\n * duration in ms\n */\n duration: number;\n\n ratio: number;\n}\nexport interface Resolution {\n width: number;\n height: number;\n}\n\nexport type TrackStatsType = \"local\" | \"remote\";\n\nexport class MediaTrackStats {\n private loss: PacketLoss = { packetsTotal: 0, packetsLost: 0, isDownloadStream: false };\n private bitrate: Bitrate = { download: 0, upload: 0 };\n private resolution: Resolution = { width: -1, height: -1 };\n private audioConcealment: AudioConcealment = { concealedAudio: 0, totalAudioDuration: 0 };\n private framerate = 0;\n private jitter = 0;\n private codec = \"\";\n private isAlive = true;\n private isMuted = false;\n private isEnabled = true;\n\n public constructor(\n public readonly trackId: TrackId,\n public readonly type: TrackStatsType,\n public readonly kind: \"audio\" | \"video\",\n ) {}\n\n public getType(): TrackStatsType {\n return this.type;\n }\n\n public setLoss(loss: PacketLoss): void {\n this.loss = loss;\n }\n\n public getLoss(): PacketLoss {\n return this.loss;\n }\n\n public setResolution(resolution: Resolution): void {\n this.resolution = resolution;\n }\n\n public getResolution(): Resolution {\n return this.resolution;\n }\n\n public setFramerate(framerate: number): void {\n this.framerate = framerate;\n }\n\n public getFramerate(): number {\n return this.framerate;\n }\n\n public setBitrate(bitrate: Bitrate): void {\n this.bitrate = bitrate;\n }\n\n public getBitrate(): Bitrate {\n return this.bitrate;\n }\n\n public setCodec(codecShortType: string): boolean {\n this.codec = codecShortType;\n return true;\n }\n\n public getCodec(): string {\n return this.codec;\n }\n\n public resetBitrate(): void {\n this.bitrate = { download: 0, upload: 0 };\n }\n\n public set alive(isAlive: boolean) {\n this.isAlive = isAlive;\n }\n\n /**\n * A MediaTrackState is alive if the corresponding MediaStreamTrack track bound to a transceiver and the\n * MediaStreamTrack is in state MediaStreamTrack.readyState === live\n */\n public get alive(): boolean {\n return this.isAlive;\n }\n\n public set muted(isMuted: boolean) {\n this.isMuted = isMuted;\n }\n\n /**\n * A MediaTrackState.isMuted corresponding to MediaStreamTrack.muted.\n * But these values only match if MediaTrackState.isAlive.\n */\n public get muted(): boolean {\n return this.isMuted;\n }\n\n public set enabled(isEnabled: boolean) {\n this.isEnabled = isEnabled;\n }\n\n /**\n * A MediaTrackState.isEnabled corresponding to MediaStreamTrack.enabled.\n * But these values only match if MediaTrackState.isAlive.\n */\n public get enabled(): boolean {\n return this.isEnabled;\n }\n\n public setJitter(jitter: number): void {\n this.jitter = jitter;\n }\n\n /**\n * Jitter in milliseconds\n */\n public getJitter(): number {\n return this.jitter;\n }\n\n /**\n * Audio concealment ration (conceled duration / total duration)\n */\n public setAudioConcealment(concealedAudioDuration: number, totalAudioDuration: number): void {\n this.audioConcealment.concealedAudio = concealedAudioDuration;\n this.audioConcealment.totalAudioDuration = totalAudioDuration;\n }\n\n public getAudioConcealment(): AudioConcealment {\n return this.audioConcealment;\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoCA,OAAO,MAAMA,eAAe,CAAC;EAYlBC,WAAWA,CACEC,OAAgB,EAChBC,IAAoB,EACpBC,IAAuB,EACzC;IAAA,KAHkBF,OAAgB,GAAhBA,OAAgB;IAAA,KAChBC,IAAoB,GAApBA,IAAoB;IAAA,KACpBC,IAAuB,GAAvBA,IAAuB;IAAAC,eAAA,eAdhB;MAAEC,YAAY,EAAE,CAAC;MAAEC,WAAW,EAAE,CAAC;MAAEC,gBAAgB,EAAE;IAAM,CAAC;IAAAH,eAAA,kBAC5D;MAAEI,QAAQ,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAE,CAAC;IAAAL,eAAA,qBACpB;MAAEM,KAAK,EAAE,CAAC,CAAC;MAAEC,MAAM,EAAE,CA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ACA,OAAO,GAAGA,OAAO;EAC1B;;EAEA;AACJ;AACA;AACA;EACI,IAAWD,KAAKA,CAAA,EAAY;IACxB,OAAO,IAAI,CAACC,OAAO;EACvB;EAEA,IAAWC,KAAKA,CAACC,OAAgB,EAAE;IAC/B,IAAI,CAACA,OAAO,GAAGA,OAAO;EAC1B;;EAEA;AACJ;AACA;AACA;EACI,IAAWD,KAAKA,CAAA,EAAY;IACxB,OAAO,IAAI,CAACC,OAAO;EACvB;EAEA,IAAWC,OAAOA,CAACC,SAAkB,EAAE;IACnC,IAAI,CAACA,SAAS,GAAGA,SAAS;EAC9B;;EAEA;AACJ;AACA;AACA;EACI,IAAWD,OAAOA,CAAA,EAAY;IAC1B,OAAO,IAAI,CAACC,SAAS;EACzB;EAEOC,SAASA,CAACC,MAAc,EAAQ;IACnC,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;;EAEA;AACJ;AACA;EACWC,SAASA,CAAA,EAAW;IACvB,OAAO,IAAI,CAACD,MAAM;EACtB;;EAEA;AACJ;AACA;EACWE,mBAAmBA,CAACC,sBAA8B,EAAE7B,kBAA0B,EAAQ;IACzF,IAAI,CAAC8B,gBAAgB,CAAC/B,cAAc,GAAG8B,sBAAsB;IAC7D,IAAI,CAACC,gBAAgB,CAAC9B,kBAAkB,GAAGA,kBAAkB;EACjE;EAEO+B,mBAAmBA,CAAA,EAAqB;IAC3C,OAAO,IAAI,CAACD,gBAAgB;EAChC;AACJ","ignoreList":[]}
@@ -1,18 +1,18 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- /*
3
- Copyright 2023 The Matrix.org Foundation C.I.C.
4
-
5
- Licensed under the Apache License, Version 2.0 (the "License");
6
- you may not use this file except in compliance with the License.
7
- You may obtain a copy of the License at
8
-
9
- http://www.apache.org/licenses/LICENSE-2.0
10
-
11
- Unless required by applicable law or agreed to in writing, software
12
- distributed under the License is distributed on an "AS IS" BASIS,
13
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- See the License for the specific language governing permissions and
15
- limitations under the License.
2
+ /*
3
+ Copyright 2023 The Matrix.org Foundation C.I.C.
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
16
  */
17
17
 
18
18
  import { MediaTrackStats } from "./mediaTrackStats.js";
@@ -23,12 +23,12 @@ export class MediaTrackStatsHandler {
23
23
  _defineProperty(this, "track2stats", new Map());
24
24
  }
25
25
 
26
- /**
27
- * Find tracks by rtc stats
28
- * Argument report is any because the stats api is not consistent:
29
- * For example `trackIdentifier`, `mid` not existing in every implementations
30
- * https://www.w3.org/TR/webrtc-stats/#dom-rtcinboundrtpstreamstats
31
- * https://developer.mozilla.org/en-US/docs/Web/API/RTCInboundRtpStreamStats
26
+ /**
27
+ * Find tracks by rtc stats
28
+ * Argument report is any because the stats api is not consistent:
29
+ * For example `trackIdentifier`, `mid` not existing in every implementations
30
+ * https://www.w3.org/TR/webrtc-stats/#dom-rtcinboundrtpstreamstats
31
+ * https://developer.mozilla.org/en-US/docs/Web/API/RTCInboundRtpStreamStats
32
32
  */
33
33
  findTrack2Stats(report, type) {
34
34
  var trackID;
@@ -1 +1 @@
1
- {"version":3,"file":"mediaTrackStatsHandler.js","names":["MediaTrackStats","MediaTrackStatsHandler","constructor","mediaSsrcHandler","mediaTrackHandler","_defineProperty","Map","findTrack2Stats","report","type","trackID","trackIdentifier","mid","getRemoteTrackIdByMid","getLocalTrackIdByMid","ssrc","findMidBySsrc","undefined","trackStats","track2stats","get","track","getTackById","kind","set","findLocalVideoTrackStats","localVideoTracks","getLocalTracks","length","getTrack2stats","findTransceiverByTrackId","getTransceiverByTrackId"],"sources":["../../../../src/webrtc/stats/media/mediaTrackStatsHandler.ts"],"sourcesContent":["/*\r\nCopyright 2023 The Matrix.org Foundation C.I.C.\r\n\r\nLicensed under the Apache License, Version 2.0 (the \"License\");\r\nyou may not use this file except in compliance with the License.\r\nYou may obtain a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nUnless required by applicable law or agreed to in writing, software\r\ndistributed under the License is distributed on an \"AS IS\" BASIS,\r\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\nSee the License for the specific language governing permissions and\r\nlimitations under the License.\r\n*/\r\nimport { type TrackID } from \"../statsReport.ts\";\r\nimport { MediaTrackStats } from \"./mediaTrackStats.ts\";\r\nimport { type MediaTrackHandler, type TrackId } from \"./mediaTrackHandler.ts\";\r\nimport { type MediaSsrcHandler } from \"./mediaSsrcHandler.ts\";\r\n\r\nexport class MediaTrackStatsHandler {\r\n private readonly track2stats = new Map<TrackID, MediaTrackStats>();\r\n\r\n public constructor(\r\n public readonly mediaSsrcHandler: MediaSsrcHandler,\r\n public readonly mediaTrackHandler: MediaTrackHandler,\r\n ) {}\r\n\r\n /**\r\n * Find tracks by rtc stats\r\n * Argument report is any because the stats api is not consistent:\r\n * For example `trackIdentifier`, `mid` not existing in every implementations\r\n * https://www.w3.org/TR/webrtc-stats/#dom-rtcinboundrtpstreamstats\r\n * https://developer.mozilla.org/en-US/docs/Web/API/RTCInboundRtpStreamStats\r\n */\r\n public findTrack2Stats(report: any, type: \"remote\" | \"local\"): MediaTrackStats | undefined {\r\n let trackID;\r\n if (report.trackIdentifier) {\r\n trackID = report.trackIdentifier;\r\n } else if (report.mid) {\r\n trackID =\r\n type === \"remote\"\r\n ? this.mediaTrackHandler.getRemoteTrackIdByMid(report.mid)\r\n : this.mediaTrackHandler.getLocalTrackIdByMid(report.mid);\r\n } else if (report.ssrc) {\r\n const mid = this.mediaSsrcHandler.findMidBySsrc(report.ssrc, type);\r\n if (!mid) {\r\n return undefined;\r\n }\r\n trackID =\r\n type === \"remote\"\r\n ? this.mediaTrackHandler.getRemoteTrackIdByMid(report.mid)\r\n : this.mediaTrackHandler.getLocalTrackIdByMid(report.mid);\r\n }\r\n\r\n if (!trackID) {\r\n return undefined;\r\n }\r\n\r\n let trackStats = this.track2stats.get(trackID);\r\n\r\n if (!trackStats) {\r\n const track = this.mediaTrackHandler.getTackById(trackID);\r\n if (track !== undefined) {\r\n const kind: \"audio\" | \"video\" = track.kind === \"audio\" ? track.kind : \"video\";\r\n trackStats = new MediaTrackStats(trackID, type, kind);\r\n this.track2stats.set(trackID, trackStats);\r\n } else {\r\n return undefined;\r\n }\r\n }\r\n return trackStats;\r\n }\r\n\r\n public findLocalVideoTrackStats(report: any): MediaTrackStats | undefined {\r\n const localVideoTracks = this.mediaTrackHandler.getLocalTracks(\"video\");\r\n if (localVideoTracks.length === 0) {\r\n return undefined;\r\n }\r\n return this.findTrack2Stats(report, \"local\");\r\n }\r\n\r\n public getTrack2stats(): Map<TrackID, MediaTrackStats> {\r\n return this.track2stats;\r\n }\r\n\r\n public findTransceiverByTrackId(trackID: TrackId): undefined | RTCRtpTransceiver {\r\n return this.mediaTrackHandler.getTransceiverByTrackId(trackID);\r\n }\r\n}\r\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,eAAe,QAAQ,sBAAsB;AAItD,OAAO,MAAMC,sBAAsB,CAAC;EAGzBC,WAAWA,CACEC,gBAAkC,EAClCC,iBAAoC,EACtD;IAAA,KAFkBD,gBAAkC,GAAlCA,gBAAkC;IAAA,KAClCC,iBAAoC,GAApCA,iBAAoC;IAAAC,eAAA,sBAJzB,IAAIC,GAAG,CAA2B,CAAC;EAK/D;;EAEH;AACJ;AACA;AACA;AACA;AACA;AACA;EACWC,eAAeA,CAACC,MAAW,EAAEC,IAAwB,EAA+B;IACvF,IAAIC,OAAO;I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QACH,OAAOD,SAAS;MACpB;IACJ;IACA,OAAOC,UAAU;EACrB;EAEOO,wBAAwBA,CAACjB,MAAW,EAA+B;IACtE,IAAMkB,gBAAgB,GAAG,IAAI,CAACtB,iBAAiB,CAACuB,cAAc,CAAC,OAAO,CAAC;IACvE,IAAID,gBAAgB,CAACE,MAAM,KAAK,CAAC,EAAE;MAC/B,OAAOX,SAAS;IACpB;IACA,OAAO,IAAI,CAACV,eAAe,CAACC,MAAM,EAAE,OAAO,CAAC;EAChD;EAEOqB,cAAcA,CAAA,EAAkC;IACnD,OAAO,IAAI,CAACV,WAAW;EAC3B;EAEOW,wBAAwBA,CAACpB,OAAgB,EAAiC;IAC7E,OAAO,IAAI,CAACN,iBAAiB,CAAC2B,uBAAuB,CAACrB,OAAO,CAAC;EAClE;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"mediaTrackStatsHandler.js","names":["MediaTrackStats","MediaTrackStatsHandler","constructor","mediaSsrcHandler","mediaTrackHandler","_defineProperty","Map","findTrack2Stats","report","type","trackID","trackIdentifier","mid","getRemoteTrackIdByMid","getLocalTrackIdByMid","ssrc","findMidBySsrc","undefined","trackStats","track2stats","get","track","getTackById","kind","set","findLocalVideoTrackStats","localVideoTracks","getLocalTracks","length","getTrack2stats","findTransceiverByTrackId","getTransceiverByTrackId"],"sources":["../../../../src/webrtc/stats/media/mediaTrackStatsHandler.ts"],"sourcesContent":["/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\nimport { type TrackID } from \"../statsReport.ts\";\nimport { MediaTrackStats } from \"./mediaTrackStats.ts\";\nimport { type MediaTrackHandler, type TrackId } from \"./mediaTrackHandler.ts\";\nimport { type MediaSsrcHandler } from \"./mediaSsrcHandler.ts\";\n\nexport class MediaTrackStatsHandler {\n private readonly track2stats = new Map<TrackID, MediaTrackStats>();\n\n public constructor(\n public readonly mediaSsrcHandler: MediaSsrcHandler,\n public readonly mediaTrackHandler: MediaTrackHandler,\n ) {}\n\n /**\n * Find tracks by rtc stats\n * Argument report is any because the stats api is not consistent:\n * For example `trackIdentifier`, `mid` not existing in every implementations\n * https://www.w3.org/TR/webrtc-stats/#dom-rtcinboundrtpstreamstats\n * https://developer.mozilla.org/en-US/docs/Web/API/RTCInboundRtpStreamStats\n */\n public findTrack2Stats(report: any, type: \"remote\" | \"local\"): MediaTrackStats | undefined {\n let trackID;\n if (report.trackIdentifier) {\n trackID = report.trackIdentifier;\n } else if (report.mid) {\n trackID =\n type === \"remote\"\n ? this.mediaTrackHandler.getRemoteTrackIdByMid(report.mid)\n : this.mediaTrackHandler.getLocalTrackIdByMid(report.mid);\n } else if (report.ssrc) {\n const mid = this.mediaSsrcHandler.findMidBySsrc(report.ssrc, type);\n if (!mid) {\n return undefined;\n }\n trackID =\n type === \"remote\"\n ? this.mediaTrackHandler.getRemoteTrackIdByMid(report.mid)\n : this.mediaTrackHandler.getLocalTrackIdByMid(report.mid);\n }\n\n if (!trackID) {\n return undefined;\n }\n\n let trackStats = this.track2stats.get(trackID);\n\n if (!trackStats) {\n const track = this.mediaTrackHandler.getTackById(trackID);\n if (track !== undefined) {\n const kind: \"audio\" | \"video\" = track.kind === \"audio\" ? track.kind : \"video\";\n trackStats = new MediaTrackStats(trackID, type, kind);\n this.track2stats.set(trackID, trackStats);\n } else {\n return undefined;\n }\n }\n return trackStats;\n }\n\n public findLocalVideoTrackStats(report: any): MediaTrackStats | undefined {\n const localVideoTracks = this.mediaTrackHandler.getLocalTracks(\"video\");\n if (localVideoTracks.length === 0) {\n return undefined;\n }\n return this.findTrack2Stats(report, \"local\");\n }\n\n public getTrack2stats(): Map<TrackID, MediaTrackStats> {\n return this.track2stats;\n }\n\n public findTransceiverByTrackId(trackID: TrackId): undefined | RTCRtpTransceiver {\n return this.mediaTrackHandler.getTransceiverByTrackId(trackID);\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,eAAe,QAAQ,sBAAsB;AAItD,OAAO,MAAMC,sBAAsB,CAAC;EAGzBC,WAAWA,CACEC,gBAAkC,EAClCC,iBAAoC,EACtD;IAAA,KAFkBD,gBAAkC,GAAlCA,gBAAkC;IAAA,KAClCC,iBAAoC,GAApCA,iBAAoC;IAAAC,eAAA,sBAJzB,IAAIC,GAAG,CAA2B,CAAC;EAK/D;;EAEH;AACJ;AACA;AACA;AACA;AACA;AACA;EACWC,eAAeA,CAACC,MAAW,EAAEC,IAAwB,EAA+B;IACvF,IAAIC,OAAO;IACX,IAAIF,MAAM,CAACG,eAAe,EAAE;MACxBD,OAAO,GAAGF,MAAM,CAACG,eAAe;IACpC,CAAC,MAAM,IAAIH,MAAM,CAACI,GAAG,EAAE;MACnBF,OAAO,GACHD,IAAI,KAAK,QAAQ,GACX,IAAI,CAACL,iBAAiB,CAACS,qBAAqB,CAACL,MAAM,CAACI,GAAG,CAAC,GACxD,IAAI,CAACR,iBAAiB,CAACU,oBAAoB,CAACN,MAAM,CAACI,GAAG,CAAC;IACrE,CAAC,MAAM,IAAIJ,MAAM,CAACO,IAAI,EAAE;MACpB,IAAMH,GAAG,GAAG,IAAI,CAACT,gBAAgB,CAACa,aAAa,CAACR,MAAM,CAACO,IAAI,EAAEN,IAAI,CAAC;MAClE,IAAI,CAACG,GAAG,EAAE;QACN,OAAOK,SAAS;MACpB;MACAP,OAAO,GACHD,IAAI,KAAK,QAAQ,GACX,IAAI,CAACL,iBAAiB,CAACS,qBAAqB,CAACL,MAAM,CAACI,GAAG,CAAC,GACxD,IAAI,CAACR,iBAAiB,CAACU,oBAAoB,CAACN,MAAM,CAACI,GAAG,CAAC;IACrE;IAEA,IAAI,CAACF,OAAO,EAAE;MACV,OAAOO,SAAS;IACpB;IAEA,IAAIC,UAAU,GAAG,IAAI,CAACC,WAAW,CAACC,GAAG,CAACV,OAAO,CAAC;IAE9C,IAAI,CAACQ,UAAU,EAAE;MACb,IAAMG,KAAK,GAAG,IAAI,CAACjB,iBAAiB,CAACkB,WAAW,CAACZ,OAAO,CAAC;MACzD,IAAIW,KAAK,KAAKJ,SAAS,EAAE;QACrB,IAAMM,IAAuB,GAAGF,KAAK,CAACE,IAAI,KAAK,OAAO,GAAGF,KAAK,CAACE,IAAI,GAAG,OAAO;QAC7EL,UAAU,GAAG,IAAIlB,eAAe,CAACU,OAAO,EAAED,IAAI,EAAEc,IAAI,CAAC;QACrD,IAAI,CAACJ,WAAW,CAACK,GAAG,CAACd,OAAO,EAAEQ,UAAU,CAAC;MAC7C,CAAC,MAAM;QACH,OAAOD,SAAS;MACpB;IACJ;IACA,OAAOC,UAAU;EACrB;EAEOO,wBAAwBA,CAACjB,MAAW,EAA+B;IACtE,IAAMkB,gBAAgB,GAAG,IAAI,CAACtB,iBAAiB,CAACuB,cAAc,CAAC,OAAO,CAAC;IACvE,IAAID,gBAAgB,CAACE,MAAM,KAAK,CAAC,EAAE;MAC/B,OAAOX,SAAS;IACpB;IACA,OAAO,IAAI,CAACV,eAAe,CAACC,MAAM,EAAE,OAAO,CAAC;EAChD;EAEOqB,cAAcA,CAAA,EAAkC;IACnD,OAAO,IAAI,CAACV,WAAW;EAC3B;EAEOW,wBAAwBA,CAACpB,OAAgB,EAAiC;IAC7E,OAAO,IAAI,CAACN,iBAAiB,CAAC2B,uBAAuB,CAACrB,OAAO,CAAC;EAClE;AACJ","ignoreList":[]}
@@ -1,17 +1,17 @@
1
- /*
2
- Copyright 2023 The Matrix.org Foundation C.I.C.
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
1
+ /*
2
+ Copyright 2023 The Matrix.org Foundation C.I.C.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
15
  */
16
16
 
17
17
  export var StatsReport = /*#__PURE__*/function (StatsReport) {
@@ -1 +1 @@
1
- {"version":3,"file":"statsReport.js","names":["StatsReport"],"sources":["../../../src/webrtc/stats/statsReport.ts"],"sourcesContent":["/*\r\nCopyright 2023 The Matrix.org Foundation C.I.C.\r\n\r\nLicensed under the Apache License, Version 2.0 (the \"License\");\r\nyou may not use this file except in compliance with the License.\r\nYou may obtain a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nUnless required by applicable law or agreed to in writing, software\r\ndistributed under the License is distributed on an \"AS IS\" BASIS,\r\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\nSee the License for the specific language governing permissions and\r\nlimitations under the License.\r\n*/\r\n\r\nimport { type ConnectionStatsBandwidth, type ConnectionStatsBitrate, type PacketLoss } from \"./connectionStats.ts\";\r\nimport { type TransportStats } from \"./transportStats.ts\";\r\nimport { type Resolution } from \"./media/mediaTrackStats.ts\";\r\n\r\nexport enum StatsReport {\r\n CONNECTION_STATS = \"StatsReport.connection_stats\",\r\n CALL_FEED_REPORT = \"StatsReport.call_feed_report\",\r\n BYTE_SENT_STATS = \"StatsReport.byte_sent_stats\",\r\n SUMMARY_STATS = \"StatsReport.summary_stats\",\r\n}\r\n\r\n/// ByteSentStatsReport ################################################################################################\r\nexport interface ByteSentStatsReport extends Map<TrackID, ByteSend> {\r\n callId?: string;\r\n opponentMemberId?: string;\r\n // is a map: `local trackID` => byte send\r\n}\r\n\r\nexport type TrackID = string;\r\nexport type ByteSend = number;\r\n\r\n/// ConnectionStatsReport ##############################################################################################\r\nexport interface ConnectionStatsReport {\r\n callId?: string;\r\n opponentMemberId?: string;\r\n bandwidth: ConnectionStatsBandwidth;\r\n bitrate: ConnectionStatsBitrate;\r\n packetLoss: PacketLoss;\r\n audioConcealment: Map<TrackID, AudioConcealment>;\r\n totalAudioConcealment: AudioConcealment;\r\n resolution: ResolutionMap;\r\n framerate: FramerateMap;\r\n codec: CodecMap;\r\n jitter: Map<TrackID, number>;\r\n transport: TransportStats[];\r\n}\r\n\r\nexport interface AudioConcealment {\r\n concealedAudio: number;\r\n totalAudioDuration: number;\r\n}\r\n\r\nexport interface ResolutionMap {\r\n local: Map<TrackID, Resolution>;\r\n remote: Map<TrackID, Resolution>;\r\n}\r\n\r\nexport interface FramerateMap {\r\n local: Map<TrackID, number>;\r\n remote: Map<TrackID, number>;\r\n}\r\n\r\nexport interface CodecMap {\r\n local: Map<TrackID, string>;\r\n remote: Map<TrackID, string>;\r\n}\r\n\r\n/// SummaryStatsReport #################################################################################################\r\nexport interface SummaryStatsReport {\r\n /**\r\n * Aggregated the information for percentage of received media\r\n *\r\n * This measure whether the current user receive data from a call participants.\r\n * As soon as a participant sends at least a byte media to this user, this counts as one measurement unit.\r\n * The units of measure divided by the total number of participants is a value between 0 and 1.\r\n */\r\n percentageReceivedMedia: number;\r\n percentageReceivedAudioMedia: number;\r\n percentageReceivedVideoMedia: number;\r\n maxJitter: number;\r\n maxPacketLoss: number;\r\n percentageConcealedAudio: number;\r\n peerConnections: number;\r\n opponentUsersInCall?: number;\r\n opponentDevicesInCall?: number;\r\n diffDevicesToPeerConnections?: number;\r\n ratioPeerConnectionToDevices?: number;\r\n // Todo: Decide if we want an index (or a timestamp) of this report in relation to the group call, to help differenciate when issues occur and ignore/track initial connection delays.\r\n}\r\n\r\n/// CallFeedReport #####################################################################################################\r\nexport interface CallFeedReport {\r\n callId: string;\r\n opponentMemberId: string;\r\n transceiver: TransceiverStats[];\r\n callFeeds: CallFeedStats[];\r\n}\r\n\r\nexport interface CallFeedStats {\r\n stream: string;\r\n type: \"remote\" | \"local\";\r\n audio: TrackStats | null;\r\n video: TrackStats | null;\r\n purpose: string;\r\n prefix: string;\r\n isVideoMuted: boolean;\r\n isAudioMuted: boolean;\r\n}\r\n\r\nexport interface TransceiverStats {\r\n readonly mid: string;\r\n readonly sender: TrackStats | null;\r\n readonly receiver: TrackStats | null;\r\n readonly direction: string;\r\n readonly currentDirection: string;\r\n}\r\n\r\nexport interface TrackStats {\r\n readonly id: string;\r\n readonly kind: \"audio\" | \"video\";\r\n readonly settingDeviceId: string;\r\n readonly constrainDeviceId: string;\r\n readonly muted: boolean;\r\n readonly enabled: boolean;\r\n readonly readyState: \"ended\" | \"live\";\r\n readonly label: string;\r\n}\r\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,WAAYA,WAAW,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;;AAOvB;;AAUA;;AAoCA;;AAuBA","ignoreList":[]}
1
+ {"version":3,"file":"statsReport.js","names":["StatsReport"],"sources":["../../../src/webrtc/stats/statsReport.ts"],"sourcesContent":["/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type ConnectionStatsBandwidth, type ConnectionStatsBitrate, type PacketLoss } from \"./connectionStats.ts\";\nimport { type TransportStats } from \"./transportStats.ts\";\nimport { type Resolution } from \"./media/mediaTrackStats.ts\";\n\nexport enum StatsReport {\n CONNECTION_STATS = \"StatsReport.connection_stats\",\n CALL_FEED_REPORT = \"StatsReport.call_feed_report\",\n BYTE_SENT_STATS = \"StatsReport.byte_sent_stats\",\n SUMMARY_STATS = \"StatsReport.summary_stats\",\n}\n\n/// ByteSentStatsReport ################################################################################################\nexport interface ByteSentStatsReport extends Map<TrackID, ByteSend> {\n callId?: string;\n opponentMemberId?: string;\n // is a map: `local trackID` => byte send\n}\n\nexport type TrackID = string;\nexport type ByteSend = number;\n\n/// ConnectionStatsReport ##############################################################################################\nexport interface ConnectionStatsReport {\n callId?: string;\n opponentMemberId?: string;\n bandwidth: ConnectionStatsBandwidth;\n bitrate: ConnectionStatsBitrate;\n packetLoss: PacketLoss;\n audioConcealment: Map<TrackID, AudioConcealment>;\n totalAudioConcealment: AudioConcealment;\n resolution: ResolutionMap;\n framerate: FramerateMap;\n codec: CodecMap;\n jitter: Map<TrackID, number>;\n transport: TransportStats[];\n}\n\nexport interface AudioConcealment {\n concealedAudio: number;\n totalAudioDuration: number;\n}\n\nexport interface ResolutionMap {\n local: Map<TrackID, Resolution>;\n remote: Map<TrackID, Resolution>;\n}\n\nexport interface FramerateMap {\n local: Map<TrackID, number>;\n remote: Map<TrackID, number>;\n}\n\nexport interface CodecMap {\n local: Map<TrackID, string>;\n remote: Map<TrackID, string>;\n}\n\n/// SummaryStatsReport #################################################################################################\nexport interface SummaryStatsReport {\n /**\n * Aggregated the information for percentage of received media\n *\n * This measure whether the current user receive data from a call participants.\n * As soon as a participant sends at least a byte media to this user, this counts as one measurement unit.\n * The units of measure divided by the total number of participants is a value between 0 and 1.\n */\n percentageReceivedMedia: number;\n percentageReceivedAudioMedia: number;\n percentageReceivedVideoMedia: number;\n maxJitter: number;\n maxPacketLoss: number;\n percentageConcealedAudio: number;\n peerConnections: number;\n opponentUsersInCall?: number;\n opponentDevicesInCall?: number;\n diffDevicesToPeerConnections?: number;\n ratioPeerConnectionToDevices?: number;\n // Todo: Decide if we want an index (or a timestamp) of this report in relation to the group call, to help differenciate when issues occur and ignore/track initial connection delays.\n}\n\n/// CallFeedReport #####################################################################################################\nexport interface CallFeedReport {\n callId: string;\n opponentMemberId: string;\n transceiver: TransceiverStats[];\n callFeeds: CallFeedStats[];\n}\n\nexport interface CallFeedStats {\n stream: string;\n type: \"remote\" | \"local\";\n audio: TrackStats | null;\n video: TrackStats | null;\n purpose: string;\n prefix: string;\n isVideoMuted: boolean;\n isAudioMuted: boolean;\n}\n\nexport interface TransceiverStats {\n readonly mid: string;\n readonly sender: TrackStats | null;\n readonly receiver: TrackStats | null;\n readonly direction: string;\n readonly currentDirection: string;\n}\n\nexport interface TrackStats {\n readonly id: string;\n readonly kind: \"audio\" | \"video\";\n readonly settingDeviceId: string;\n readonly constrainDeviceId: string;\n readonly muted: boolean;\n readonly enabled: boolean;\n readonly readyState: \"ended\" | \"live\";\n readonly label: string;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,WAAYA,WAAW,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;;AAOvB;;AAUA;;AAoCA;;AAuBA","ignoreList":[]}
@@ -1,17 +1,17 @@
1
- /*
2
- Copyright 2023 The Matrix.org Foundation C.I.C.
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
1
+ /*
2
+ Copyright 2023 The Matrix.org Foundation C.I.C.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
15
  */
16
16
 
17
17
  import { TypedEventEmitter } from "../../models/typed-event-emitter.js";
@@ -1 +1 @@
1
- {"version":3,"file":"statsReportEmitter.js","names":["TypedEventEmitter","StatsReport","StatsReportEmitter","emitByteSendReport","byteSentStats","emit","BYTE_SENT_STATS","emitConnectionStatsReport","report","CONNECTION_STATS","emitCallFeedReport","CALL_FEED_REPORT","emitSummaryStatsReport","SUMMARY_STATS"],"sources":["../../../src/webrtc/stats/statsReportEmitter.ts"],"sourcesContent":["/*\r\nCopyright 2023 The Matrix.org Foundation C.I.C.\r\n\r\nLicensed under the Apache License, Version 2.0 (the \"License\");\r\nyou may not use this file except in compliance with the License.\r\nYou may obtain a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nUnless required by applicable law or agreed to in writing, software\r\ndistributed under the License is distributed on an \"AS IS\" BASIS,\r\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\nSee the License for the specific language governing permissions and\r\nlimitations under the License.\r\n*/\r\n\r\nimport { TypedEventEmitter } from \"../../models/typed-event-emitter.ts\";\r\nimport {\r\n type ByteSentStatsReport,\r\n type CallFeedReport,\r\n type ConnectionStatsReport,\r\n StatsReport,\r\n type SummaryStatsReport,\r\n} from \"./statsReport.ts\";\r\n\r\nexport type StatsReportHandlerMap = {\r\n [StatsReport.BYTE_SENT_STATS]: (report: ByteSentStatsReport) => void;\r\n [StatsReport.CONNECTION_STATS]: (report: ConnectionStatsReport) => void;\r\n [StatsReport.CALL_FEED_REPORT]: (report: CallFeedReport) => void;\r\n [StatsReport.SUMMARY_STATS]: (report: SummaryStatsReport) => void;\r\n};\r\n\r\nexport class StatsReportEmitter extends TypedEventEmitter<StatsReport, StatsReportHandlerMap> {\r\n public emitByteSendReport(byteSentStats: ByteSentStatsReport): void {\r\n this.emit(StatsReport.BYTE_SENT_STATS, byteSentStats);\r\n }\r\n\r\n public emitConnectionStatsReport(report: ConnectionStatsReport): void {\r\n this.emit(StatsReport.CONNECTION_STATS, report);\r\n }\r\n\r\n public emitCallFeedReport(report: CallFeedReport): void {\r\n this.emit(StatsReport.CALL_FEED_REPORT, report);\r\n }\r\n\r\n public emitSummaryStatsReport(report: SummaryStatsReport): void {\r\n this.emit(StatsReport.SUMMARY_STATS, report);\r\n }\r\n}\r\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,iBAAiB,QAAQ,qCAAqC;AACvE,SAIIC,WAAW,QAER,kBAAkB;AASzB,OAAO,MAAMC,kBAAkB,SAASF,iBAAiB,CAAqC;EACnFG,kBAAkBA,CAACC,aAAkC,EAAQ;IAChE,IAAI,CAACC,IAAI,CAACJ,WAAW,CAACK,eAAe,EAAEF,aAAa,CAAC;EACzD;EAEOG,yBAAyBA,CAACC,MAA6B,EAAQ;IAClE,IAAI,CAACH,IAAI,CAACJ,WAAW,CAACQ,gBAAgB,EAAED,MAAM,CAAC;EACnD;EAEOE,kBAAkBA,CAACF,MAAsB,EAAQ;IACpD,IAAI,CAACH,IAAI,CAACJ,WAAW,CAACU,gBAAgB,EAAEH,MAAM,CAAC;EACnD;EAEOI,sBAAsBA,CAACJ,MAA0B,EAAQ;IAC5D,IAAI,CAACH,IAAI,CAACJ,WAAW,CAACY,aAAa,EAAEL,MAAM,CAAC;EAChD;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"statsReportEmitter.js","names":["TypedEventEmitter","StatsReport","StatsReportEmitter","emitByteSendReport","byteSentStats","emit","BYTE_SENT_STATS","emitConnectionStatsReport","report","CONNECTION_STATS","emitCallFeedReport","CALL_FEED_REPORT","emitSummaryStatsReport","SUMMARY_STATS"],"sources":["../../../src/webrtc/stats/statsReportEmitter.ts"],"sourcesContent":["/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { TypedEventEmitter } from \"../../models/typed-event-emitter.ts\";\nimport {\n type ByteSentStatsReport,\n type CallFeedReport,\n type ConnectionStatsReport,\n StatsReport,\n type SummaryStatsReport,\n} from \"./statsReport.ts\";\n\nexport type StatsReportHandlerMap = {\n [StatsReport.BYTE_SENT_STATS]: (report: ByteSentStatsReport) => void;\n [StatsReport.CONNECTION_STATS]: (report: ConnectionStatsReport) => void;\n [StatsReport.CALL_FEED_REPORT]: (report: CallFeedReport) => void;\n [StatsReport.SUMMARY_STATS]: (report: SummaryStatsReport) => void;\n};\n\nexport class StatsReportEmitter extends TypedEventEmitter<StatsReport, StatsReportHandlerMap> {\n public emitByteSendReport(byteSentStats: ByteSentStatsReport): void {\n this.emit(StatsReport.BYTE_SENT_STATS, byteSentStats);\n }\n\n public emitConnectionStatsReport(report: ConnectionStatsReport): void {\n this.emit(StatsReport.CONNECTION_STATS, report);\n }\n\n public emitCallFeedReport(report: CallFeedReport): void {\n this.emit(StatsReport.CALL_FEED_REPORT, report);\n }\n\n public emitSummaryStatsReport(report: SummaryStatsReport): void {\n this.emit(StatsReport.SUMMARY_STATS, report);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,iBAAiB,QAAQ,qCAAqC;AACvE,SAIIC,WAAW,QAER,kBAAkB;AASzB,OAAO,MAAMC,kBAAkB,SAASF,iBAAiB,CAAqC;EACnFG,kBAAkBA,CAACC,aAAkC,EAAQ;IAChE,IAAI,CAACC,IAAI,CAACJ,WAAW,CAACK,eAAe,EAAEF,aAAa,CAAC;EACzD;EAEOG,yBAAyBA,CAACC,MAA6B,EAAQ;IAClE,IAAI,CAACH,IAAI,CAACJ,WAAW,CAACQ,gBAAgB,EAAED,MAAM,CAAC;EACnD;EAEOE,kBAAkBA,CAACF,MAAsB,EAAQ;IACpD,IAAI,CAACH,IAAI,CAACJ,WAAW,CAACU,gBAAgB,EAAEH,MAAM,CAAC;EACnD;EAEOI,sBAAsBA,CAACJ,MAA0B,EAAQ;IAC5D,IAAI,CAACH,IAAI,CAACJ,WAAW,CAACY,aAAa,EAAEL,MAAM,CAAC;EAChD;AACJ","ignoreList":[]}
@@ -33,10 +33,10 @@ export class TrackStatsBuilder {
33
33
  static buildCodec(report, trackStats, now) {
34
34
  var codec = report === null || report === void 0 ? void 0 : report.get(now.codecId);
35
35
  if (codec) {
36
- /**
37
- * The mime type has the following form: video/VP8 or audio/ISAC,
38
- * so we what to keep just the type after the '/', audio and video
39
- * keys will be added on the processing side.
36
+ /**
37
+ * The mime type has the following form: video/VP8 or audio/ISAC,
38
+ * so we what to keep just the type after the '/', audio and video
39
+ * keys will be added on the processing side.
40
40
  */
41
41
  var codecShortType = codec.mimeType.split("/")[1];
42
42
  if (codecShortType) trackStats.setCodec(codecShortType);
@@ -1 +1 @@
1
- {"version":3,"file":"trackStatsBuilder.js","names":["ValueFormatter","TrackStatsBuilder","buildFramerateResolution","trackStats","now","resolution","height","frameHeight","width","frameWidth","frameRate","framesPerSecond","setResolution","setFramerate","Math","round","calculateSimulcastFramerate","before","layer","getFramerate","timeMs","timestamp","framesSent","numberOfFramesSinceBefore","buildCodec","report","codec","get","codecId","codecShortType","mimeType","split","setCodec","buildBitrateReceived","setBitrate","download","calculateBitrate","bytesReceived","upload","buildBitrateSend","bytesSent","buildPacketsLost","key","type","packetsNow","packetsBefore","getNonNegativeValue","packetsDiff","max","packetsLostNow","packetsLost","packetsLostBefore","packetsLostDiff","setLoss","packetsTotal","isDownloadStream","bytesNowAny","bytesBeforeAny","nowTimestamp","beforeTimestamp","bytesNow","bytesBefore","bytesProcessed","bitrateKbps","setTrackStatsState","transceiver","_transceiver$sender","undefined","alive","track","getType","receiver","sender","readyState","muted","enabled","buildTrackSummary","trackStatsList","videoTrackSummary","count","maxJitter","maxPacketLoss","concealedAudio","totalAudio","audioTrackSummary","remoteTrackList","filter","t","audioTrackList","kind","forEach","stats","trackSummary","getJitter","getLoss","length","_stats$getAudioConcea","_stats$getAudioConcea2","getAudioConcealment","totalAudioDuration","buildJitter","statsReport","jitterStr","jitter","setJitter","buildAudioConcealment","msPerSample","totalSamplesDuration","totalSamplesReceived","concealedAudioDuration","concealedSamples","setAudioConcealment"],"sources":["../../../src/webrtc/stats/trackStatsBuilder.ts"],"sourcesContent":["import { type MediaTrackStats } from \"./media/mediaTrackStats.ts\";\r\nimport { ValueFormatter } from \"./valueFormatter.ts\";\r\nimport { type TrackSummary } from \"./callStatsReportSummary.ts\";\r\n\r\nexport class TrackStatsBuilder {\r\n public static buildFramerateResolution(trackStats: MediaTrackStats, now: any): void {\r\n const resolution = {\r\n height: now.frameHeight,\r\n width: now.frameWidth,\r\n };\r\n const frameRate = now.framesPerSecond;\r\n\r\n if (resolution.height && resolution.width) {\r\n trackStats.setResolution(resolution);\r\n }\r\n trackStats.setFramerate(Math.round(frameRate || 0));\r\n }\r\n\r\n public static calculateSimulcastFramerate(trackStats: MediaTrackStats, now: any, before: any, layer: number): void {\r\n let frameRate = trackStats.getFramerate();\r\n if (!frameRate) {\r\n if (before) {\r\n const timeMs = now.timestamp - before.timestamp;\r\n\r\n if (timeMs > 0 && now.framesSent) {\r\n const numberOfFramesSinceBefore = now.framesSent - before.framesSent;\r\n\r\n frameRate = (numberOfFramesSinceBefore / timeMs) * 1000;\r\n }\r\n }\r\n\r\n if (!frameRate) {\r\n return;\r\n }\r\n }\r\n\r\n // Reset frame rate to 0 when video is suspended as a result of endpoint falling out of last-n.\r\n frameRate = layer ? Math.round(frameRate / layer) : 0;\r\n trackStats.setFramerate(frameRate);\r\n }\r\n\r\n public static buildCodec(report: RTCStatsReport | undefined, trackStats: MediaTrackStats, now: any): void {\r\n const codec = report?.get(now.codecId);\r\n\r\n if (codec) {\r\n /**\r\n * The mime type has the following form: video/VP8 or audio/ISAC,\r\n * so we what to keep just the type after the '/', audio and video\r\n * keys will be added on the processing side.\r\n */\r\n const codecShortType = codec.mimeType.split(\"/\")[1];\r\n\r\n if (codecShortType) trackStats.setCodec(codecShortType);\r\n }\r\n }\r\n\r\n public static buildBitrateReceived(trackStats: MediaTrackStats, now: any, before: any): void {\r\n trackStats.setBitrate({\r\n download: TrackStatsBuilder.calculateBitrate(\r\n now.bytesReceived,\r\n before.bytesReceived,\r\n now.timestamp,\r\n before.timestamp,\r\n ),\r\n upload: 0,\r\n });\r\n }\r\n\r\n public static buildBitrateSend(trackStats: MediaTrackStats, now: any, before: any): void {\r\n trackStats.setBitrate({\r\n download: 0,\r\n upload: this.calculateBitrate(now.bytesSent, before.bytesSent, now.timestamp, before.timestamp),\r\n });\r\n }\r\n\r\n public static buildPacketsLost(trackStats: MediaTrackStats, now: any, before: any): void {\r\n const key = now.type === \"outbound-rtp\" ? \"packetsSent\" : \"packetsReceived\";\r\n\r\n let packetsNow = now[key];\r\n if (!packetsNow || packetsNow < 0) {\r\n packetsNow = 0;\r\n }\r\n\r\n const packetsBefore = ValueFormatter.getNonNegativeValue(before[key]);\r\n const packetsDiff = Math.max(0, packetsNow - packetsBefore);\r\n\r\n const packetsLostNow = ValueFormatter.getNonNegativeValue(now.packetsLost);\r\n const packetsLostBefore = ValueFormatter.getNonNegativeValue(before.packetsLost);\r\n const packetsLostDiff = Math.max(0, packetsLostNow - packetsLostBefore);\r\n\r\n trackStats.setLoss({\r\n packetsTotal: packetsDiff + packetsLostDiff,\r\n packetsLost: packetsLostDiff,\r\n isDownloadStream: now.type !== \"outbound-rtp\",\r\n });\r\n }\r\n\r\n private static calculateBitrate(\r\n bytesNowAny: any,\r\n bytesBeforeAny: any,\r\n nowTimestamp: number,\r\n beforeTimestamp: number,\r\n ): number {\r\n const bytesNow = ValueFormatter.getNonNegativeValue(bytesNowAny);\r\n const bytesBefore = ValueFormatter.getNonNegativeValue(bytesBeforeAny);\r\n const bytesProcessed = Math.max(0, bytesNow - bytesBefore);\r\n\r\n const timeMs = nowTimestamp - beforeTimestamp;\r\n let bitrateKbps = 0;\r\n\r\n if (timeMs > 0) {\r\n bitrateKbps = Math.round((bytesProcessed * 8) / timeMs);\r\n }\r\n\r\n return bitrateKbps;\r\n }\r\n\r\n public static setTrackStatsState(trackStats: MediaTrackStats, transceiver: RTCRtpTransceiver | undefined): void {\r\n if (transceiver === undefined) {\r\n trackStats.alive = false;\r\n return;\r\n }\r\n\r\n const track = trackStats.getType() === \"remote\" ? transceiver.receiver.track : transceiver?.sender?.track;\r\n if (track === undefined || track === null) {\r\n trackStats.alive = false;\r\n return;\r\n }\r\n\r\n if (track.readyState === \"ended\") {\r\n trackStats.alive = false;\r\n return;\r\n }\r\n trackStats.muted = track.muted;\r\n trackStats.enabled = track.enabled;\r\n trackStats.alive = true;\r\n }\r\n\r\n public static buildTrackSummary(trackStatsList: MediaTrackStats[]): {\r\n audioTrackSummary: TrackSummary;\r\n videoTrackSummary: TrackSummary;\r\n } {\r\n const videoTrackSummary: TrackSummary = {\r\n count: 0,\r\n muted: 0,\r\n maxJitter: 0,\r\n maxPacketLoss: 0,\r\n concealedAudio: 0,\r\n totalAudio: 0,\r\n };\r\n const audioTrackSummary: TrackSummary = {\r\n count: 0,\r\n muted: 0,\r\n maxJitter: 0,\r\n maxPacketLoss: 0,\r\n concealedAudio: 0,\r\n totalAudio: 0,\r\n };\r\n\r\n const remoteTrackList = trackStatsList.filter((t) => t.getType() === \"remote\");\r\n const audioTrackList = remoteTrackList.filter((t) => t.kind === \"audio\");\r\n\r\n remoteTrackList.forEach((stats) => {\r\n const trackSummary = stats.kind === \"video\" ? videoTrackSummary : audioTrackSummary;\r\n trackSummary.count++;\r\n if (stats.alive && stats.muted) {\r\n trackSummary.muted++;\r\n }\r\n if (trackSummary.maxJitter < stats.getJitter()) {\r\n trackSummary.maxJitter = stats.getJitter();\r\n }\r\n if (trackSummary.maxPacketLoss < stats.getLoss().packetsLost) {\r\n trackSummary.maxPacketLoss = stats.getLoss().packetsLost;\r\n }\r\n if (audioTrackList.length > 0) {\r\n trackSummary.concealedAudio += stats.getAudioConcealment()?.concealedAudio;\r\n trackSummary.totalAudio += stats.getAudioConcealment()?.totalAudioDuration;\r\n }\r\n });\r\n\r\n return { audioTrackSummary, videoTrackSummary };\r\n }\r\n\r\n public static buildJitter(trackStats: MediaTrackStats, statsReport: any): void {\r\n if (statsReport.type !== \"inbound-rtp\") {\r\n return;\r\n }\r\n\r\n const jitterStr = statsReport?.jitter;\r\n if (jitterStr !== undefined) {\r\n const jitter = ValueFormatter.getNonNegativeValue(jitterStr);\r\n trackStats.setJitter(Math.round(jitter * 1000));\r\n } else {\r\n trackStats.setJitter(-1);\r\n }\r\n }\r\n\r\n public static buildAudioConcealment(trackStats: MediaTrackStats, statsReport: any): void {\r\n if (statsReport.type !== \"inbound-rtp\") {\r\n return;\r\n }\r\n const msPerSample = (1000 * statsReport?.totalSamplesDuration) / statsReport?.totalSamplesReceived;\r\n const concealedAudioDuration = msPerSample * statsReport?.concealedSamples;\r\n const totalAudioDuration = 1000 * statsReport?.totalSamplesDuration;\r\n trackStats.setAudioConc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G,WAAgB,EAAQ;IAC3E,IAAIA,WAAW,CAAC1D,IAAI,KAAK,aAAa,EAAE;MACpC;IACJ;IAEA,IAAM2D,SAAS,GAAGD,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEE,MAAM;IACrC,IAAID,SAAS,KAAKnC,SAAS,EAAE;MACzB,IAAMoC,MAAM,GAAGvG,cAAc,CAAC8C,mBAAmB,CAACwD,SAAS,CAAC;MAC5DnG,UAAU,CAACqG,SAAS,CAAC1F,IAAI,CAACC,KAAK,CAACwF,MAAM,GAAG,IAAI,CAAC,CAAC;IACnD,CAAC,MAAM;MACHpG,UAAU,CAACqG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC5B;EACJ;EAEA,OAAcC,qBAAqBA,CAACtG,UAA2B,EAAEkG,WAAgB,EAAQ;IACrF,IAAIA,WAAW,CAAC1D,IAAI,KAAK,aAAa,EAAE;MACpC;IACJ;IACA,IAAM+D,WAAW,GAAI,IAAI,IAAGL,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEM,oBAAoB,KAAIN,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEO,oBAAoB;IAClG,IAAMC,sBAAsB,GAAGH,WAAW,IAAGL,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAES,gBAAgB;IAC1E,IAAMX,kBAAkB,GAAG,IAAI,IAAGE,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEM,oBAAoB;IACnExG,UAAU,CAAC4G,mBAAmB,CAACF,sBAAsB,EAAEV,kBAAkB,CAAC;EAC9E;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"trackStatsBuilder.js","names":["ValueFormatter","TrackStatsBuilder","buildFramerateResolution","trackStats","now","resolution","height","frameHeight","width","frameWidth","frameRate","framesPerSecond","setResolution","setFramerate","Math","round","calculateSimulcastFramerate","before","layer","getFramerate","timeMs","timestamp","framesSent","numberOfFramesSinceBefore","buildCodec","report","codec","get","codecId","codecShortType","mimeType","split","setCodec","buildBitrateReceived","setBitrate","download","calculateBitrate","bytesReceived","upload","buildBitrateSend","bytesSent","buildPacketsLost","key","type","packetsNow","packetsBefore","getNonNegativeValue","packetsDiff","max","packetsLostNow","packetsLost","packetsLostBefore","packetsLostDiff","setLoss","packetsTotal","isDownloadStream","bytesNowAny","bytesBeforeAny","nowTimestamp","beforeTimestamp","bytesNow","bytesBefore","bytesProcessed","bitrateKbps","setTrackStatsState","transceiver","_transceiver$sender","undefined","alive","track","getType","receiver","sender","readyState","muted","enabled","buildTrackSummary","trackStatsList","videoTrackSummary","count","maxJitter","maxPacketLoss","concealedAudio","totalAudio","audioTrackSummary","remoteTrackList","filter","t","audioTrackList","kind","forEach","stats","trackSummary","getJitter","getLoss","length","_stats$getAudioConcea","_stats$getAudioConcea2","getAudioConcealment","totalAudioDuration","buildJitter","statsReport","jitterStr","jitter","setJitter","buildAudioConcealment","msPerSample","totalSamplesDuration","totalSamplesReceived","concealedAudioDuration","concealedSamples","setAudioConcealment"],"sources":["../../../src/webrtc/stats/trackStatsBuilder.ts"],"sourcesContent":["import { type MediaTrackStats } from \"./media/mediaTrackStats.ts\";\nimport { ValueFormatter } from \"./valueFormatter.ts\";\nimport { type TrackSummary } from \"./callStatsReportSummary.ts\";\n\nexport class TrackStatsBuilder {\n public static buildFramerateResolution(trackStats: MediaTrackStats, now: any): void {\n const resolution = {\n height: now.frameHeight,\n width: now.frameWidth,\n };\n const frameRate = now.framesPerSecond;\n\n if (resolution.height && resolution.width) {\n trackStats.setResolution(resolution);\n }\n trackStats.setFramerate(Math.round(frameRate || 0));\n }\n\n public static calculateSimulcastFramerate(trackStats: MediaTrackStats, now: any, before: any, layer: number): void {\n let frameRate = trackStats.getFramerate();\n if (!frameRate) {\n if (before) {\n const timeMs = now.timestamp - before.timestamp;\n\n if (timeMs > 0 && now.framesSent) {\n const numberOfFramesSinceBefore = now.framesSent - before.framesSent;\n\n frameRate = (numberOfFramesSinceBefore / timeMs) * 1000;\n }\n }\n\n if (!frameRate) {\n return;\n }\n }\n\n // Reset frame rate to 0 when video is suspended as a result of endpoint falling out of last-n.\n frameRate = layer ? Math.round(frameRate / layer) : 0;\n trackStats.setFramerate(frameRate);\n }\n\n public static buildCodec(report: RTCStatsReport | undefined, trackStats: MediaTrackStats, now: any): void {\n const codec = report?.get(now.codecId);\n\n if (codec) {\n /**\n * The mime type has the following form: video/VP8 or audio/ISAC,\n * so we what to keep just the type after the '/', audio and video\n * keys will be added on the processing side.\n */\n const codecShortType = codec.mimeType.split(\"/\")[1];\n\n if (codecShortType) trackStats.setCodec(codecShortType);\n }\n }\n\n public static buildBitrateReceived(trackStats: MediaTrackStats, now: any, before: any): void {\n trackStats.setBitrate({\n download: TrackStatsBuilder.calculateBitrate(\n now.bytesReceived,\n before.bytesReceived,\n now.timestamp,\n before.timestamp,\n ),\n upload: 0,\n });\n }\n\n public static buildBitrateSend(trackStats: MediaTrackStats, now: any, before: any): void {\n trackStats.setBitrate({\n download: 0,\n upload: this.calculateBitrate(now.bytesSent, before.bytesSent, now.timestamp, before.timestamp),\n });\n }\n\n public static buildPacketsLost(trackStats: MediaTrackStats, now: any, before: any): void {\n const key = now.type === \"outbound-rtp\" ? \"packetsSent\" : \"packetsReceived\";\n\n let packetsNow = now[key];\n if (!packetsNow || packetsNow < 0) {\n packetsNow = 0;\n }\n\n const packetsBefore = ValueFormatter.getNonNegativeValue(before[key]);\n const packetsDiff = Math.max(0, packetsNow - packetsBefore);\n\n const packetsLostNow = ValueFormatter.getNonNegativeValue(now.packetsLost);\n const packetsLostBefore = ValueFormatter.getNonNegativeValue(before.packetsLost);\n const packetsLostDiff = Math.max(0, packetsLostNow - packetsLostBefore);\n\n trackStats.setLoss({\n packetsTotal: packetsDiff + packetsLostDiff,\n packetsLost: packetsLostDiff,\n isDownloadStream: now.type !== \"outbound-rtp\",\n });\n }\n\n private static calculateBitrate(\n bytesNowAny: any,\n bytesBeforeAny: any,\n nowTimestamp: number,\n beforeTimestamp: number,\n ): number {\n const bytesNow = ValueFormatter.getNonNegativeValue(bytesNowAny);\n const bytesBefore = ValueFormatter.getNonNegativeValue(bytesBeforeAny);\n const bytesProcessed = Math.max(0, bytesNow - bytesBefore);\n\n const timeMs = nowTimestamp - beforeTimestamp;\n let bitrateKbps = 0;\n\n if (timeMs > 0) {\n bitrateKbps = Math.round((bytesProcessed * 8) / timeMs);\n }\n\n return bitrateKbps;\n }\n\n public static setTrackStatsState(trackStats: MediaTrackStats, transceiver: RTCRtpTransceiver | undefined): void {\n if (transceiver === undefined) {\n trackStats.alive = false;\n return;\n }\n\n const track = trackStats.getType() === \"remote\" ? transceiver.receiver.track : transceiver?.sender?.track;\n if (track === undefined || track === null) {\n trackStats.alive = false;\n return;\n }\n\n if (track.readyState === \"ended\") {\n trackStats.alive = false;\n return;\n }\n trackStats.muted = track.muted;\n trackStats.enabled = track.enabled;\n trackStats.alive = true;\n }\n\n public static buildTrackSummary(trackStatsList: MediaTrackStats[]): {\n audioTrackSummary: TrackSummary;\n videoTrackSummary: TrackSummary;\n } {\n const videoTrackSummary: TrackSummary = {\n count: 0,\n muted: 0,\n maxJitter: 0,\n maxPacketLoss: 0,\n concealedAudio: 0,\n totalAudio: 0,\n };\n const audioTrackSummary: TrackSummary = {\n count: 0,\n muted: 0,\n maxJitter: 0,\n maxPacketLoss: 0,\n concealedAudio: 0,\n totalAudio: 0,\n };\n\n const remoteTrackList = trackStatsList.filter((t) => t.getType() === \"remote\");\n const audioTrackList = remoteTrackList.filter((t) => t.kind === \"audio\");\n\n remoteTrackList.forEach((stats) => {\n const trackSummary = stats.kind === \"video\" ? videoTrackSummary : audioTrackSummary;\n trackSummary.count++;\n if (stats.alive && stats.muted) {\n trackSummary.muted++;\n }\n if (trackSummary.maxJitter < stats.getJitter()) {\n trackSummary.maxJitter = stats.getJitter();\n }\n if (trackSummary.maxPacketLoss < stats.getLoss().packetsLost) {\n trackSummary.maxPacketLoss = stats.getLoss().packetsLost;\n }\n if (audioTrackList.length > 0) {\n trackSummary.concealedAudio += stats.getAudioConcealment()?.concealedAudio;\n trackSummary.totalAudio += stats.getAudioConcealment()?.totalAudioDuration;\n }\n });\n\n return { audioTrackSummary, videoTrackSummary };\n }\n\n public static buildJitter(trackStats: MediaTrackStats, statsReport: any): void {\n if (statsReport.type !== \"inbound-rtp\") {\n return;\n }\n\n const jitterStr = statsReport?.jitter;\n if (jitterStr !== undefined) {\n const jitter = ValueFormatter.getNonNegativeValue(jitterStr);\n trackStats.setJitter(Math.round(jitter * 1000));\n } else {\n trackStats.setJitter(-1);\n }\n }\n\n public static buildAudioConcealment(trackStats: MediaTrackStats, statsReport: any): void {\n if (statsReport.type !== \"inbound-rtp\") {\n return;\n }\n const msPerSample = (1000 * statsReport?.totalSamplesDuration) / statsReport?.totalSamplesReceived;\n const concealedAudioDuration = msPerSample * statsReport?.concealedSamples;\n const totalAudioDuration = 1000 * statsReport?.totalSamplesDuration;\n trackStats.setAudioConcealment(concealedAudioDuration, totalAudioDuration);\n }\n}\n"],"mappings":"AACA,SAASA,cAAc,QAAQ,qBAAqB;AAGpD,OAAO,MAAMC,iBAAiB,CAAC;EAC3B,OAAcC,wBAAwBA,CAACC,UAA2B,EAAEC,GAAQ,EAAQ;IAChF,IAAMC,UAAU,GAAG;MACfC,MAAM,EAAEF,GAAG,CAACG,WAAW;MACvBC,KAAK,EAAEJ,GAAG,CAACK;IACf,CAAC;IACD,IAAMC,SAAS,GAAGN,GAAG,CAACO,eAAe;IAErC,IAAIN,UAAU,CAACC,MAAM,IAAID,UAAU,CAACG,KAAK,EAAE;MACvCL,UAAU,CAACS,aAAa,CAACP,UAAU,CAAC;IACxC;IACAF,UAAU,CAACU,YAAY,CAACC,IAAI,CAACC,KAAK,CAACL,SAAS,IAAI,CAAC,CAAC,CAAC;EACvD;EAEA,OAAcM,2BAA2BA,CAACb,UAA2B,EAAEC,GAAQ,EAAEa,MAAW,EAAEC,KAAa,EAAQ;IAC/G,IAAIR,SAAS,GAAGP,UAAU,CAACgB,YAAY,CAAC,CAAC;IAC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W,uBAAXA,WAAW,CAAEO,oBAAoB;IAClG,IAAMC,sBAAsB,GAAGH,WAAW,IAAGL,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAES,gBAAgB;IAC1E,IAAMX,kBAAkB,GAAG,IAAI,IAAGE,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEM,oBAAoB;IACnExG,UAAU,CAAC4G,mBAAmB,CAACF,sBAAsB,EAAEV,kBAAkB,CAAC;EAC9E;AACJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"transportStats.js","names":[],"sources":["../../../src/webrtc/stats/transportStats.ts"],"sourcesContent":["/*\r\nCopyright 2023 The Matrix.org Foundation C.I.C.\r\n\r\nLicensed under the Apache License, Version 2.0 (the \"License\");\r\nyou may not use this file except in compliance with the License.\r\nYou may obtain a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nUnless required by applicable law or agreed to in writing, software\r\ndistributed under the License is distributed on an \"AS IS\" BASIS,\r\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\nSee the License for the specific language governing permissions and\r\nlimitations under the License.\r\n*/\r\n\r\nexport interface TransportStats {\r\n ip: string;\r\n type: string;\r\n localIp: string;\r\n isFocus: boolean;\r\n localCandidateType: string;\r\n remoteCandidateType: string;\r\n networkType: string;\r\n rtt: number;\r\n}\r\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"transportStats.js","names":[],"sources":["../../../src/webrtc/stats/transportStats.ts"],"sourcesContent":["/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nexport interface TransportStats {\n ip: string;\n type: string;\n localIp: string;\n isFocus: boolean;\n localCandidateType: string;\n remoteCandidateType: string;\n networkType: string;\n rtt: number;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"transportStatsBuilder.js","names":["TransportStatsBuilder","buildReport","report","now","conferenceStatsTransport","isFocus","localUsedCandidate","get","localCandidateId","remoteUsedCandidate","remoteCandidateId","remoteIpAddress","ip","undefined","address","remotePort","port","concat","localIpAddress","localPort","localIp","type","protocol","some","t","push","localCandidateType","candidateType","remoteCandidateType","networkType","rtt","currentRoundTripTime","NaN"],"sources":["../../../src/webrtc/stats/transportStatsBuilder.ts"],"sourcesContent":["import { type TransportStats } from \"./transportStats.ts\";\r\n\r\nexport class TransportStatsBuilder {\r\n public static buildReport(\r\n report: RTCStatsReport | undefined,\r\n now: RTCIceCandidatePairStats,\r\n conferenceStatsTransport: TransportStats[],\r\n isFocus: boolean,\r\n ): TransportStats[] {\r\n const localUsedCandidate = report?.get(now.localCandidateId);\r\n const remoteUsedCandidate = report?.get(now.remoteCandidateId);\r\n\r\n // RTCIceCandidateStats\r\n // https://w3c.github.io/webrtc-stats/#icecandidate-dict*\r\n if (remoteUsedCandidate && localUsedCandidate) {\r\n const remoteIpAddress =\r\n remoteUsedCandidate.ip !== undefined ? remoteUsedCandidate.ip : remoteUsedCandidate.address;\r\n const remotePort = remoteUsedCandidate.port;\r\n const ip = `${remoteIpAddress}:${remotePort}`;\r\n\r\n const localIpAddress =\r\n localUsedCandidate.ip !== undefined ? localUsedCandidate.ip : localUsedCandidate.address;\r\n const localPort = localUsedCandidate.port;\r\n const localIp = `${localIpAddress}:${localPort}`;\r\n\r\n const type = remoteUsedCandidate.protocol;\r\n\r\n // Save the address unless it has been saved already.\r\n if (\r\n !conferenceStatsTransport.some(\r\n (t: TransportStats) => t.ip === ip && t.type === type && t.localIp === localIp,\r\n )\r\n ) {\r\n conferenceStatsTransport.push({\r\n ip,\r\n type,\r\n localIp,\r\n isFocus,\r\n localCandidateType: localUsedCandidate.candidateType,\r\n remoteCandidateType: remoteUsedCandidate.candidateType,\r\n networkType: localUsedCandidate.networkType,\r\n rtt: now.currentRoundTripTime ? now.currentRoundTripTime * 1000 : NaN,\r\n } as TransportStats);\r\n }\r\n }\r\n return conferenceStatsTransport;\r\n }\r\n}\r\n"],"mappings":"AAEA,OAAO,MAAMA,qBAAqB,CAAC;EAC/B,OAAcC,WAAWA,CACrBC,MAAkC,EAClCC,GAA6B,EAC7BC,wBAA0C,EAC1CC,OAAgB,EACA;IAChB,IAAMC,kBAAkB,GAAGJ,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEK,GAAG,CAACJ,GAAG,CAACK,gBAAgB,CAAC;IAC5D,IAAMC,mBAAmB,GAAGP,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEK,GAAG,CAACJ,GAAG,CAACO,iBAAiB,CAAC;;IAE9D;IACA;IACA,IAAID,mBAAmB,IAAIH,kBAAkB,EAAE;MAC3C,IAAMK,eAAe,GACjBF,mBAAmB,CAACG,EAAE,KAAKC,SAAS,GAAGJ,mBAAmB,CAACG,EAAE,GAAGH,mBAAmB,CAACK,OAAO;MAC/F,IAAMC,UAAU,GAAGN,mBAAmB,CAACO,IAAI;MAC3C,IAAMJ,EAAE,MAAAK,MAAA,CAAMN,eAAe,OAAAM,MAAA,CAAIF,UAAU,CAAE;MAE7C,IAAMG,cAAc,GAChBZ,kBAAkB,CAACM,EAAE,KAAKC,SAAS,GAAGP,kBAAkB,CAACM,EAAE,GAAGN,kBAAkB,CAACQ,OAAO;MAC5F,IAAMK,SAAS,GAAGb,kBAAkB,CAACU,IAAI;MACzC,IAAMI,OAAO,MAAAH,MAAA,CAAMC,cAAc,OAAAD,MAAA,CAAIE,SAAS,CAAE;MAEhD,IAAME,IAAI,GAAGZ,mBAAmB,CAACa,QAAQ;;MAEzC;MACA,IACI,CAAClB,wBAAwB,CAACmB,IAAI,CACzBC,CAAiB,IAAKA,CAAC,CAACZ,EAAE,KAAKA,EAAE,IAAIY,CAAC,CAACH,IAAI,KAAKA,IAAI,IAAIG,CAAC,CAACJ,OAAO,KAAKA,OAC3E,CAAC,EACH;QACEhB,wBAAwB,CAACqB,IAAI,CAAC;UAC1Bb,EAAE;UACFS,IAAI;UACJD,OAAO;UACPf,OAAO;UACPqB,kBAAkB,EAAEpB,kBAAkB,CAACqB,aAAa;UACpDC,mBAAmB,EAAEnB,mBAAmB,CAACkB,aAAa;UACtDE,WAAW,EAAEvB,kBAAkB,CAACuB,WAAW;UAC3CC,GAAG,EAAE3B,GAAG,CAAC4B,oBAAoB,GAAG5B,GAAG,CAAC4B,oBAAoB,GAAG,IAAI,GAAGC;QACtE,CAAmB,CAAC;MACxB;IACJ;IACA,OAAO5B,wBAAwB;EACnC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"transportStatsBuilder.js","names":["TransportStatsBuilder","buildReport","report","now","conferenceStatsTransport","isFocus","localUsedCandidate","get","localCandidateId","remoteUsedCandidate","remoteCandidateId","remoteIpAddress","ip","undefined","address","remotePort","port","concat","localIpAddress","localPort","localIp","type","protocol","some","t","push","localCandidateType","candidateType","remoteCandidateType","networkType","rtt","currentRoundTripTime","NaN"],"sources":["../../../src/webrtc/stats/transportStatsBuilder.ts"],"sourcesContent":["import { type TransportStats } from \"./transportStats.ts\";\n\nexport class TransportStatsBuilder {\n public static buildReport(\n report: RTCStatsReport | undefined,\n now: RTCIceCandidatePairStats,\n conferenceStatsTransport: TransportStats[],\n isFocus: boolean,\n ): TransportStats[] {\n const localUsedCandidate = report?.get(now.localCandidateId);\n const remoteUsedCandidate = report?.get(now.remoteCandidateId);\n\n // RTCIceCandidateStats\n // https://w3c.github.io/webrtc-stats/#icecandidate-dict*\n if (remoteUsedCandidate && localUsedCandidate) {\n const remoteIpAddress =\n remoteUsedCandidate.ip !== undefined ? remoteUsedCandidate.ip : remoteUsedCandidate.address;\n const remotePort = remoteUsedCandidate.port;\n const ip = `${remoteIpAddress}:${remotePort}`;\n\n const localIpAddress =\n localUsedCandidate.ip !== undefined ? localUsedCandidate.ip : localUsedCandidate.address;\n const localPort = localUsedCandidate.port;\n const localIp = `${localIpAddress}:${localPort}`;\n\n const type = remoteUsedCandidate.protocol;\n\n // Save the address unless it has been saved already.\n if (\n !conferenceStatsTransport.some(\n (t: TransportStats) => t.ip === ip && t.type === type && t.localIp === localIp,\n )\n ) {\n conferenceStatsTransport.push({\n ip,\n type,\n localIp,\n isFocus,\n localCandidateType: localUsedCandidate.candidateType,\n remoteCandidateType: remoteUsedCandidate.candidateType,\n networkType: localUsedCandidate.networkType,\n rtt: now.currentRoundTripTime ? now.currentRoundTripTime * 1000 : NaN,\n } as TransportStats);\n }\n }\n return conferenceStatsTransport;\n }\n}\n"],"mappings":"AAEA,OAAO,MAAMA,qBAAqB,CAAC;EAC/B,OAAcC,WAAWA,CACrBC,MAAkC,EAClCC,GAA6B,EAC7BC,wBAA0C,EAC1CC,OAAgB,EACA;IAChB,IAAMC,kBAAkB,GAAGJ,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEK,GAAG,CAACJ,GAAG,CAACK,gBAAgB,CAAC;IAC5D,IAAMC,mBAAmB,GAAGP,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEK,GAAG,CAACJ,GAAG,CAACO,iBAAiB,CAAC;;IAE9D;IACA;IACA,IAAID,mBAAmB,IAAIH,kBAAkB,EAAE;MAC3C,IAAMK,eAAe,GACjBF,mBAAmB,CAACG,EAAE,KAAKC,SAAS,GAAGJ,mBAAmB,CAACG,EAAE,GAAGH,mBAAmB,CAACK,OAAO;MAC/F,IAAMC,UAAU,GAAGN,mBAAmB,CAACO,IAAI;MAC3C,IAAMJ,EAAE,MAAAK,MAAA,CAAMN,eAAe,OAAAM,MAAA,CAAIF,UAAU,CAAE;MAE7C,IAAMG,cAAc,GAChBZ,kBAAkB,CAACM,EAAE,KAAKC,SAAS,GAAGP,kBAAkB,CAACM,EAAE,GAAGN,kBAAkB,CAACQ,OAAO;MAC5F,IAAMK,SAAS,GAAGb,kBAAkB,CAACU,IAAI;MACzC,IAAMI,OAAO,MAAAH,MAAA,CAAMC,cAAc,OAAAD,MAAA,CAAIE,SAAS,CAAE;MAEhD,IAAME,IAAI,GAAGZ,mBAAmB,CAACa,QAAQ;;MAEzC;MACA,IACI,CAAClB,wBAAwB,CAACmB,IAAI,CACzBC,CAAiB,IAAKA,CAAC,CAACZ,EAAE,KAAKA,EAAE,IAAIY,CAAC,CAACH,IAAI,KAAKA,IAAI,IAAIG,CAAC,CAACJ,OAAO,KAAKA,OAC3E,CAAC,EACH;QACEhB,wBAAwB,CAACqB,IAAI,CAAC;UAC1Bb,EAAE;UACFS,IAAI;UACJD,OAAO;UACPf,OAAO;UACPqB,kBAAkB,EAAEpB,kBAAkB,CAACqB,aAAa;UACpDC,mBAAmB,EAAEnB,mBAAmB,CAACkB,aAAa;UACtDE,WAAW,EAAEvB,kBAAkB,CAACuB,WAAW;UAC3CC,GAAG,EAAE3B,GAAG,CAAC4B,oBAAoB,GAAG5B,GAAG,CAAC4B,oBAAoB,GAAG,IAAI,GAAGC;QACtE,CAAmB,CAAC;MACxB;IACJ;IACA,OAAO5B,wBAAwB;EACnC;AACJ","ignoreList":[]}
@@ -1,14 +1,14 @@
1
- /*
2
- Copyright 2023 The Matrix.org Foundation C.I.C.
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
- http://www.apache.org/licenses/LICENSE-2.0
7
- Unless required by applicable law or agreed to in writing, software
8
- distributed under the License is distributed on an "AS IS" BASIS,
9
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- See the License for the specific language governing permissions and
11
- limitations under the License.
1
+ /*
2
+ Copyright 2023 The Matrix.org Foundation C.I.C.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
12
  */
13
13
  export class ValueFormatter {
14
14
  static getNonNegativeValue(imput) {
@@ -1 +1 @@
1
- {"version":3,"file":"valueFormatter.js","names":["ValueFormatter","getNonNegativeValue","imput","value","Number","isNaN","Math","max"],"sources":["../../../src/webrtc/stats/valueFormatter.ts"],"sourcesContent":["/*\r\nCopyright 2023 The Matrix.org Foundation C.I.C.\r\nLicensed under the Apache License, Version 2.0 (the \"License\");\r\nyou may not use this file except in compliance with the License.\r\nYou may obtain a copy of the License at\r\n http://www.apache.org/licenses/LICENSE-2.0\r\nUnless required by applicable law or agreed to in writing, software\r\ndistributed under the License is distributed on an \"AS IS\" BASIS,\r\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\nSee the License for the specific language governing permissions and\r\nlimitations under the License.\r\n*/\r\nexport class ValueFormatter {\r\n public static getNonNegativeValue(imput: any): number {\r\n let value = imput;\r\n\r\n if (typeof value !== \"number\") {\r\n value = Number(value);\r\n }\r\n\r\n if (isNaN(value)) {\r\n return 0;\r\n }\r\n\r\n return Math.max(0, value);\r\n }\r\n}\r\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,cAAc,CAAC;EACxB,OAAcC,mBAAmBA,CAACC,KAAU,EAAU;IAClD,IAAIC,KAAK,GAAGD,KAAK;IAEjB,IAAI,OAAOC,KAAK,KAAK,QAAQ,EAAE;MAC3BA,KAAK,GAAGC,MAAM,CAACD,KAAK,CAAC;IACzB;IAEA,IAAIE,KAAK,CAACF,KAAK,CAAC,EAAE;MACd,OAAO,CAAC;IACZ;IAEA,OAAOG,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEJ,KAAK,CAAC;EAC7B;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"valueFormatter.js","names":["ValueFormatter","getNonNegativeValue","imput","value","Number","isNaN","Math","max"],"sources":["../../../src/webrtc/stats/valueFormatter.ts"],"sourcesContent":["/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\nexport class ValueFormatter {\n public static getNonNegativeValue(imput: any): number {\n let value = imput;\n\n if (typeof value !== \"number\") {\n value = Number(value);\n }\n\n if (isNaN(value)) {\n return 0;\n }\n\n return Math.max(0, value);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,cAAc,CAAC;EACxB,OAAcC,mBAAmBA,CAACC,KAAU,EAAU;IAClD,IAAIC,KAAK,GAAGD,KAAK;IAEjB,IAAI,OAAOC,KAAK,KAAK,QAAQ,EAAE;MAC3BA,KAAK,GAAGC,MAAM,CAACD,KAAK,CAAC;IACzB;IAEA,IAAIE,KAAK,CAACF,KAAK,CAAC,EAAE;MACd,OAAO,CAAC;IACZ;IAEA,OAAOG,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEJ,KAAK,CAAC;EAC7B;AACJ","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ export interface XrplIdentityAccountData {
2
+ nftTokenId: string;
3
+ xrplAddress: string;
4
+ ipfsUri: string;
5
+ txHash: string;
6
+ mintedAt: string;
7
+ }
8
+ export interface XamanWalletAdapter {
9
+ getAddress(): Promise<string>;
10
+ signAndSubmit(tx: Record<string, unknown>): Promise<{
11
+ hash: string;
12
+ }>;
13
+ }
14
+ export interface XrplIdentityMintingConfig {
15
+ homeserverBaseUrl: string;
16
+ accessToken: string;
17
+ websocketUrl?: string;
18
+ network?: "mainnet" | "testnet";
19
+ xamanWallet: XamanWalletAdapter;
20
+ ipfsUriFactory?: (matrixUserId: string, xrplAddress: string) => Promise<string> | string;
21
+ }
22
+ export interface XrplIdentityMintResult extends XrplIdentityAccountData {
23
+ minted: boolean;
24
+ }
25
+ export declare function configureXrplIdentityMinting(config: Partial<XrplIdentityMintingConfig>): void;
26
+ export declare function setXamanWalletForXrplIdentity(xamanWallet: XamanWalletAdapter): void;
27
+ export declare function mintSoulboundIdentityNFT(matrixUserId: string): Promise<XrplIdentityMintResult | null>;
28
+ //# sourceMappingURL=identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/xrpl/identity.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,uBAAuB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IAC/B,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9B,aAAa,CAAC,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACzE;AAED,MAAM,WAAW,yBAAyB;IACtC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC,WAAW,EAAE,kBAAkB,CAAC;IAChC,cAAc,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;CAC5F;AAED,MAAM,WAAW,sBAAuB,SAAQ,uBAAuB;IACnE,MAAM,EAAE,OAAO,CAAC;CACnB;AAID,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,OAAO,CAAC,yBAAyB,CAAC,GAAG,IAAI,CAK7F;AAED,wBAAgB,6BAA6B,CAAC,WAAW,EAAE,kBAAkB,GAAG,IAAI,CAKnF;AAED,wBAAsB,wBAAwB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAiE3G"}