agora-rte-sdk 3.8.2 → 3.9.0-alpha

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 (266) hide show
  1. package/lib/constant.d.ts +9 -0
  2. package/lib/constant.js +13 -2
  3. package/lib/core/engine/ap-detector.d.ts +4 -4
  4. package/lib/core/engine/ap-detector.js +33 -20
  5. package/lib/core/engine/index.d.ts +19 -11
  6. package/lib/core/engine/index.js +132 -48
  7. package/lib/core/engine/plugin.js +2 -2
  8. package/lib/core/engine/type.d.ts +29 -0
  9. package/lib/core/engine/type.js +6 -0
  10. package/lib/core/media/camera.d.ts +8 -8
  11. package/lib/core/media/camera.js +38 -21
  12. package/lib/core/media/effect-enhancer.d.ts +5 -6
  13. package/lib/core/media/effect-enhancer.js +6 -16
  14. package/lib/core/media/index.d.ts +1 -155
  15. package/lib/core/media/index.js +44 -15
  16. package/lib/core/media/loopback.d.ts +3 -3
  17. package/lib/core/media/loopback.js +18 -11
  18. package/lib/core/media/microphone.d.ts +6 -6
  19. package/lib/core/media/microphone.js +32 -16
  20. package/lib/core/media/screen.d.ts +13 -5
  21. package/lib/core/media/screen.js +46 -16
  22. package/lib/core/media/type.d.ts +159 -2
  23. package/lib/core/media/type.js +4 -1
  24. package/lib/core/processor/message-handler.d.ts +4 -4
  25. package/lib/core/processor/message-handler.js +66 -28
  26. package/lib/core/processor/sequence-msg/data.d.ts +9 -7
  27. package/lib/core/processor/sequence-msg/data.js +26 -3
  28. package/lib/core/processor/struct.js +2 -2
  29. package/lib/core/processor/synchronizer/synchronizer-manager.d.ts +10 -0
  30. package/lib/core/processor/synchronizer/synchronizer-manager.js +43 -4
  31. package/lib/core/rtc/capture-enhancement.d.ts +4 -14
  32. package/lib/core/rtc/channel.d.ts +4 -4
  33. package/lib/core/rtc/constant.d.ts +1 -5
  34. package/lib/core/rtc/constant.js +2 -8
  35. package/lib/core/rtc/publish-pool.d.ts +20 -8
  36. package/lib/core/rtc/publish-pool.js +272 -3
  37. package/lib/core/rtc/publisher.d.ts +20 -14
  38. package/lib/core/rtc/publisher.js +151 -7
  39. package/lib/core/rtc/source-manager.d.ts +12 -2
  40. package/lib/core/rtc/subscriber.d.ts +14 -6
  41. package/lib/core/rtc/subscriber.js +171 -4
  42. package/lib/core/rtc/type.d.ts +6 -17
  43. package/lib/core/rtc/type.js +10 -26
  44. package/lib/core/rtm/channel.d.ts +3 -3
  45. package/lib/core/rtm/client.d.ts +4 -4
  46. package/lib/core/rtm/type.d.ts +1 -2
  47. package/lib/core/scene/helpers/ap-detect.d.ts +5 -0
  48. package/lib/core/scene/helpers/ap-detect.js +153 -0
  49. package/lib/core/scene/helpers/join.d.ts +8 -0
  50. package/lib/core/scene/helpers/join.js +105 -0
  51. package/lib/core/scene/helpers/rtc-event.d.ts +4 -0
  52. package/lib/core/scene/helpers/rtc-event.js +36 -0
  53. package/lib/core/scene/helpers/stream-publish-handlers.d.ts +15 -0
  54. package/lib/core/scene/helpers/stream-publish-handlers.js +121 -0
  55. package/lib/core/scene/helpers/stream-type.d.ts +7 -0
  56. package/lib/core/scene/{helper.js → helpers/stream-type.js} +3 -32
  57. package/lib/core/scene/index.d.ts +69 -187
  58. package/lib/core/scene/index.js +813 -1368
  59. package/lib/core/scene/local-user.d.ts +19 -85
  60. package/lib/core/scene/local-user.js +151 -152
  61. package/lib/core/scene/state-sync.d.ts +5 -7
  62. package/lib/core/scene/state-sync.js +20 -43
  63. package/lib/core/scene/stream-player.d.ts +9 -8
  64. package/lib/core/scene/stream-player.js +13 -10
  65. package/lib/core/scene/type.d.ts +359 -9
  66. package/lib/core/services/api.d.ts +9 -0
  67. package/lib/core/services/api.js +96 -58
  68. package/lib/core/services/auth-headers.d.ts +1 -0
  69. package/lib/core/services/auth-headers.js +5 -2
  70. package/lib/core/services/client.d.ts +3 -0
  71. package/lib/core/services/client.js +14 -2
  72. package/lib/core/services/type.d.ts +1 -0
  73. package/lib/core/type.d.ts +1 -0
  74. package/lib/core/type.js +6 -0
  75. package/lib/core/utilities/abort-manager.d.ts +18 -0
  76. package/lib/core/utilities/abort-manager.js +154 -0
  77. package/lib/core/utilities/error.d.ts +5 -36
  78. package/lib/core/utilities/error.js +23 -92
  79. package/lib/core/utilities/join-manager.d.ts +54 -0
  80. package/lib/core/utilities/join-manager.js +198 -0
  81. package/lib/core/utilities/logger.d.ts +2 -0
  82. package/lib/core/utilities/logger.js +8 -13
  83. package/lib/core/utilities/package-info.d.ts +1 -0
  84. package/lib/core/utilities/package-info.js +6 -4
  85. package/lib/core/utilities/property-extract.d.ts +2 -0
  86. package/lib/core/utilities/property-extract.js +79 -0
  87. package/lib/core/utilities/weak-invoker.d.ts +11 -0
  88. package/lib/core/utilities/weak-invoker.js +121 -0
  89. package/lib/imports.d.ts +6 -4
  90. package/lib/imports.js +42 -17
  91. package/lib/index.d.ts +7 -5
  92. package/lib/index.js +6 -5
  93. package/lib/plugin/restful-client/index.d.ts +1 -1
  94. package/lib/plugin/restful-client/index.js +11 -10
  95. package/lib/plugin/rtc/electron/camera-preview-task-manager.d.ts +14 -0
  96. package/lib/plugin/rtc/electron/camera-preview-task-manager.js +125 -0
  97. package/lib/plugin/rtc/electron/canvas-helper.d.ts +2 -2
  98. package/lib/plugin/rtc/electron/canvas-helper.js +15 -12
  99. package/lib/plugin/rtc/electron/canvas-tag-pool.d.ts +4 -4
  100. package/lib/plugin/rtc/electron/canvas-tag-pool.js +21 -13
  101. package/lib/plugin/rtc/electron/capture-enhancement.d.ts +3 -5
  102. package/lib/plugin/rtc/electron/capture-enhancement.js +45 -29
  103. package/lib/plugin/rtc/electron/channel.d.ts +13 -16
  104. package/lib/plugin/rtc/electron/channel.js +48 -57
  105. package/lib/plugin/rtc/electron/client.d.ts +8 -4
  106. package/lib/plugin/rtc/electron/client.js +107 -72
  107. package/lib/plugin/rtc/electron/constants.d.ts +12 -1
  108. package/lib/plugin/rtc/electron/constants.js +94 -26
  109. package/lib/plugin/rtc/electron/desc-type.js +1 -1
  110. package/lib/plugin/rtc/electron/downloadALD.js +9 -7
  111. package/lib/plugin/rtc/electron/publish-pool.d.ts +9 -17
  112. package/lib/plugin/rtc/electron/publish-pool.js +110 -256
  113. package/lib/plugin/rtc/electron/publisher.d.ts +9 -21
  114. package/lib/plugin/rtc/electron/publisher.js +80 -254
  115. package/lib/plugin/rtc/electron/source-manager.d.ts +22 -16
  116. package/lib/plugin/rtc/electron/source-manager.js +345 -215
  117. package/lib/plugin/rtc/electron/source-state-control/loopback-state-control.d.ts +1 -5
  118. package/lib/plugin/rtc/electron/source-state-control/loopback-state-control.js +2 -18
  119. package/lib/plugin/rtc/electron/source-state-control/media-state-control.d.ts +18 -0
  120. package/lib/plugin/rtc/electron/source-state-control/{camera-state-control.js → media-state-control.js} +50 -104
  121. package/lib/plugin/rtc/electron/source-state-control/microphone-state-control.d.ts +4 -10
  122. package/lib/plugin/rtc/electron/source-state-control/microphone-state-control.js +5 -26
  123. package/lib/plugin/rtc/electron/source-state-control/source-state-control.d.ts +30 -26
  124. package/lib/plugin/rtc/electron/source-state-control/source-state-control.js +68 -110
  125. package/lib/plugin/rtc/electron/subscriber.d.ts +7 -16
  126. package/lib/plugin/rtc/electron/subscriber.js +34 -112
  127. package/lib/plugin/rtc/electron/type.d.ts +7 -3
  128. package/lib/plugin/rtc/electron/type.js +8 -2
  129. package/lib/plugin/rtc/electron/utils.d.ts +9 -6
  130. package/lib/plugin/rtc/electron/utils.js +37 -9
  131. package/lib/plugin/rtc/web/assembler.d.ts +2 -1
  132. package/lib/plugin/rtc/web/assembler.js +9 -2
  133. package/lib/plugin/rtc/web/audio-player.d.ts +1 -1
  134. package/lib/plugin/rtc/web/audio-player.js +13 -8
  135. package/lib/plugin/rtc/web/canvas-helper.d.ts +1 -1
  136. package/lib/plugin/rtc/web/canvas-helper.js +3 -1
  137. package/lib/plugin/rtc/web/capture-enhancement.d.ts +3 -5
  138. package/lib/plugin/rtc/web/capture-enhancement.js +14 -20
  139. package/lib/plugin/rtc/web/channel.d.ts +17 -13
  140. package/lib/plugin/rtc/web/channel.js +221 -124
  141. package/lib/plugin/rtc/web/client.d.ts +5 -3
  142. package/lib/plugin/rtc/web/client.js +49 -21
  143. package/lib/plugin/rtc/web/convert-type.d.ts +3 -0
  144. package/lib/plugin/rtc/web/convert-type.js +22 -0
  145. package/lib/plugin/rtc/web/device.js +2 -3
  146. package/lib/plugin/rtc/web/effect-enabler.js +3 -3
  147. package/lib/plugin/rtc/web/extension.d.ts +1 -1
  148. package/lib/plugin/rtc/web/extension.js +4 -1
  149. package/lib/plugin/rtc/web/publish-pool.d.ts +4 -17
  150. package/lib/plugin/rtc/web/publish-pool.js +41 -194
  151. package/lib/plugin/rtc/web/publish.d.ts +9 -8
  152. package/lib/plugin/rtc/web/publish.js +71 -27
  153. package/lib/plugin/rtc/web/publisher.d.ts +20 -12
  154. package/lib/plugin/rtc/web/publisher.js +118 -69
  155. package/lib/plugin/rtc/web/source-manager.d.ts +1 -0
  156. package/lib/plugin/rtc/web/source-manager.js +15 -9
  157. package/lib/plugin/rtc/web/subscribe.d.ts +10 -10
  158. package/lib/plugin/rtc/web/subscribe.js +26 -14
  159. package/lib/plugin/rtc/web/subscriber.d.ts +5 -10
  160. package/lib/plugin/rtc/web/subscriber.js +21 -82
  161. package/lib/plugin/rtc/web/track-control/camera.d.ts +1 -1
  162. package/lib/plugin/rtc/web/track-control/camera.js +4 -1
  163. package/lib/plugin/rtc/web/track-control/screen.d.ts +1 -1
  164. package/lib/plugin/rtc/web/track-control/screen.js +4 -1
  165. package/lib/plugin/rtm/channel.d.ts +8 -5
  166. package/lib/plugin/rtm/channel.js +113 -49
  167. package/lib/plugin/rtm/client.d.ts +10 -5
  168. package/lib/plugin/rtm/client.js +120 -61
  169. package/lib/plugin/rtm/utils.js +1 -1
  170. package/lib/plugin/synchronizer-worker/worker.js +71 -7
  171. package/lib/type.d.ts +0 -5
  172. package/lib-es/constant.js +12 -1
  173. package/lib-es/core/engine/ap-detector.js +36 -22
  174. package/lib-es/core/engine/index.js +134 -50
  175. package/lib-es/core/engine/plugin.js +1 -1
  176. package/lib-es/core/engine/type.js +1 -0
  177. package/lib-es/core/media/camera.js +38 -22
  178. package/lib-es/core/media/effect-enhancer.js +6 -16
  179. package/lib-es/core/media/index.js +44 -17
  180. package/lib-es/core/media/loopback.js +18 -12
  181. package/lib-es/core/media/microphone.js +32 -17
  182. package/lib-es/core/media/screen.js +46 -17
  183. package/lib-es/core/media/type.js +5 -1
  184. package/lib-es/core/processor/message-handler.js +44 -6
  185. package/lib-es/core/processor/sequence-msg/data.js +27 -4
  186. package/lib-es/core/processor/struct.js +1 -1
  187. package/lib-es/core/processor/synchronizer/synchronizer-manager.js +43 -4
  188. package/lib-es/core/rtc/constant.js +1 -7
  189. package/lib-es/core/rtc/publish-pool.js +274 -4
  190. package/lib-es/core/rtc/publisher.js +153 -9
  191. package/lib-es/core/rtc/subscriber.js +172 -4
  192. package/lib-es/core/rtc/type.js +9 -25
  193. package/lib-es/core/scene/helpers/ap-detect.js +143 -0
  194. package/lib-es/core/scene/helpers/join.js +97 -0
  195. package/lib-es/core/scene/helpers/rtc-event.js +29 -0
  196. package/lib-es/core/scene/helpers/stream-publish-handlers.js +112 -0
  197. package/lib-es/core/scene/helpers/stream-type.js +43 -0
  198. package/lib-es/core/scene/index.js +817 -1373
  199. package/lib-es/core/scene/local-user.js +144 -146
  200. package/lib-es/core/scene/state-sync.js +19 -42
  201. package/lib-es/core/scene/stream-player.js +13 -10
  202. package/lib-es/core/services/api.js +97 -59
  203. package/lib-es/core/services/auth-headers.js +4 -1
  204. package/lib-es/core/services/client.js +13 -1
  205. package/lib-es/core/type.js +1 -0
  206. package/lib-es/core/utilities/abort-manager.js +146 -0
  207. package/lib-es/core/utilities/error.js +22 -91
  208. package/lib-es/core/utilities/join-manager.js +190 -0
  209. package/lib-es/core/utilities/logger.js +8 -13
  210. package/lib-es/core/utilities/package-info.js +5 -3
  211. package/lib-es/core/utilities/property-extract.js +71 -0
  212. package/lib-es/core/utilities/weak-invoker.js +113 -0
  213. package/lib-es/imports.js +9 -5
  214. package/lib-es/index.js +3 -2
  215. package/lib-es/plugin/restful-client/index.js +5 -4
  216. package/lib-es/plugin/rtc/electron/camera-preview-task-manager.js +117 -0
  217. package/lib-es/plugin/rtc/electron/canvas-helper.js +15 -12
  218. package/lib-es/plugin/rtc/electron/canvas-tag-pool.js +21 -13
  219. package/lib-es/plugin/rtc/electron/capture-enhancement.js +46 -30
  220. package/lib-es/plugin/rtc/electron/channel.js +49 -58
  221. package/lib-es/plugin/rtc/electron/client.js +107 -72
  222. package/lib-es/plugin/rtc/electron/constants.js +93 -25
  223. package/lib-es/plugin/rtc/electron/desc-type.js +1 -1
  224. package/lib-es/plugin/rtc/electron/downloadALD.js +10 -8
  225. package/lib-es/plugin/rtc/electron/publish-pool.js +111 -257
  226. package/lib-es/plugin/rtc/electron/publisher.js +51 -226
  227. package/lib-es/plugin/rtc/electron/source-manager.js +348 -218
  228. package/lib-es/plugin/rtc/electron/source-state-control/loopback-state-control.js +2 -18
  229. package/lib-es/plugin/rtc/electron/source-state-control/{camera-state-control.js → media-state-control.js} +64 -118
  230. package/lib-es/plugin/rtc/electron/source-state-control/microphone-state-control.js +5 -26
  231. package/lib-es/plugin/rtc/electron/source-state-control/source-state-control.js +69 -109
  232. package/lib-es/plugin/rtc/electron/subscriber.js +38 -116
  233. package/lib-es/plugin/rtc/electron/type.js +7 -1
  234. package/lib-es/plugin/rtc/electron/utils.js +37 -9
  235. package/lib-es/plugin/rtc/web/assembler.js +9 -2
  236. package/lib-es/plugin/rtc/web/audio-player.js +14 -9
  237. package/lib-es/plugin/rtc/web/canvas-helper.js +3 -1
  238. package/lib-es/plugin/rtc/web/capture-enhancement.js +14 -20
  239. package/lib-es/plugin/rtc/web/channel.js +234 -137
  240. package/lib-es/plugin/rtc/web/client.js +50 -22
  241. package/lib-es/plugin/rtc/web/convert-type.js +15 -0
  242. package/lib-es/plugin/rtc/web/device.js +3 -4
  243. package/lib-es/plugin/rtc/web/effect-enabler.js +3 -3
  244. package/lib-es/plugin/rtc/web/extension.js +4 -1
  245. package/lib-es/plugin/rtc/web/publish-pool.js +45 -198
  246. package/lib-es/plugin/rtc/web/publish.js +71 -27
  247. package/lib-es/plugin/rtc/web/publisher.js +122 -72
  248. package/lib-es/plugin/rtc/web/source-manager.js +16 -10
  249. package/lib-es/plugin/rtc/web/subscribe.js +26 -14
  250. package/lib-es/plugin/rtc/web/subscriber.js +25 -86
  251. package/lib-es/plugin/rtc/web/track-control/camera.js +4 -1
  252. package/lib-es/plugin/rtc/web/track-control/screen.js +4 -1
  253. package/lib-es/plugin/rtm/channel.js +112 -48
  254. package/lib-es/plugin/rtm/client.js +116 -57
  255. package/lib-es/plugin/rtm/utils.js +1 -1
  256. package/lib-es/plugin/synchronizer-worker/worker.js +71 -7
  257. package/package.json +4 -4
  258. package/lib/core/scene/helper.d.ts +0 -10
  259. package/lib/plugin/rtc/electron/source-state-control/camera-state-control.d.ts +0 -28
  260. package/lib/plugin/rtc/electron/source-state-control/screen-state-control.d.ts +0 -31
  261. package/lib/plugin/rtc/electron/source-state-control/screen-state-control.js +0 -213
  262. package/lib/plugin/rtc/electron/source-state-control/window-state-control.d.ts +0 -31
  263. package/lib/plugin/rtc/electron/source-state-control/window-state-control.js +0 -213
  264. package/lib-es/core/scene/helper.js +0 -72
  265. package/lib-es/plugin/rtc/electron/source-state-control/screen-state-control.js +0 -206
  266. package/lib-es/plugin/rtc/electron/source-state-control/window-state-control.js +0 -206
@@ -1,13 +1,180 @@
1
1
  "use strict";
2
2
 
3
+ require("core-js/modules/es.symbol.js");
4
+ require("core-js/modules/es.symbol.description.js");
5
+ require("core-js/modules/es.symbol.to-primitive.js");
6
+ require("core-js/modules/es.error.cause.js");
7
+ require("core-js/modules/es.error.to-string.js");
8
+ require("core-js/modules/es.array.is-array.js");
9
+ require("core-js/modules/es.array.push.js");
10
+ require("core-js/modules/es.date.to-primitive.js");
11
+ require("core-js/modules/es.function.bind.js");
12
+ require("core-js/modules/es.function.name.js");
13
+ require("core-js/modules/es.number.constructor.js");
14
+ require("core-js/modules/es.object.create.js");
3
15
  require("core-js/modules/es.object.define-property.js");
16
+ require("core-js/modules/es.object.get-own-property-descriptor.js");
17
+ require("core-js/modules/esnext.function.metadata.js");
18
+ require("core-js/modules/esnext.symbol.metadata.js");
4
19
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
20
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
21
  Object.defineProperty(exports, "__esModule", {
6
22
  value: true
7
23
  });
8
24
  exports.AgoraRtcChannelSubscriber = void 0;
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
25
+ require("core-js/modules/es.array.from.js");
26
+ require("core-js/modules/es.array.iterator.js");
27
+ require("core-js/modules/es.map.js");
28
+ require("core-js/modules/es.object.to-string.js");
29
+ require("core-js/modules/es.string.iterator.js");
30
+ require("core-js/modules/esnext.map.delete-all.js");
31
+ require("core-js/modules/esnext.map.emplace.js");
32
+ require("core-js/modules/esnext.map.every.js");
33
+ require("core-js/modules/esnext.map.filter.js");
34
+ require("core-js/modules/esnext.map.find.js");
35
+ require("core-js/modules/esnext.map.find-key.js");
36
+ require("core-js/modules/esnext.map.includes.js");
37
+ require("core-js/modules/esnext.map.key-of.js");
38
+ require("core-js/modules/esnext.map.map-keys.js");
39
+ require("core-js/modules/esnext.map.map-values.js");
40
+ require("core-js/modules/esnext.map.merge.js");
41
+ require("core-js/modules/esnext.map.reduce.js");
42
+ require("core-js/modules/esnext.map.some.js");
43
+ require("core-js/modules/esnext.map.update.js");
44
+ require("core-js/modules/web.dom-collections.iterator.js");
45
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
46
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
- var AgoraRtcChannelSubscriber = exports.AgoraRtcChannelSubscriber = /*#__PURE__*/(0, _createClass2["default"])(function AgoraRtcChannelSubscriber() {
12
- (0, _classCallCheck2["default"])(this, AgoraRtcChannelSubscriber);
13
- });
47
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
48
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
49
+ var _logger = require("../utilities/logger");
50
+ var _imports = require("../../imports");
51
+ var _AgoraRtcChannelSubscriber;
52
+ var _initProto, _subscribeRemoteVideoStreamDecs, _unsubscribeRemoteVideoStreamDecs, _subscribeRemoteAudioStreamDecs, _unsubscribeRemoteAudioStreamDecs, _ref;
53
+ function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function set(e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O["static"] = l, O["private"] = f, f ? 2 === o ? k = function k(e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function k(e) { return e[n]; }, (o < 2 || 4 === o) && (F = function F(e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == _typeof(P) && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol["for"]("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol["for"]("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function s(t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
54
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
55
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
56
+ function _setFunctionName(e, t, n) { "symbol" == _typeof(t) && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
57
+ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? _typeof(e) : "null")); return e; }
58
+ _ref = (_subscribeRemoteVideoStreamDecs = (0, _imports.trace)(['streamId', 'streamType']), _unsubscribeRemoteVideoStreamDecs = (0, _imports.trace)(['streamId']), _subscribeRemoteAudioStreamDecs = (0, _imports.trace)(['streamId']), _unsubscribeRemoteAudioStreamDecs = (0, _imports.trace)(['streamId']), "logger");
59
+ var AgoraRtcChannelSubscriber = exports.AgoraRtcChannelSubscriber = /*#__PURE__*/function () {
60
+ function AgoraRtcChannelSubscriber() {
61
+ (0, _classCallCheck2["default"])(this, AgoraRtcChannelSubscriber);
62
+ (0, _defineProperty2["default"])(this, _ref, (_initProto(this), (0, _logger.createLogger)({
63
+ prefix: 'AgoraRtcChannelSubscriber'
64
+ })));
65
+ (0, _defineProperty2["default"])(this, "_videoMapping", new Map());
66
+ (0, _defineProperty2["default"])(this, "_audioMapping", new Map());
67
+ (0, _defineProperty2["default"])(this, "_isPause", false);
68
+ }
69
+ return (0, _createClass2["default"])(AgoraRtcChannelSubscriber, [{
70
+ key: "subscribeRemoteVideoStream",
71
+ value:
72
+ /**
73
+ * Subscribes to a remote video stream.
74
+ * @param streamId The ID of the stream.
75
+ * @param streamType The type of the stream.
76
+ * @returns The result of the operation.
77
+ */
78
+ function subscribeRemoteVideoStream(streamId, streamType) {
79
+ this._videoMapping.set(streamId, streamType);
80
+ if (this._isPause) {
81
+ return 0;
82
+ }
83
+ return this._subscribeRemoteVideoStream(streamId, streamType);
84
+ }
85
+
86
+ /**
87
+ * Unsubscribes from a remote video stream.
88
+ * @param streamId The ID of the stream.
89
+ * @returns The result of the operation.
90
+ */
91
+ }, {
92
+ key: "unsubscribeRemoteVideoStream",
93
+ value: function unsubscribeRemoteVideoStream(streamId) {
94
+ this._videoMapping["delete"](streamId);
95
+ return this._unsubscribeRemoteVideoStream(streamId);
96
+ }
97
+
98
+ /**
99
+ * Subscribes to a remote audio stream.
100
+ * @param streamId The ID of the stream.
101
+ * @returns The result of the operation.
102
+ */
103
+ }, {
104
+ key: "subscribeRemoteAudioStream",
105
+ value: function subscribeRemoteAudioStream(streamId) {
106
+ this._audioMapping.set(streamId, true);
107
+ if (this._isPause) {
108
+ return 0;
109
+ }
110
+ return this._subscribeRemoteAudioStream(streamId);
111
+ }
112
+
113
+ /**
114
+ * Unsubscribes from a remote audio stream.
115
+ * @param streamId The ID of the stream.
116
+ * @returns The result of the operation.
117
+ */
118
+ }, {
119
+ key: "unsubscribeRemoteAudioStream",
120
+ value: function unsubscribeRemoteAudioStream(streamId) {
121
+ this._audioMapping["delete"](streamId);
122
+ return this._unsubscribeRemoteAudioStream(streamId);
123
+ }
124
+
125
+ /**
126
+ * resubscribe all remote streams
127
+ * @returns The result of the operation.
128
+ */
129
+ }, {
130
+ key: "resume",
131
+ value: function resume() {
132
+ if (this._isPause === false) {
133
+ return 0;
134
+ }
135
+ this._isPause = false;
136
+ var audioSubscribeStateMapKeys = Array.from(this._audioMapping.keys());
137
+ this.logger.info('resume all remote audio streams', Array.from(audioSubscribeStateMapKeys).length);
138
+ for (var i = 0; i < audioSubscribeStateMapKeys.length; i++) {
139
+ var _streamId = audioSubscribeStateMapKeys[i];
140
+ this._subscribeRemoteAudioStream(_streamId);
141
+ }
142
+ var videoSubscribeStateMapKeys = Array.from(this._videoMapping.keys());
143
+ this.logger.info('resume all remote video streams', videoSubscribeStateMapKeys.length);
144
+ for (var _i = 0; _i < videoSubscribeStateMapKeys.length; _i++) {
145
+ var _streamId2 = videoSubscribeStateMapKeys[_i];
146
+ var _streamType = this._videoMapping.get(_streamId2);
147
+ if ((0, _imports.isNumber)(_streamType)) {
148
+ this._subscribeRemoteVideoStream(_streamId2, _streamType);
149
+ }
150
+ }
151
+ return 0;
152
+ }
153
+ }, {
154
+ key: "pause",
155
+ value: function pause() {
156
+ if (this._isPause === true) {
157
+ return 0;
158
+ }
159
+ this._isPause = true;
160
+ var audioSubscribeStateMapKeys = Array.from(this._audioMapping.keys());
161
+ this.logger.info('pause all remote audio streams', audioSubscribeStateMapKeys.length);
162
+ for (var i = 0; i < audioSubscribeStateMapKeys.length; i++) {
163
+ var _streamId3 = audioSubscribeStateMapKeys[i];
164
+ this._unsubscribeRemoteAudioStream(_streamId3);
165
+ }
166
+ var videoSubscribeStateMapKeys = Array.from(this._videoMapping.keys());
167
+ this.logger.info('pause all remote video streams', videoSubscribeStateMapKeys.length);
168
+ for (var _i2 = 0; _i2 < videoSubscribeStateMapKeys.length; _i2++) {
169
+ var _streamId4 = videoSubscribeStateMapKeys[_i2];
170
+ this._unsubscribeRemoteVideoStream(_streamId4);
171
+ }
172
+ return 0;
173
+ }
174
+ }]);
175
+ }();
176
+ _AgoraRtcChannelSubscriber = AgoraRtcChannelSubscriber;
177
+ var _applyDecs$e = _applyDecs(_AgoraRtcChannelSubscriber, [[_subscribeRemoteVideoStreamDecs, 2, "subscribeRemoteVideoStream"], [_unsubscribeRemoteVideoStreamDecs, 2, "unsubscribeRemoteVideoStream"], [_subscribeRemoteAudioStreamDecs, 2, "subscribeRemoteAudioStream"], [_unsubscribeRemoteAudioStreamDecs, 2, "unsubscribeRemoteAudioStream"], [_imports.bound, 2, "resume"], [_imports.bound, 2, "pause"]], []).e;
178
+ var _applyDecs$e2 = (0, _slicedToArray2["default"])(_applyDecs$e, 1);
179
+ _initProto = _applyDecs$e2[0];
180
+ _applyDecs$e;
@@ -67,7 +67,7 @@ export declare enum AgoraRtcMediaSourceState {
67
67
  OPEN = 1
68
68
  }
69
69
  export declare enum AgoraRtcConnectionState {
70
- IDLE = 0,
70
+ DISCONNECTED = 0,
71
71
  CONNECTING = 1,
72
72
  CONNECTED = 2,
73
73
  RECONNECTING = 3,
@@ -252,7 +252,7 @@ export declare enum AgoraRtcLatencyLevelType {
252
252
  * AI denoise level
253
253
  */
254
254
  export declare enum AgoraRtcAiDenoiseLevel {
255
- AUTO = 0,
255
+ NONE = 0,
256
256
  LOW = 1,
257
257
  MEDIUM = 2,
258
258
  HIGH = 3
@@ -383,6 +383,9 @@ export type AgoraRtcStreamPublishPoolObserver = {
383
383
  onConnectionJoinChannel?(item: AgoraRtcStreamPublishPoolItem): void;
384
384
  onUpdateChannelOptions?(item: AgoraRtcStreamPublishPoolItem): void;
385
385
  onConnectionLeaveChannel?(item: AgoraRtcStreamPublishPoolItem): void;
386
+ onConnectionSetVideoEncoderConfig?(item: AgoraRtcStreamPublishPoolItem): void;
387
+ onConnectionEnableLoopback?(item: AgoraRtcStreamPublishPoolItem): void;
388
+ onConnectionDisableLoopback?(item: AgoraRtcStreamPublishPoolItem): void;
386
389
  };
387
390
  export interface AgoraRtcStreamPublishPoolItem {
388
391
  videoHasPublished: boolean;
@@ -409,21 +412,7 @@ export declare enum AgoraRtcRenderSourceType {
409
412
  REMOTE_STREAM = 3,
410
413
  LOCAL_WINDOW = 4
411
414
  }
412
- export declare enum AgoraRtcCameraSourceIndex {
413
- UNDEFINED = -1,
414
- PRIMARY = 0,
415
- SECONDARY = 1,
416
- THIRD = 2,
417
- FOURTH = 3
418
- }
419
- export declare enum AgoraRtcScreenSourceIndex {
420
- UNDEFINED = -1,
421
- PRIMARY = 0,
422
- SECONDARY = 1,
423
- THIRD = 2,
424
- FOURTH = 3
425
- }
426
- export declare enum AgoraRtcWindowSourceIndex {
415
+ export declare enum AgoraRtcMediaSourceIndex {
427
416
  UNDEFINED = -1,
428
417
  PRIMARY = 0,
429
418
  SECONDARY = 1,
@@ -4,7 +4,7 @@ require("core-js/modules/es.object.define-property.js");
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.AgoraRteVideoOutputOrientationMode = exports.AgoraRtcWindowSourceIndex = exports.AgoraRtcVideoStreamType = exports.AgoraRtcVideoSourceType = exports.AgoraRtcVideoOrientation = exports.AgoraRtcScreenSourceIndex = exports.AgoraRtcScreenScenarioType = exports.AgoraRtcScreenCaptureType = exports.AgoraRtcRenderSourceType = exports.AgoraRtcRenderResultType = exports.AgoraRtcRenderMode = exports.AgoraRtcRegion = exports.AgoraRtcNetworkQuality = exports.AgoraRtcMediaSourceState = exports.AgoraRtcLatencyLevelType = exports.AgoraRtcEncryptionMode = exports.AgoraRtcDeviceType = exports.AgoraRtcDegradationPreference = exports.AgoraRtcConnectionState = exports.AgoraRtcChannelProfile = exports.AgoraRtcCapability = exports.AgoraRtcCameraSourceIndex = exports.AgoraRtcCameraPosition = exports.AgoraRtcAudioSourceType = exports.AgoraRtcAudioOutputRouting = exports.AgoraRtcAiDenoiseLevel = void 0;
7
+ exports.AgoraRteVideoOutputOrientationMode = exports.AgoraRtcVideoStreamType = exports.AgoraRtcVideoSourceType = exports.AgoraRtcVideoOrientation = exports.AgoraRtcScreenScenarioType = exports.AgoraRtcScreenCaptureType = exports.AgoraRtcRenderSourceType = exports.AgoraRtcRenderResultType = exports.AgoraRtcRenderMode = exports.AgoraRtcRegion = exports.AgoraRtcNetworkQuality = exports.AgoraRtcMediaSourceState = exports.AgoraRtcMediaSourceIndex = exports.AgoraRtcLatencyLevelType = exports.AgoraRtcEncryptionMode = exports.AgoraRtcDeviceType = exports.AgoraRtcDegradationPreference = exports.AgoraRtcConnectionState = exports.AgoraRtcChannelProfile = exports.AgoraRtcCapability = exports.AgoraRtcCameraPosition = exports.AgoraRtcAudioSourceType = exports.AgoraRtcAudioOutputRouting = exports.AgoraRtcAiDenoiseLevel = void 0;
8
8
  // todo
9
9
  // export type { IBaseProcessor, IExtension } from 'agora-rte-extension';
10
10
  var AgoraRtcRenderMode = exports.AgoraRtcRenderMode = /*#__PURE__*/function (AgoraRtcRenderMode) {
@@ -50,7 +50,7 @@ var AgoraRtcMediaSourceState = exports.AgoraRtcMediaSourceState = /*#__PURE__*/f
50
50
  return AgoraRtcMediaSourceState;
51
51
  }({});
52
52
  var AgoraRtcConnectionState = exports.AgoraRtcConnectionState = /*#__PURE__*/function (AgoraRtcConnectionState) {
53
- AgoraRtcConnectionState[AgoraRtcConnectionState["IDLE"] = 0] = "IDLE";
53
+ AgoraRtcConnectionState[AgoraRtcConnectionState["DISCONNECTED"] = 0] = "DISCONNECTED";
54
54
  AgoraRtcConnectionState[AgoraRtcConnectionState["CONNECTING"] = 1] = "CONNECTING";
55
55
  AgoraRtcConnectionState[AgoraRtcConnectionState["CONNECTED"] = 2] = "CONNECTED";
56
56
  AgoraRtcConnectionState[AgoraRtcConnectionState["RECONNECTING"] = 3] = "RECONNECTING";
@@ -107,7 +107,7 @@ var AgoraRtcLatencyLevelType = exports.AgoraRtcLatencyLevelType = /*#__PURE__*/f
107
107
  * AI denoise level
108
108
  */
109
109
  var AgoraRtcAiDenoiseLevel = exports.AgoraRtcAiDenoiseLevel = /*#__PURE__*/function (AgoraRtcAiDenoiseLevel) {
110
- AgoraRtcAiDenoiseLevel[AgoraRtcAiDenoiseLevel["AUTO"] = 0] = "AUTO";
110
+ AgoraRtcAiDenoiseLevel[AgoraRtcAiDenoiseLevel["NONE"] = 0] = "NONE";
111
111
  AgoraRtcAiDenoiseLevel[AgoraRtcAiDenoiseLevel["LOW"] = 1] = "LOW";
112
112
  AgoraRtcAiDenoiseLevel[AgoraRtcAiDenoiseLevel["MEDIUM"] = 2] = "MEDIUM";
113
113
  AgoraRtcAiDenoiseLevel[AgoraRtcAiDenoiseLevel["HIGH"] = 3] = "HIGH";
@@ -160,29 +160,13 @@ var AgoraRtcRenderSourceType = exports.AgoraRtcRenderSourceType = /*#__PURE__*/f
160
160
  AgoraRtcRenderSourceType[AgoraRtcRenderSourceType["LOCAL_WINDOW"] = 4] = "LOCAL_WINDOW";
161
161
  return AgoraRtcRenderSourceType;
162
162
  }({});
163
- var AgoraRtcCameraSourceIndex = exports.AgoraRtcCameraSourceIndex = /*#__PURE__*/function (AgoraRtcCameraSourceIndex) {
164
- AgoraRtcCameraSourceIndex[AgoraRtcCameraSourceIndex["UNDEFINED"] = -1] = "UNDEFINED";
165
- AgoraRtcCameraSourceIndex[AgoraRtcCameraSourceIndex["PRIMARY"] = 0] = "PRIMARY";
166
- AgoraRtcCameraSourceIndex[AgoraRtcCameraSourceIndex["SECONDARY"] = 1] = "SECONDARY";
167
- AgoraRtcCameraSourceIndex[AgoraRtcCameraSourceIndex["THIRD"] = 2] = "THIRD";
168
- AgoraRtcCameraSourceIndex[AgoraRtcCameraSourceIndex["FOURTH"] = 3] = "FOURTH";
169
- return AgoraRtcCameraSourceIndex;
170
- }({});
171
- var AgoraRtcScreenSourceIndex = exports.AgoraRtcScreenSourceIndex = /*#__PURE__*/function (AgoraRtcScreenSourceIndex) {
172
- AgoraRtcScreenSourceIndex[AgoraRtcScreenSourceIndex["UNDEFINED"] = -1] = "UNDEFINED";
173
- AgoraRtcScreenSourceIndex[AgoraRtcScreenSourceIndex["PRIMARY"] = 0] = "PRIMARY";
174
- AgoraRtcScreenSourceIndex[AgoraRtcScreenSourceIndex["SECONDARY"] = 1] = "SECONDARY";
175
- AgoraRtcScreenSourceIndex[AgoraRtcScreenSourceIndex["THIRD"] = 2] = "THIRD";
176
- AgoraRtcScreenSourceIndex[AgoraRtcScreenSourceIndex["FOURTH"] = 3] = "FOURTH";
177
- return AgoraRtcScreenSourceIndex;
178
- }({});
179
- var AgoraRtcWindowSourceIndex = exports.AgoraRtcWindowSourceIndex = /*#__PURE__*/function (AgoraRtcWindowSourceIndex) {
180
- AgoraRtcWindowSourceIndex[AgoraRtcWindowSourceIndex["UNDEFINED"] = -1] = "UNDEFINED";
181
- AgoraRtcWindowSourceIndex[AgoraRtcWindowSourceIndex["PRIMARY"] = 0] = "PRIMARY";
182
- AgoraRtcWindowSourceIndex[AgoraRtcWindowSourceIndex["SECONDARY"] = 1] = "SECONDARY";
183
- AgoraRtcWindowSourceIndex[AgoraRtcWindowSourceIndex["THIRD"] = 2] = "THIRD";
184
- AgoraRtcWindowSourceIndex[AgoraRtcWindowSourceIndex["FOURTH"] = 3] = "FOURTH";
185
- return AgoraRtcWindowSourceIndex;
163
+ var AgoraRtcMediaSourceIndex = exports.AgoraRtcMediaSourceIndex = /*#__PURE__*/function (AgoraRtcMediaSourceIndex) {
164
+ AgoraRtcMediaSourceIndex[AgoraRtcMediaSourceIndex["UNDEFINED"] = -1] = "UNDEFINED";
165
+ AgoraRtcMediaSourceIndex[AgoraRtcMediaSourceIndex["PRIMARY"] = 0] = "PRIMARY";
166
+ AgoraRtcMediaSourceIndex[AgoraRtcMediaSourceIndex["SECONDARY"] = 1] = "SECONDARY";
167
+ AgoraRtcMediaSourceIndex[AgoraRtcMediaSourceIndex["THIRD"] = 2] = "THIRD";
168
+ AgoraRtcMediaSourceIndex[AgoraRtcMediaSourceIndex["FOURTH"] = 3] = "FOURTH";
169
+ return AgoraRtcMediaSourceIndex;
186
170
  }({});
187
171
  var AgoraRteVideoOutputOrientationMode = exports.AgoraRteVideoOutputOrientationMode = /*#__PURE__*/function (AgoraRteVideoOutputOrientationMode) {
188
172
  AgoraRteVideoOutputOrientationMode[AgoraRteVideoOutputOrientationMode["ADAPTIVE"] = 0] = "ADAPTIVE";
@@ -7,18 +7,18 @@ export declare abstract class AgoraRtmChannelClient {
7
7
  * Joins the channel.
8
8
  * @returns A promise that resolves when the channel has been joined.
9
9
  */
10
- abstract join(): Promise<void>;
10
+ abstract join(): Promise<number>;
11
11
  /**
12
12
  * Sends a message to the channel.
13
13
  * @param content - The content of the message to send.
14
14
  * @returns A promise that resolves when the message has been sent.
15
15
  */
16
- abstract sendMessage(content: string): Promise<void>;
16
+ abstract sendMessage(content: string): Promise<number>;
17
17
  /**
18
18
  * Leaves the channel.
19
19
  * @returns A promise that resolves when the channel has been left.
20
20
  */
21
- abstract leave(): Promise<void>;
21
+ abstract leave(): Promise<number>;
22
22
  /**
23
23
  * Adds an observer to the channel.
24
24
  * @param observer - The observer to add.
@@ -18,12 +18,12 @@ export declare abstract class AgoraRtmClient {
18
18
  * @param uid The user ID.
19
19
  * @returns A promise that resolves when the login is successful.
20
20
  */
21
- abstract login(token: string, uid: string): Promise<void>;
21
+ abstract login(token: string, uid: string): Promise<number>;
22
22
  /**
23
23
  * Logs out of the Agora RTM system.
24
24
  * @returns A promise that resolves when the logout is successful.
25
25
  */
26
- abstract logout(): Promise<void>;
26
+ abstract logout(): Promise<number>;
27
27
  /**
28
28
  * Creates a channel client.
29
29
  * @param channelId The ID of the channel.
@@ -47,13 +47,13 @@ export declare abstract class AgoraRtmClient {
47
47
  * @param receiverId The ID of the peer to send the message to.
48
48
  * @returns A promise that resolves when the message has been sent.
49
49
  */
50
- abstract sendPeerMessage(message: string, guaranteedDelivery: boolean, receiverId: string): Promise<void>;
50
+ abstract sendPeerMessage(message: string, guaranteedDelivery: boolean, receiverId: string): Promise<number>;
51
51
  /**
52
52
  * Renews the user token.
53
53
  * @param token The token to renew.
54
54
  * @returns A promise that resolves when the token has been renewed.
55
55
  */
56
- abstract renewToken(token: string): void;
56
+ abstract renewToken(token: string): Promise<number>;
57
57
  /**
58
58
  * Sets the parameters for the RTM client.
59
59
  * @param parameters The parameters to set.
@@ -5,9 +5,8 @@ export declare enum AgoraRtmConnectionState {
5
5
  CONNECTED = 3,
6
6
  ABORTED = 4
7
7
  }
8
- export type AgoraRtmConnectionChangeReason = string;
9
8
  export interface AgoraRtmClientObserver {
10
- onConnectionStateUpdated?(state: AgoraRtmConnectionState, reason: AgoraRtmConnectionChangeReason): void;
9
+ onConnectionStateUpdated?(state: AgoraRtmConnectionState): void;
11
10
  onPeerMessageReceived?(peerId: string, message: string): void;
12
11
  onTokenWillExpire?(): void;
13
12
  }
@@ -0,0 +1,5 @@
1
+ import type { Logger } from '../../../imports';
2
+ import { AgoraRteApDetector } from '../../engine/ap-detector';
3
+ export declare function maybeDetectAp(apDetector: AgoraRteApDetector): Promise<void>;
4
+ export declare function maybeRedetectAp(apDetector: AgoraRteApDetector): Promise<void>;
5
+ export declare const detectAp: (logger: Logger, apDetector: AgoraRteApDetector) => Promise<void>;
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.object.define-property.js");
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.detectAp = void 0;
9
+ exports.maybeDetectAp = maybeDetectAp;
10
+ exports.maybeRedetectAp = maybeRedetectAp;
11
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
12
+ require("core-js/modules/es.array.concat.js");
13
+ require("core-js/modules/es.object.to-string.js");
14
+ require("core-js/modules/es.promise.js");
15
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
16
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
17
+ var _imports = require("../../../imports");
18
+ var _error = require("../../utilities/error");
19
+ var createDetectError = function createDetectError() {
20
+ return (0, _error.generateRteClientErrorNew)(_imports.ErrorModuleCode.RTE_AP_DETECTOR, _imports.DetailErrorCode.AP_DETECT_FAILED, 'failed to detect AP');
21
+ };
22
+ function runDetection(_x, _x2) {
23
+ return _runDetection.apply(this, arguments);
24
+ }
25
+ function _runDetection() {
26
+ _runDetection = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(apDetector, mode) {
27
+ return _regenerator["default"].wrap(function (_context2) {
28
+ while (1) switch (_context2.prev = _context2.next) {
29
+ case 0:
30
+ return _context2.abrupt("return", new Promise(function (resolve, reject) {
31
+ var observer = mode === 'start' ? {
32
+ onDetectionSuccess: function onDetectionSuccess() {
33
+ apDetector.removeObserver(observer);
34
+ resolve();
35
+ },
36
+ onDetectionFailure: function onDetectionFailure() {
37
+ apDetector.removeObserver(observer);
38
+ reject(createDetectError());
39
+ }
40
+ } : {
41
+ onRedetectionSuccess: function onRedetectionSuccess() {
42
+ apDetector.removeObserver(observer);
43
+ resolve();
44
+ },
45
+ onRedetectionFailure: function onRedetectionFailure() {
46
+ apDetector.removeObserver(observer);
47
+ reject(createDetectError());
48
+ }
49
+ };
50
+ apDetector.addObserver(observer);
51
+ if (mode === 'start') {
52
+ apDetector.start()["catch"](function (err) {
53
+ apDetector.removeObserver(observer);
54
+ reject(err !== null && err !== void 0 ? err : createDetectError());
55
+ });
56
+ } else {
57
+ apDetector.restart()["catch"](function (err) {
58
+ apDetector.removeObserver(observer);
59
+ reject(err !== null && err !== void 0 ? err : createDetectError());
60
+ });
61
+ }
62
+ }));
63
+ case 1:
64
+ case "end":
65
+ return _context2.stop();
66
+ }
67
+ }, _callee2);
68
+ }));
69
+ return _runDetection.apply(this, arguments);
70
+ }
71
+ function maybeDetectAp(_x3) {
72
+ return _maybeDetectAp.apply(this, arguments);
73
+ }
74
+ function _maybeDetectAp() {
75
+ _maybeDetectAp = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(apDetector) {
76
+ return _regenerator["default"].wrap(function (_context3) {
77
+ while (1) switch (_context3.prev = _context3.next) {
78
+ case 0:
79
+ if (!(!apDetector.isDetectRequired() || apDetector.isFinished())) {
80
+ _context3.next = 1;
81
+ break;
82
+ }
83
+ return _context3.abrupt("return");
84
+ case 1:
85
+ _context3.next = 2;
86
+ return runDetection(apDetector, 'start');
87
+ case 2:
88
+ case "end":
89
+ return _context3.stop();
90
+ }
91
+ }, _callee3);
92
+ }));
93
+ return _maybeDetectAp.apply(this, arguments);
94
+ }
95
+ function maybeRedetectAp(_x4) {
96
+ return _maybeRedetectAp.apply(this, arguments);
97
+ }
98
+ function _maybeRedetectAp() {
99
+ _maybeRedetectAp = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(apDetector) {
100
+ return _regenerator["default"].wrap(function (_context4) {
101
+ while (1) switch (_context4.prev = _context4.next) {
102
+ case 0:
103
+ if (!(!apDetector.isDetectRequired() || apDetector.isDetecting())) {
104
+ _context4.next = 1;
105
+ break;
106
+ }
107
+ return _context4.abrupt("return");
108
+ case 1:
109
+ _context4.next = 2;
110
+ return runDetection(apDetector, 'restart');
111
+ case 2:
112
+ case "end":
113
+ return _context4.stop();
114
+ }
115
+ }, _callee4);
116
+ }));
117
+ return _maybeRedetectAp.apply(this, arguments);
118
+ }
119
+ var detectAp = exports.detectAp = /*#__PURE__*/function () {
120
+ var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(logger, apDetector) {
121
+ var isApDetectRequired, isApDetectFinished, _yield$to, _yield$to2, error;
122
+ return _regenerator["default"].wrap(function (_context) {
123
+ while (1) switch (_context.prev = _context.next) {
124
+ case 0:
125
+ isApDetectRequired = apDetector.isDetectRequired();
126
+ isApDetectFinished = apDetector.isFinished();
127
+ logger.info("check ap detect required: ".concat(isApDetectRequired, ", finished detect: ").concat(isApDetectFinished));
128
+ if (!(isApDetectRequired && !isApDetectFinished)) {
129
+ _context.next = 2;
130
+ break;
131
+ }
132
+ _context.next = 1;
133
+ return (0, _imports.to)(maybeDetectAp(apDetector));
134
+ case 1:
135
+ _yield$to = _context.sent;
136
+ _yield$to2 = (0, _slicedToArray2["default"])(_yield$to, 1);
137
+ error = _yield$to2[0];
138
+ if (!error) {
139
+ _context.next = 2;
140
+ break;
141
+ }
142
+ logger.error("join scene failed, ap detect failed");
143
+ throw error;
144
+ case 2:
145
+ case "end":
146
+ return _context.stop();
147
+ }
148
+ }, _callee);
149
+ }));
150
+ return function detectAp(_x5, _x6) {
151
+ return _ref.apply(this, arguments);
152
+ };
153
+ }();
@@ -0,0 +1,8 @@
1
+ import type { Logger } from '../../../imports';
2
+ import type { AgoraRteApDetector } from '../../engine/ap-detector';
3
+ import type { AgoraRtcChannelClient, AgoraRtcClient } from '../../rtc';
4
+ import { AgoraRtcChannelClientObserver } from '../../rtc/type';
5
+ import { AgoraRtmChannelClient } from '../../rtm/channel';
6
+ import type { AgoraRteJoinRtcOptions } from '../type';
7
+ export declare const joinRTCChannel: (logger: Logger, options: AgoraRteJoinRtcOptions, rtcClient: AgoraRtcClient, rtcChannelClient: AgoraRtcChannelClient, rtcChannelObserver: AgoraRtcChannelClientObserver, apDetector: AgoraRteApDetector) => Promise<AgoraRtcChannelClient>;
8
+ export declare const joinRTMChannel: (logger: Logger, rtmChannelClient: AgoraRtmChannelClient) => Promise<AgoraRtmChannelClient>;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.object.define-property.js");
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.joinRTMChannel = exports.joinRTCChannel = void 0;
9
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
+ require("core-js/modules/es.array.join.js");
11
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+ var _imports = require("../../../imports");
14
+ var _error = require("../../utilities/error");
15
+ var joinRTCChannel = exports.joinRTCChannel = /*#__PURE__*/function () {
16
+ var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(logger, options, rtcClient, rtcChannelClient, rtcChannelObserver, apDetector) {
17
+ var cfg, _yield$to, _yield$to2, error;
18
+ return _regenerator["default"].wrap(function (_context2) {
19
+ while (1) switch (_context2.prev = _context2.next) {
20
+ case 0:
21
+ cfg = apDetector.getAvailableRtcAccessPointConfig();
22
+ logger.info("get available rtc access point config: ".concat((0, _imports.jsonstring)(cfg)));
23
+ if (cfg) {
24
+ rtcClient.setAccessPointConfig(cfg);
25
+ }
26
+ if (options.encryptionConfig) {
27
+ rtcChannelClient.setEncryptionConfig(options.encryptionConfig);
28
+ }
29
+ rtcChannelClient.addObserver(rtcChannelObserver);
30
+ _context2.next = 1;
31
+ return (0, _imports.to)((0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
32
+ return _regenerator["default"].wrap(function (_context) {
33
+ while (1) switch (_context.prev = _context.next) {
34
+ case 0:
35
+ _context.next = 1;
36
+ return rtcChannelClient.join(options.streamId, options.token);
37
+ case 1:
38
+ case "end":
39
+ return _context.stop();
40
+ }
41
+ }, _callee);
42
+ }))());
43
+ case 1:
44
+ _yield$to = _context2.sent;
45
+ _yield$to2 = (0, _slicedToArray2["default"])(_yield$to, 1);
46
+ error = _yield$to2[0];
47
+ if (!(error instanceof _error.AgoraRteError)) {
48
+ _context2.next = 2;
49
+ break;
50
+ }
51
+ logger.error("join rtc channel failed, ".concat((0, _imports.jsonstring)(error)));
52
+ throw error;
53
+ case 2:
54
+ return _context2.abrupt("return", rtcChannelClient);
55
+ case 3:
56
+ case "end":
57
+ return _context2.stop();
58
+ }
59
+ }, _callee2);
60
+ }));
61
+ return function joinRTCChannel(_x, _x2, _x3, _x4, _x5, _x6) {
62
+ return _ref.apply(this, arguments);
63
+ };
64
+ }();
65
+ var joinRTMChannel = exports.joinRTMChannel = /*#__PURE__*/function () {
66
+ var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(logger, rtmChannelClient) {
67
+ var _yield$to3, _yield$to4, error;
68
+ return _regenerator["default"].wrap(function (_context4) {
69
+ while (1) switch (_context4.prev = _context4.next) {
70
+ case 0:
71
+ _context4.next = 1;
72
+ return (0, _imports.to)((0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3() {
73
+ return _regenerator["default"].wrap(function (_context3) {
74
+ while (1) switch (_context3.prev = _context3.next) {
75
+ case 0:
76
+ _context3.next = 1;
77
+ return rtmChannelClient.join();
78
+ case 1:
79
+ case "end":
80
+ return _context3.stop();
81
+ }
82
+ }, _callee3);
83
+ }))());
84
+ case 1:
85
+ _yield$to3 = _context4.sent;
86
+ _yield$to4 = (0, _slicedToArray2["default"])(_yield$to3, 1);
87
+ error = _yield$to4[0];
88
+ if (!error) {
89
+ _context4.next = 2;
90
+ break;
91
+ }
92
+ logger.error("join rtm channel failed, ".concat(error.message));
93
+ throw error;
94
+ case 2:
95
+ return _context4.abrupt("return", rtmChannelClient);
96
+ case 3:
97
+ case "end":
98
+ return _context4.stop();
99
+ }
100
+ }, _callee4);
101
+ }));
102
+ return function joinRTMChannel(_x7, _x8) {
103
+ return _ref3.apply(this, arguments);
104
+ };
105
+ }();
@@ -0,0 +1,4 @@
1
+ import type { AgoraObservable } from '../../../imports';
2
+ import { AgoraRtcChannelClient } from '../../rtc/channel';
3
+ import { AgoraRteSceneObserver } from '../type';
4
+ export declare const relayRtcChannelEvents: (rtcChannelClient: AgoraRtcChannelClient, observable: AgoraObservable<AgoraRteSceneObserver>) => void;