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
@@ -15,16 +15,6 @@ var AgoraRteAudioEffectEnhancer = exports.AgoraRteAudioEffectEnhancer = /*#__PUR
15
15
  this._deviceId = _deviceId;
16
16
  }
17
17
  return (0, _createClass2["default"])(AgoraRteAudioEffectEnhancer, [{
18
- key: "enableAiDenoiser",
19
- value: function enableAiDenoiser() {
20
- return this._rtcClient.captureEnhancement.enableAiDenoiser(this._deviceId);
21
- }
22
- }, {
23
- key: "disableAiDenoiser",
24
- value: function disableAiDenoiser() {
25
- return this._rtcClient.captureEnhancement.disableAiDenoiser(this._deviceId);
26
- }
27
- }, {
28
18
  key: "setAiDenoiseLevel",
29
19
  value: function setAiDenoiseLevel(level) {
30
20
  return this._rtcClient.captureEnhancement.setAiDenoiseLevel(this._deviceId, level);
@@ -40,14 +30,14 @@ var AgoraRteAudioEffectEnhancer = exports.AgoraRteAudioEffectEnhancer = /*#__PUR
40
30
  return this._rtcClient.captureEnhancement.disableHiFiMode();
41
31
  }
42
32
  }, {
43
- key: "enableEchoCancellation",
44
- value: function enableEchoCancellation() {
45
- return this._rtcClient.captureEnhancement.enableEchoCancellation();
33
+ key: "enableAEC",
34
+ value: function enableAEC() {
35
+ return this._rtcClient.captureEnhancement.enableAEC();
46
36
  }
47
37
  }, {
48
- key: "disableEchoCancellation",
49
- value: function disableEchoCancellation() {
50
- return this._rtcClient.captureEnhancement.disableEchoCancellation();
38
+ key: "disableAEC",
39
+ value: function disableAEC() {
40
+ return this._rtcClient.captureEnhancement.disableAEC();
51
41
  }
52
42
  }, {
53
43
  key: "enableStereoMode",
@@ -1,155 +1 @@
1
- import { AgoraRtcAudioOutputRouting, AgoraRtcCapability, AgoraRtcDeviceInfo, AgoraRtcDisplayInfo, AgoraRtcWindowInfo } from '../rtc/type';
2
- import { AgoraRteCameraTrack } from './camera';
3
- import { AgoraRteLoopbackTrack } from './loopback';
4
- import { AgoraRteMicrophoneTrack } from './microphone';
5
- import { AgoraRteScreenTrack } from './screen';
6
- import { AgoraRteMediaControlObserver } from './type';
7
- /**
8
- * Interface for the Agora Real-Time Engagement Media Control.
9
- */
10
- export interface AgoraRteMediaControl {
11
- /**
12
- * Retrieves a list of available loopback devices.
13
- * @returns An array of available loopback devices.
14
- */
15
- getLoopbackList(): AgoraRtcDeviceInfo[];
16
- /**
17
- * Retrieves a list of available cameras.
18
- * @returns An array of available cameras.
19
- */
20
- getCameraList(): Promise<AgoraRtcDeviceInfo[]>;
21
- /**
22
- * Retrieves a list of available microphones.
23
- * @returns An array of available microphones.
24
- */
25
- getMicrophoneList(): Promise<AgoraRtcDeviceInfo[]>;
26
- /**
27
- * Retrieves a list of available speakers.
28
- * @returns An array of available speakers.
29
- */
30
- getSpeakerList(): Promise<AgoraRtcDeviceInfo[]>;
31
- /**
32
- * Retrieves the system-selected microphone.
33
- * @returns The system-selected microphone.
34
- */
35
- getSystemSelectedMicrophone(): Promise<AgoraRtcDeviceInfo | undefined>;
36
- /**
37
- * Retrieves the system-selected speaker.
38
- * @returns The system-selected speaker.
39
- */
40
- getSystemSelectedSpeaker(): Promise<AgoraRtcDeviceInfo | undefined>;
41
- /**
42
- * Retrieves a list of available windows for screen sharing.
43
- * Only available in Electron, in browsers this method returns an empty array.
44
- * @returns A promise that resolves to an array of available windows.
45
- */
46
- getWindowList(): Promise<AgoraRtcWindowInfo[]>;
47
- /**
48
- * Retrieves a list of available displays for screen sharing.
49
- * Only available in Electron, in browsers this method returns an empty array.
50
- * @returns A promise that resolves to an array of available displays.
51
- */
52
- getDisplayList(): Promise<AgoraRtcDisplayInfo[]>;
53
- /**
54
- * Retrieves the camera video track for a specific device.
55
- * @param deviceId The ID of the device.
56
- * @returns The camera video track.
57
- */
58
- getCameraTrack(deviceId: string): AgoraRteCameraTrack;
59
- /**
60
- * Retrieves the microphone audio track for a specific device.
61
- * @param deviceId The ID of the device.
62
- * @returns The microphone audio track.
63
- */
64
- getMicrophoneTrack(deviceId: string): AgoraRteMicrophoneTrack;
65
- /**
66
- * Retrieves the screen video track for a specific source.
67
- * @param sourceId The ID of the source.
68
- * @returns The screen video track.
69
- */
70
- getScreenTrack(sourceId: string): AgoraRteScreenTrack;
71
- /**
72
- * Retrieves the loopback audio track for a specific source.
73
- * @param sourceId The ID of the source.
74
- * @returns The loopback audio track.
75
- */
76
- getLoopbackTrack(sourceId: string): AgoraRteLoopbackTrack;
77
- /**
78
- * Sets a speaker for audio playback.
79
- * @param deviceId The ID of the speaker device.
80
- */
81
- setSelectedSpeaker(deviceId: string): void;
82
- /**
83
- * Enable/Disable speaker playback.
84
- * @param enable Whether to enable speaker playback.
85
- */
86
- setEnableSpeaker(enable: boolean): void;
87
- /**
88
- * Get the current audio output routing of the SDK
89
- */
90
- getAudioOutputRouting(): AgoraRtcAudioOutputRouting;
91
- /**
92
- * Starts a speaker test.
93
- * @param url The URL of the audio file for the test.
94
- */
95
- startSpeakerTest(url: string): void;
96
- /**
97
- * Stops a speaker test.
98
- */
99
- stopSpeakerTest(): void;
100
- /**
101
- * Adjusts the playback audio volume.
102
- * @param volume
103
- */
104
- adjustAudioOutputVolume(volume: number): void;
105
- /**
106
- * Check if the media control supports the specified capability.
107
- * @param capability
108
- */
109
- isCapabilitySupported(capability: AgoraRtcCapability): boolean;
110
- /**
111
- * Set the volume of the selected speaker
112
- * @param volume The volume to set
113
- */
114
- setSelectedSpeakerVolume(volume: number): void;
115
- /**
116
- * Get the volume of the selected speaker
117
- */
118
- getSelectedSpeakerVolume(): number;
119
- /**
120
- * Disable AGC
121
- * @returns 0 if the AGC is disabled; otherwise,
122
- * 1 if the AGC is not supported
123
- */
124
- disableAGC(): number;
125
- /**
126
- * Enable AGC
127
- * @returns 0 if the AGC is enabled; otherwise,
128
- * 1 if the AGC is not supported
129
- */
130
- enableAGC(): number;
131
- /**
132
- * Observe the system selected speaker
133
- * @param enable
134
- */
135
- observeSystemSelectedSpeakerChanged(enable: boolean): void;
136
- /**
137
- * Observe the system selected microphone
138
- * @param enable
139
- */
140
- observeSystemSelectedMicrophoneChanged(enable: boolean): void;
141
- /**
142
- * Adds an observer to be notified of media device events.
143
- * @param observer The observer to add.
144
- */
145
- addObserver(observer: AgoraRteMediaControlObserver): void;
146
- /**
147
- * Removes an observer from the media device events.
148
- * @param observer The observer to remove.
149
- */
150
- removeObserver(observer: AgoraRteMediaControlObserver): void;
151
- /**
152
- * Releases the resources used by the media control.
153
- */
154
- release(): void;
155
- }
1
+ export {};
@@ -50,28 +50,28 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
50
50
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
51
51
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
52
52
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
53
+ var _constant = require("../../constant");
53
54
  var _imports = require("../../imports");
55
+ var _type = require("../rtc/type");
54
56
  var _logger = require("../utilities/logger");
55
57
  var _camera = require("./camera");
56
58
  var _loopback = require("./loopback");
57
59
  var _microphone = require("./microphone");
58
60
  var _screen = require("./screen");
59
61
  var _AgoraRteMediaControlImpl;
60
- var _initProto;
62
+ var _initProto, _observeSystemSelectedSpeakerChangedDecs, _observeSystemSelectedMicrophoneChangedDecs, _setSelectedSpeakerDecs, _setSelectedSpeakerVolumeDecs, _setEnableSpeakerDecs, _startSpeakerTestDecs, _adjustAudioOutputVolumeDecs, _ref;
61
63
  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)]; } }; }
62
64
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
63
65
  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); }
64
66
  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; }
65
67
  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; }
66
- /**
67
- * Interface for the Agora Real-Time Engagement Media Control.
68
- */
68
+ _ref = (_observeSystemSelectedSpeakerChangedDecs = (0, _imports.trace)(['enable']), _observeSystemSelectedMicrophoneChangedDecs = (0, _imports.trace)(['enable']), _setSelectedSpeakerDecs = (0, _imports.trace)(['deviceId']), _setSelectedSpeakerVolumeDecs = (0, _imports.trace)(['volume']), _setEnableSpeakerDecs = (0, _imports.trace)(['enable']), _startSpeakerTestDecs = (0, _imports.trace)(['url']), _adjustAudioOutputVolumeDecs = (0, _imports.trace)(['volume']), "logger");
69
69
  //@internal
70
70
  var AgoraRteMediaControlImpl = exports.AgoraRteMediaControlImpl = /*#__PURE__*/function () {
71
71
  function AgoraRteMediaControlImpl() {
72
72
  var _this = this;
73
73
  (0, _classCallCheck2["default"])(this, AgoraRteMediaControlImpl);
74
- (0, _defineProperty2["default"])(this, "logger", (_initProto(this), (0, _logger.createLogger)({
74
+ (0, _defineProperty2["default"])(this, _ref, (_initProto(this), (0, _logger.createLogger)({
75
75
  prefix: 'AgoraRteMediaControlImpl'
76
76
  })));
77
77
  (0, _defineProperty2["default"])(this, "_observable", new _imports.AgoraObservable());
@@ -80,6 +80,26 @@ var AgoraRteMediaControlImpl = exports.AgoraRteMediaControlImpl = /*#__PURE__*/f
80
80
  (0, _defineProperty2["default"])(this, "_microphoneAudioTracksMap", new Map());
81
81
  (0, _defineProperty2["default"])(this, "_screenShareTracksMap", new Map());
82
82
  (0, _defineProperty2["default"])(this, "_loopbackAudioTracksMap", new Map());
83
+ (0, _defineProperty2["default"])(this, "_cameraTrackObserver", {
84
+ onCameraStateUpdated: function onCameraStateUpdated(deviceId, state) {
85
+ _this._observable.notifyObservers('onTrackVideoStateUpdated', deviceId, _type.AgoraRtcVideoSourceType.CAMERA, state);
86
+ }
87
+ });
88
+ (0, _defineProperty2["default"])(this, "_microphoneTrackObserver", {
89
+ onMicrophoneStateUpdated: function onMicrophoneStateUpdated(deviceId, state) {
90
+ _this._observable.notifyObservers('onTrackAudioStateUpdated', deviceId, _type.AgoraRtcAudioSourceType.MICROPHONE, state);
91
+ }
92
+ });
93
+ (0, _defineProperty2["default"])(this, "_screenTrackObserver", {
94
+ onScreenCaptureStateUpdated: function onScreenCaptureStateUpdated(deviceId, state) {
95
+ _this._observable.notifyObservers('onTrackVideoStateUpdated', deviceId, _type.AgoraRtcVideoSourceType.SCREEN, state);
96
+ }
97
+ });
98
+ (0, _defineProperty2["default"])(this, "_loopbackTrackObserver", {
99
+ onLoopbackRecordingStateUpdated: function onLoopbackRecordingStateUpdated(deviceId, state) {
100
+ _this._observable.notifyObservers('onTrackAudioStateUpdated', deviceId, _type.AgoraRtcAudioSourceType.LOOPBACK, state);
101
+ }
102
+ });
83
103
  (0, _defineProperty2["default"])(this, "_sourceManagerObserver", {
84
104
  onCameraListAdded: function onCameraListAdded(list) {
85
105
  list.forEach(function (device) {
@@ -150,12 +170,12 @@ var AgoraRteMediaControlImpl = exports.AgoraRteMediaControlImpl = /*#__PURE__*/f
150
170
  }, {
151
171
  key: "observeSystemSelectedSpeakerChanged",
152
172
  value: function observeSystemSelectedSpeakerChanged(enable) {
153
- this.rtcClient.observeSystemSelectedSpeakerChanged(enable);
173
+ return this.rtcClient.observeSystemSelectedSpeakerChanged(enable);
154
174
  }
155
175
  }, {
156
176
  key: "observeSystemSelectedMicrophoneChanged",
157
177
  value: function observeSystemSelectedMicrophoneChanged(enable) {
158
- this.rtcClient.sourceManager.observeSystemSelectedMicrophoneChanged(enable);
178
+ return this.rtcClient.sourceManager.observeSystemSelectedMicrophoneChanged(enable);
159
179
  }
160
180
  }, {
161
181
  key: "disableAGC",
@@ -170,12 +190,12 @@ var AgoraRteMediaControlImpl = exports.AgoraRteMediaControlImpl = /*#__PURE__*/f
170
190
  }, {
171
191
  key: "setSelectedSpeaker",
172
192
  value: function setSelectedSpeaker(deviceId) {
173
- this.rtcClient.setSelectedSpeaker(deviceId);
193
+ return this.rtcClient.setSelectedSpeaker(deviceId);
174
194
  }
175
195
  }, {
176
196
  key: "setSelectedSpeakerVolume",
177
197
  value: function setSelectedSpeakerVolume(volume) {
178
- this.rtcClient.setSelectedSpeakerVolume(volume);
198
+ return this.rtcClient.setSelectedSpeakerVolume(volume);
179
199
  }
180
200
  }, {
181
201
  key: "getSelectedSpeakerVolume",
@@ -190,7 +210,7 @@ var AgoraRteMediaControlImpl = exports.AgoraRteMediaControlImpl = /*#__PURE__*/f
190
210
  }, {
191
211
  key: "setEnableSpeaker",
192
212
  value: function setEnableSpeaker(enable) {
193
- this.rtcClient.setEnableSpeaker(enable);
213
+ return this.rtcClient.setEnableSpeaker(enable);
194
214
  }
195
215
  }, {
196
216
  key: "getCameraTrack",
@@ -199,7 +219,9 @@ var AgoraRteMediaControlImpl = exports.AgoraRteMediaControlImpl = /*#__PURE__*/f
199
219
  return new _camera.AgoraRteCameraDummyTrackImpl();
200
220
  }
201
221
  if (!this._cameraVideoTracksMap.has(deviceId)) {
202
- this._cameraVideoTracksMap.set(deviceId, new _camera.AgoraRteCameraTrackImpl(this.rtcClient, deviceId));
222
+ var cameraTrack = new _camera.AgoraRteCameraTrackImpl(this.rtcClient, deviceId);
223
+ cameraTrack.addObserver(this._cameraTrackObserver);
224
+ this._cameraVideoTracksMap.set(deviceId, cameraTrack);
203
225
  }
204
226
  return this._cameraVideoTracksMap.get(deviceId);
205
227
  }
@@ -210,7 +232,9 @@ var AgoraRteMediaControlImpl = exports.AgoraRteMediaControlImpl = /*#__PURE__*/f
210
232
  return new _microphone.AgoraRteMicrophoneDummyTrackImpl();
211
233
  }
212
234
  if (!this._microphoneAudioTracksMap.has(deviceId)) {
213
- this._microphoneAudioTracksMap.set(deviceId, new _microphone.AgoraRteMicrophoneTrackImpl(this.rtcClient, deviceId));
235
+ var microphoneTrack = new _microphone.AgoraRteMicrophoneTrackImpl(this.rtcClient, deviceId);
236
+ microphoneTrack.addObserver(this._microphoneTrackObserver);
237
+ this._microphoneAudioTracksMap.set(deviceId, microphoneTrack);
214
238
  }
215
239
  return this._microphoneAudioTracksMap.get(deviceId);
216
240
  }
@@ -221,7 +245,9 @@ var AgoraRteMediaControlImpl = exports.AgoraRteMediaControlImpl = /*#__PURE__*/f
221
245
  return new _screen.AgoraRteScreenDummyTrackImpl();
222
246
  }
223
247
  if (!this._screenShareTracksMap.has(sourceId)) {
224
- this._screenShareTracksMap.set(sourceId, new _screen.AgoraRteScreenTrackImpl(this.rtcClient, sourceId));
248
+ var screenTrack = new _screen.AgoraRteScreenTrackImpl(this.rtcClient, sourceId);
249
+ screenTrack.addObserver(this._screenTrackObserver);
250
+ this._screenShareTracksMap.set(sourceId, screenTrack);
225
251
  }
226
252
  return this._screenShareTracksMap.get(sourceId);
227
253
  }
@@ -232,7 +258,9 @@ var AgoraRteMediaControlImpl = exports.AgoraRteMediaControlImpl = /*#__PURE__*/f
232
258
  return new _loopback.AgoraRteLoopbackDummyTrackImpl();
233
259
  }
234
260
  if (!this._loopbackAudioTracksMap.has(sourceId)) {
235
- this._loopbackAudioTracksMap.set(sourceId, new _loopback.AgoraRteLoopbackTrackImpl(this.rtcClient, sourceId));
261
+ var loopbackTrack = new _loopback.AgoraRteLoopbackTrackImpl(this.rtcClient, sourceId);
262
+ loopbackTrack.addObserver(this._loopbackTrackObserver);
263
+ this._loopbackAudioTracksMap.set(sourceId, loopbackTrack);
236
264
  }
237
265
  return this._loopbackAudioTracksMap.get(sourceId);
238
266
  }
@@ -312,11 +340,12 @@ var AgoraRteMediaControlImpl = exports.AgoraRteMediaControlImpl = /*#__PURE__*/f
312
340
  this.rtcClient.sourceManager.removeObserver(this._sourceManagerObserver);
313
341
  this.rtcClient.removeObserver(this._rtcClientObserver);
314
342
  this._rtcClient = null;
343
+ return _constant.AgoraRteReturnCode.SUCCESS;
315
344
  }
316
345
  }]);
317
346
  }();
318
347
  _AgoraRteMediaControlImpl = AgoraRteMediaControlImpl;
319
- var _applyDecs$e = _applyDecs(_AgoraRteMediaControlImpl, [[_imports.trace, 2, "observeSystemSelectedSpeakerChanged"], [_imports.trace, 2, "observeSystemSelectedMicrophoneChanged"], [_imports.trace, 2, "disableAGC"], [_imports.trace, 2, "enableAGC"], [_imports.trace, 2, "setSelectedSpeaker"], [_imports.trace, 2, "setSelectedSpeakerVolume"], [_imports.trace, 2, "setEnableSpeaker"], [_imports.trace, 2, "startSpeakerTest"], [_imports.trace, 2, "stopSpeakerTest"], [_imports.trace, 2, "adjustAudioOutputVolume"], [_imports.trace, 2, "release"]], []).e;
348
+ var _applyDecs$e = _applyDecs(_AgoraRteMediaControlImpl, [[_observeSystemSelectedSpeakerChangedDecs, 2, "observeSystemSelectedSpeakerChanged"], [_observeSystemSelectedMicrophoneChangedDecs, 2, "observeSystemSelectedMicrophoneChanged"], [_imports.trace, 2, "disableAGC"], [_imports.trace, 2, "enableAGC"], [_setSelectedSpeakerDecs, 2, "setSelectedSpeaker"], [_setSelectedSpeakerVolumeDecs, 2, "setSelectedSpeakerVolume"], [_setEnableSpeakerDecs, 2, "setEnableSpeaker"], [_startSpeakerTestDecs, 2, "startSpeakerTest"], [_imports.trace, 2, "stopSpeakerTest"], [_adjustAudioOutputVolumeDecs, 2, "adjustAudioOutputVolume"], [_imports.trace, 2, "release"]], []).e;
320
349
  var _applyDecs$e2 = (0, _slicedToArray2["default"])(_applyDecs$e, 1);
321
350
  _initProto = _applyDecs$e2[0];
322
351
  _applyDecs$e;
@@ -21,14 +21,14 @@ export interface AgoraRteLoopbackTrack extends AgoraRteObservableTrack<AgoraRteL
21
21
  /**
22
22
  * Starts the loopback audio track.
23
23
  */
24
- start(): void;
24
+ start(): number;
25
25
  /**
26
26
  * Stops the loopback audio track.
27
27
  */
28
- stop(): void;
28
+ stop(): number;
29
29
  /**
30
30
  * Updates the signal volume for the loopback audio track.
31
31
  * @param volume The volume level to set.
32
32
  */
33
- adjustVolume(volume: number): void;
33
+ adjustVolume(volume: number): number;
34
34
  }
@@ -54,7 +54,7 @@ var _type = require("../../type");
54
54
  var _logger = require("../utilities/logger");
55
55
  var _baseTrack = require("./base-track");
56
56
  var _ref, _AgoraRteLoopbackTrackImpl;
57
- var _initProto;
57
+ var _initProto, _adjustVolumeDecs, _ref2;
58
58
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
59
59
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
60
60
  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)]; } }; }
@@ -65,13 +65,14 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
65
65
  /**
66
66
  * Interface for a loopback audio track in Agora RTE SDK.
67
67
  */
68
+ _ref2 = (_adjustVolumeDecs = (0, _imports.trace)(['volume']), "logger");
68
69
  //@internal
69
- var AgoraRteLoopbackTrackImpl = exports.AgoraRteLoopbackTrackImpl = /*#__PURE__*/function (_ref2) {
70
+ var AgoraRteLoopbackTrackImpl = exports.AgoraRteLoopbackTrackImpl = /*#__PURE__*/function (_ref3) {
70
71
  function AgoraRteLoopbackTrackImpl(_rtcClient, _deviceId) {
71
72
  var _this;
72
73
  (0, _classCallCheck2["default"])(this, AgoraRteLoopbackTrackImpl);
73
74
  _this = _callSuper(this, AgoraRteLoopbackTrackImpl, [_rtcClient]);
74
- (0, _defineProperty2["default"])(_this, "logger", (_initProto(_this), (0, _logger.createLogger)({
75
+ (0, _defineProperty2["default"])(_this, _ref2, (_initProto(_this), (0, _logger.createLogger)({
75
76
  prefix: 'AgoraRteLoopbackTrackImpl'
76
77
  })));
77
78
  (0, _defineProperty2["default"])(_this, "_state", _type.AgoraRteMediaSourceState.CLOSE);
@@ -81,7 +82,7 @@ var AgoraRteLoopbackTrackImpl = exports.AgoraRteLoopbackTrackImpl = /*#__PURE__*
81
82
  });
82
83
  return _this;
83
84
  }
84
- (0, _inherits2["default"])(AgoraRteLoopbackTrackImpl, _ref2);
85
+ (0, _inherits2["default"])(AgoraRteLoopbackTrackImpl, _ref3);
85
86
  return (0, _createClass2["default"])(AgoraRteLoopbackTrackImpl, [{
86
87
  key: "getDeviceId",
87
88
  value: function getDeviceId() {
@@ -100,18 +101,18 @@ var AgoraRteLoopbackTrackImpl = exports.AgoraRteLoopbackTrackImpl = /*#__PURE__*
100
101
  }, {
101
102
  key: "start",
102
103
  value: function start() {
103
- this._rtcClient.sourceManager.startLoopbackRecording(this._deviceId);
104
+ return this._rtcClient.sourceManager.startLoopbackRecording(this._deviceId);
104
105
  }
105
106
  }, {
106
107
  key: "stop",
107
108
  value: function stop() {
108
- this._rtcClient.sourceManager.stopLoopbackRecording(this._deviceId);
109
+ return this._rtcClient.sourceManager.stopLoopbackRecording(this._deviceId);
109
110
  }
110
111
  }, {
111
112
  key: "adjustVolume",
112
113
  value: function adjustVolume(volume) {
113
114
  // todo
114
- this._rtcClient.sourceManager.adjustLoopbackVolume('', volume);
115
+ return this._rtcClient.sourceManager.adjustLoopbackVolume('', volume);
115
116
  }
116
117
  }, {
117
118
  key: "_handleLoopbackStateUpdated",
@@ -124,7 +125,7 @@ var AgoraRteLoopbackTrackImpl = exports.AgoraRteLoopbackTrackImpl = /*#__PURE__*
124
125
  }]);
125
126
  }(_ref = _baseTrack.AgoraRteBaseTrack); // @internal
126
127
  _AgoraRteLoopbackTrackImpl = AgoraRteLoopbackTrackImpl;
127
- var _applyDecs$e = (0, _slicedToArray2["default"])(_applyDecs(_AgoraRteLoopbackTrackImpl, [[_imports.trace, 2, "start"], [_imports.trace, 2, "stop"], [_imports.trace, 2, "adjustVolume"]], [], 0, void 0, _ref).e, 1);
128
+ var _applyDecs$e = (0, _slicedToArray2["default"])(_applyDecs(_AgoraRteLoopbackTrackImpl, [[_imports.trace, 2, "start"], [_imports.trace, 2, "stop"], [_adjustVolumeDecs, 2, "adjustVolume"]], [], 0, void 0, _ref).e, 1);
128
129
  _initProto = _applyDecs$e[0];
129
130
  var AgoraRteLoopbackDummyTrackImpl = exports.AgoraRteLoopbackDummyTrackImpl = /*#__PURE__*/function () {
130
131
  function AgoraRteLoopbackDummyTrackImpl() {
@@ -153,12 +154,18 @@ var AgoraRteLoopbackDummyTrackImpl = exports.AgoraRteLoopbackDummyTrackImpl = /*
153
154
  }
154
155
  }, {
155
156
  key: "start",
156
- value: function start() {}
157
+ value: function start() {
158
+ return 0;
159
+ }
157
160
  }, {
158
161
  key: "stop",
159
- value: function stop() {}
162
+ value: function stop() {
163
+ return 0;
164
+ }
160
165
  }, {
161
166
  key: "adjustVolume",
162
- value: function adjustVolume(volume) {}
167
+ value: function adjustVolume(volume) {
168
+ return 0;
169
+ }
163
170
  }]);
164
171
  }();
@@ -21,7 +21,7 @@ export interface AgoraRteMicrophoneTrack extends AgoraRteObservableTrack<AgoraRt
21
21
  * Sets the audio raw data configuration for the track.
22
22
  * @param config The audio raw data configuration.
23
23
  */
24
- setAudioRawDataConfig(config: AgoraRteAudioRawDataConfig): void;
24
+ setAudioRawDataConfig(config: AgoraRteAudioRawDataConfig): number;
25
25
  /**
26
26
  * Starts the microphone audio track for the specified device.
27
27
  * onLocalMicrophoneAudioStateUpdated callback will be triggered when the state of the microphone changes.
@@ -29,25 +29,25 @@ export interface AgoraRteMicrophoneTrack extends AgoraRteObservableTrack<AgoraRt
29
29
  * - {@link startTest} should be called after this method when you are not in a channel,
30
30
  * otherwise onLocalMicrophoneAudioStateUpdated may not be triggered in electron.
31
31
  */
32
- start(): void;
32
+ start(): number;
33
33
  /**
34
34
  * Stops the microphone audio track for the specified device.
35
35
  */
36
- stop(): void;
36
+ stop(): number;
37
37
  /**
38
38
  * Starts the microphone test for the specified device.
39
39
  * @param interval The interval for the microphone test.
40
40
  */
41
- startTest(interval: number): void;
41
+ startTest(interval: number): number;
42
42
  /**
43
43
  * Stops the microphone test for the specified device.
44
44
  */
45
- stopTest(): void;
45
+ stopTest(): number;
46
46
  /**
47
47
  * Updates the signal volume for the microphone audio track.
48
48
  * @param volume The volume level to set, range from 0 to 100.
49
49
  */
50
- adjustVolume(volume: number): void;
50
+ adjustVolume(volume: number): number;
51
51
  /**
52
52
  * Gets the audio effect enhancer for the microphone audio track.
53
53
  * @returns The audio effect enhancer for the track.
@@ -54,8 +54,9 @@ var _baseTrack = require("./base-track");
54
54
  var _effectEnhancer = require("./effect-enhancer");
55
55
  var _imports = require("../../imports");
56
56
  var _logger = require("../utilities/logger");
57
+ var _constant = require("../../constant");
57
58
  var _ref, _AgoraRteMicrophoneTrackImpl;
58
- var _initProto;
59
+ var _initProto, _setAudioRawDataConfigDecs, _startTestDecs, _adjustVolumeDecs, _ref2;
59
60
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
60
61
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
61
62
  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)]; } }; }
@@ -66,13 +67,14 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
66
67
  /**
67
68
  * Interface for a microphone audio track in Agora RTE SDK.
68
69
  */
70
+ _ref2 = (_setAudioRawDataConfigDecs = (0, _imports.trace)(['config']), _startTestDecs = (0, _imports.trace)(['interval']), _adjustVolumeDecs = (0, _imports.trace)(['volume']), "logger");
69
71
  //@internal
70
- var AgoraRteMicrophoneTrackImpl = exports.AgoraRteMicrophoneTrackImpl = /*#__PURE__*/function (_ref2) {
72
+ var AgoraRteMicrophoneTrackImpl = exports.AgoraRteMicrophoneTrackImpl = /*#__PURE__*/function (_ref3) {
71
73
  function AgoraRteMicrophoneTrackImpl(_rtcClient, _deviceId) {
72
74
  var _this;
73
75
  (0, _classCallCheck2["default"])(this, AgoraRteMicrophoneTrackImpl);
74
76
  _this = _callSuper(this, AgoraRteMicrophoneTrackImpl, [_rtcClient]);
75
- (0, _defineProperty2["default"])(_this, "logger", (_initProto(_this), (0, _logger.createLogger)({
77
+ (0, _defineProperty2["default"])(_this, _ref2, (_initProto(_this), (0, _logger.createLogger)({
76
78
  prefix: 'AgoraRteMicrophoneTrackImpl'
77
79
  })));
78
80
  (0, _defineProperty2["default"])(_this, "_state", _type.AgoraRteMediaSourceState.CLOSE);
@@ -85,11 +87,12 @@ var AgoraRteMicrophoneTrackImpl = exports.AgoraRteMicrophoneTrackImpl = /*#__PUR
85
87
  _this._rtcClient.sourceManager.addObserver(_this._sourceManagerObserver);
86
88
  return _this;
87
89
  }
88
- (0, _inherits2["default"])(AgoraRteMicrophoneTrackImpl, _ref2);
90
+ (0, _inherits2["default"])(AgoraRteMicrophoneTrackImpl, _ref3);
89
91
  return (0, _createClass2["default"])(AgoraRteMicrophoneTrackImpl, [{
90
92
  key: "release",
91
93
  value: function release() {
92
94
  this._rtcClient.sourceManager.removeObserver(this._sourceManagerObserver);
95
+ return _constant.AgoraRteReturnCode.SUCCESS;
93
96
  }
94
97
  }, {
95
98
  key: "getAudioEffectEnhancer",
@@ -115,31 +118,32 @@ var AgoraRteMicrophoneTrackImpl = exports.AgoraRteMicrophoneTrackImpl = /*#__PUR
115
118
  key: "setAudioRawDataConfig",
116
119
  value: function setAudioRawDataConfig(config) {
117
120
  // this._rtcClient.sourceManager.setAudioRawDataConfig(this._deviceId, config);
121
+ return _constant.AgoraRteReturnCode.SUCCESS;
118
122
  }
119
123
  }, {
120
124
  key: "start",
121
125
  value: function start() {
122
- this._rtcClient.sourceManager.openMicrophone(this._deviceId);
126
+ return this._rtcClient.sourceManager.openMicrophone(this._deviceId);
123
127
  }
124
128
  }, {
125
129
  key: "stop",
126
130
  value: function stop() {
127
- this._rtcClient.sourceManager.closeMicrophone(this._deviceId);
131
+ return this._rtcClient.sourceManager.closeMicrophone(this._deviceId);
128
132
  }
129
133
  }, {
130
134
  key: "startTest",
131
135
  value: function startTest(interval) {
132
- this._rtcClient.sourceManager.startMicrophoneTest(this._deviceId, interval);
136
+ return this._rtcClient.sourceManager.startMicrophoneTest(this._deviceId, interval);
133
137
  }
134
138
  }, {
135
139
  key: "stopTest",
136
140
  value: function stopTest() {
137
- this._rtcClient.sourceManager.stopMicrophoneTest(this._deviceId);
141
+ return this._rtcClient.sourceManager.stopMicrophoneTest(this._deviceId);
138
142
  }
139
143
  }, {
140
144
  key: "adjustVolume",
141
145
  value: function adjustVolume(volume) {
142
- this._rtcClient.sourceManager.adjustMicrophoneVolume(this._deviceId, volume);
146
+ return this._rtcClient.sourceManager.adjustMicrophoneVolume(this._deviceId, volume);
143
147
  }
144
148
  }, {
145
149
  key: "_handleMicrophoneStateUpdated",
@@ -159,7 +163,7 @@ var AgoraRteMicrophoneTrackImpl = exports.AgoraRteMicrophoneTrackImpl = /*#__PUR
159
163
  }]);
160
164
  }(_ref = _baseTrack.AgoraRteBaseTrack); // @internal
161
165
  _AgoraRteMicrophoneTrackImpl = AgoraRteMicrophoneTrackImpl;
162
- var _applyDecs$e = (0, _slicedToArray2["default"])(_applyDecs(_AgoraRteMicrophoneTrackImpl, [[_imports.trace, 2, "release"], [_imports.trace, 2, "setAudioRawDataConfig"], [_imports.trace, 2, "start"], [_imports.trace, 2, "stop"], [_imports.trace, 2, "startTest"], [_imports.trace, 2, "stopTest"], [_imports.trace, 2, "adjustVolume"], [_imports.bound, 2, "_handleMicrophoneStateUpdated"], [_imports.bound, 2, "_handleLocalMicrophoneVolumeUpdated"]], [], 0, void 0, _ref).e, 1);
166
+ var _applyDecs$e = (0, _slicedToArray2["default"])(_applyDecs(_AgoraRteMicrophoneTrackImpl, [[_imports.trace, 2, "release"], [_setAudioRawDataConfigDecs, 2, "setAudioRawDataConfig"], [_imports.trace, 2, "start"], [_imports.trace, 2, "stop"], [_startTestDecs, 2, "startTest"], [_imports.trace, 2, "stopTest"], [_adjustVolumeDecs, 2, "adjustVolume"], [_imports.bound, 2, "_handleMicrophoneStateUpdated"], [_imports.bound, 2, "_handleLocalMicrophoneVolumeUpdated"]], [], 0, void 0, _ref).e, 1);
163
167
  _initProto = _applyDecs$e[0];
164
168
  var AgoraRteMicrophoneDummyTrackImpl = exports.AgoraRteMicrophoneDummyTrackImpl = /*#__PURE__*/function () {
165
169
  function AgoraRteMicrophoneDummyTrackImpl() {
@@ -178,22 +182,34 @@ var AgoraRteMicrophoneDummyTrackImpl = exports.AgoraRteMicrophoneDummyTrackImpl
178
182
  }
179
183
  }, {
180
184
  key: "setAudioRawDataConfig",
181
- value: function setAudioRawDataConfig(config) {}
185
+ value: function setAudioRawDataConfig(config) {
186
+ return 0;
187
+ }
182
188
  }, {
183
189
  key: "start",
184
- value: function start() {}
190
+ value: function start() {
191
+ return 0;
192
+ }
185
193
  }, {
186
194
  key: "stop",
187
- value: function stop() {}
195
+ value: function stop() {
196
+ return 0;
197
+ }
188
198
  }, {
189
199
  key: "startTest",
190
- value: function startTest(interval) {}
200
+ value: function startTest(interval) {
201
+ return 0;
202
+ }
191
203
  }, {
192
204
  key: "stopTest",
193
- value: function stopTest() {}
205
+ value: function stopTest() {
206
+ return 0;
207
+ }
194
208
  }, {
195
209
  key: "adjustVolume",
196
- value: function adjustVolume(volume) {}
210
+ value: function adjustVolume(volume) {
211
+ return 0;
212
+ }
197
213
  }, {
198
214
  key: "getAudioEffectEnhancer",
199
215
  value: function getAudioEffectEnhancer() {