agora-rte-sdk 3.4.1 → 3.4.2

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 (67) hide show
  1. package/lib/core/engine/ap-detector.d.ts +10 -9
  2. package/lib/core/engine/ap-detector.js +79 -38
  3. package/lib/core/engine/index.js +15 -5
  4. package/lib/core/media/index.d.ts +11 -10
  5. package/lib/core/media/index.js +14 -14
  6. package/lib/core/rtc/canvas.d.ts +16 -3
  7. package/lib/core/rtc/canvas.js +10 -1
  8. package/lib/core/rtc/client.d.ts +10 -0
  9. package/lib/core/rtm/client.d.ts +5 -0
  10. package/lib/core/scene/index.d.ts +13 -6
  11. package/lib/core/scene/index.js +264 -96
  12. package/lib/core/services/api.js +2 -1
  13. package/lib/core/services/type.d.ts +1 -0
  14. package/lib/core/utilities/error.js +6 -6
  15. package/lib/imports.d.ts +7 -4
  16. package/lib/imports.js +22 -6
  17. package/lib/plugin/monitor/index.js +60 -48
  18. package/lib/plugin/restful-client/index.d.ts +3 -2
  19. package/lib/plugin/restful-client/index.js +94 -97
  20. package/lib/plugin/rtc/electron/canvas-helper.d.ts +11 -4
  21. package/lib/plugin/rtc/electron/canvas-helper.js +111 -4
  22. package/lib/plugin/rtc/electron/channel.d.ts +2 -2
  23. package/lib/plugin/rtc/electron/channel.js +17 -56
  24. package/lib/plugin/rtc/electron/client.d.ts +2 -3
  25. package/lib/plugin/rtc/electron/client.js +30 -118
  26. package/lib/plugin/rtc/electron/parameters.js +30 -3
  27. package/lib/plugin/rtc/electron/publisher.d.ts +1 -0
  28. package/lib/plugin/rtc/electron/publisher.js +9 -1
  29. package/lib/plugin/rtc/electron/source-manager.js +1 -1
  30. package/lib/plugin/rtc/electron/utils.d.ts +7 -2
  31. package/lib/plugin/rtc/electron/utils.js +100 -2
  32. package/lib/plugin/rtc/web/canvas-helper.d.ts +7 -2
  33. package/lib/plugin/rtc/web/canvas-helper.js +22 -0
  34. package/lib/plugin/rtc/web/channel.js +4 -4
  35. package/lib/plugin/rtc/web/client.d.ts +2 -0
  36. package/lib/plugin/rtc/web/client.js +13 -1
  37. package/lib/plugin/rtc/web/publisher.d.ts +4 -2
  38. package/lib/plugin/rtc/web/publisher.js +84 -8
  39. package/lib/plugin/rtc/web/subscribe.d.ts +1 -1
  40. package/lib/plugin/rtc/web/subscribe.js +60 -25
  41. package/lib/plugin/rtc/web/track-control/camera.js +10 -10
  42. package/lib/plugin/rtm/channel.js +1 -1
  43. package/lib/plugin/rtm/client.d.ts +1 -0
  44. package/lib/plugin/rtm/client.js +20 -1
  45. package/package.json +5 -5
  46. package/lib/core/monitor/log-upload/handler.d.ts +0 -34
  47. package/lib/core/monitor/log-upload/handler.js +0 -253
  48. package/lib/core/monitor/log-upload/scheduler.d.ts +0 -8
  49. package/lib/core/monitor/log-upload/scheduler.js +0 -94
  50. package/lib/core/monitor/log-upload/type.d.ts +0 -11
  51. package/lib/core/monitor/log-upload/type.js +0 -6
  52. package/lib/plugin/rtc/electron/device.d.ts +0 -37
  53. package/lib/plugin/rtc/electron/device.js +0 -594
  54. package/lib/plugin/rtc/electron/effect-enabler.d.ts +0 -25
  55. package/lib/plugin/rtc/electron/effect-enabler.js +0 -201
  56. package/lib/plugin/rtc/electron/main-channel.d.ts +0 -71
  57. package/lib/plugin/rtc/electron/main-channel.js +0 -769
  58. package/lib/plugin/rtc/electron/publish-state-rectify.d.ts +0 -42
  59. package/lib/plugin/rtc/electron/publish-state-rectify.js +0 -339
  60. package/lib/plugin/rtc/electron/screen-channel.d.ts +0 -45
  61. package/lib/plugin/rtc/electron/screen-channel.js +0 -453
  62. package/lib/plugin/rtc/electron/sub-camera-channel.d.ts +0 -44
  63. package/lib/plugin/rtc/electron/sub-camera-channel.js +0 -255
  64. package/lib/plugin/rtc/web/main-channel.d.ts +0 -51
  65. package/lib/plugin/rtc/web/main-channel.js +0 -604
  66. package/lib/plugin/rtc/web/screen-channel.d.ts +0 -40
  67. package/lib/plugin/rtc/web/screen-channel.js +0 -405
@@ -1,7 +1,6 @@
1
1
  import { AgoraRteError } from '../utilities/error';
2
2
  export interface AgoraRtcAccessPointConfig {
3
3
  serverList: string[];
4
- verifyDomainName?: string;
5
4
  }
6
5
  export interface AgoraWebRtcAccessPointConfig extends AgoraRtcAccessPointConfig {
7
6
  serverDomain?: string;
@@ -20,7 +19,7 @@ export interface AgoraWebRtcAccessPointConfig extends AgoraRtcAccessPointConfig
20
19
  };
21
20
  }
22
21
  export interface AgoraElectronRtcAccessPointConfig extends AgoraRtcAccessPointConfig {
23
- verifyDomainName: string;
22
+ verifyDomainName?: string;
24
23
  }
25
24
  export interface AgoraRteApDetectorObserver {
26
25
  onDetectionSuccess?(): void;
@@ -28,9 +27,7 @@ export interface AgoraRteApDetectorObserver {
28
27
  }
29
28
  export interface AgoraRteApDetector {
30
29
  readonly finished: boolean;
31
- _internalRtcConfig: AgoraRtcAccessPointConfig | undefined;
32
- _externalRtcConfig: AgoraRtcAccessPointConfig | undefined;
33
- init(internalRtcConfig: AgoraRtcAccessPointConfig | undefined, externalRtcConfig: AgoraRtcAccessPointConfig | undefined): void;
30
+ init(internalRtcConfig?: AgoraRtcAccessPointConfig, externalRtcConfig?: AgoraRtcAccessPointConfig): void;
34
31
  /**
35
32
  * 是否需要探测
36
33
  */
@@ -60,18 +57,22 @@ export interface AgoraRteApDetector {
60
57
  */
61
58
  removeObserver(observer: AgoraRteApDetectorObserver): AgoraRteError | void;
62
59
  }
60
+ export declare const isIP: (ip: string) => boolean;
61
+ export declare const isDomainName: (str: string) => boolean;
62
+ export declare const transformUrlToRequestUrl: (url: string, isElectron: boolean, isMock: boolean) => string;
63
63
  export declare class AgoraRteApDetectorImpl implements AgoraRteApDetector {
64
64
  finished: boolean;
65
- _internalRtcConfig: AgoraRtcAccessPointConfig | undefined;
66
- _externalRtcConfig: AgoraRtcAccessPointConfig | undefined;
65
+ private _minCount;
66
+ private _internalRtcConfig?;
67
+ private _externalRtcConfig?;
67
68
  private detectWorkMap;
68
69
  private _apDetectorObserver;
69
70
  private _rawObjGroups;
70
- constructor(internalRtcConfig: AgoraRtcAccessPointConfig | undefined, externalRtcConfig: AgoraRtcAccessPointConfig | undefined);
71
+ private availableRtcAccessPointConfig;
72
+ constructor(internalRtcConfig: AgoraRtcAccessPointConfig, externalRtcConfig: AgoraRtcAccessPointConfig);
71
73
  init(internalRtcConfig: AgoraRtcAccessPointConfig | undefined, externalRtcConfig: AgoraRtcAccessPointConfig | undefined): void;
72
74
  get hasDetectingTask(): boolean;
73
75
  private _getDetectWorkMapRawVal;
74
- private _transformUrlToRequestUrl;
75
76
  private _fetchWithTimeoutAndCheck;
76
77
  private _runTasksWithConcurrency;
77
78
  start(): void;
@@ -3,15 +3,23 @@
3
3
  require("core-js/modules/es.symbol.js");
4
4
  require("core-js/modules/es.symbol.description.js");
5
5
  require("core-js/modules/es.symbol.iterator.js");
6
+ require("core-js/modules/es.array.for-each.js");
6
7
  require("core-js/modules/es.array.from.js");
7
8
  require("core-js/modules/es.date.to-string.js");
9
+ require("core-js/modules/es.object.define-properties.js");
8
10
  require("core-js/modules/es.object.define-property.js");
11
+ require("core-js/modules/es.object.get-own-property-descriptor.js");
12
+ require("core-js/modules/es.object.get-own-property-descriptors.js");
13
+ require("core-js/modules/es.object.keys.js");
9
14
  require("core-js/modules/es.regexp.to-string.js");
15
+ require("core-js/modules/esnext.async-iterator.for-each.js");
16
+ require("core-js/modules/esnext.iterator.for-each.js");
17
+ require("core-js/modules/web.dom-collections.for-each.js");
10
18
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
11
19
  Object.defineProperty(exports, "__esModule", {
12
20
  value: true
13
21
  });
14
- exports.AgoraRteApDetectorImpl = void 0;
22
+ exports.transformUrlToRequestUrl = exports.isIP = exports.isDomainName = exports.AgoraRteApDetectorImpl = void 0;
15
23
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
16
24
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
17
25
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
@@ -34,6 +42,7 @@ require("core-js/modules/es.promise.all-settled.js");
34
42
  require("core-js/modules/es.regexp.exec.js");
35
43
  require("core-js/modules/es.regexp.test.js");
36
44
  require("core-js/modules/es.string.iterator.js");
45
+ require("core-js/modules/es.string.replace.js");
37
46
  require("core-js/modules/esnext.async-iterator.filter.js");
38
47
  require("core-js/modules/esnext.async-iterator.map.js");
39
48
  require("core-js/modules/esnext.iterator.constructor.js");
@@ -41,30 +50,61 @@ require("core-js/modules/esnext.iterator.filter.js");
41
50
  require("core-js/modules/esnext.iterator.map.js");
42
51
  require("core-js/modules/web.dom-collections.iterator.js");
43
52
  var _imports = require("../../imports");
53
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
54
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
44
55
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
45
56
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
46
57
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
47
- var NEED_DETECT_MAX_IP_COUNT = 5;
58
+ // const NEED_DETECT_MAX_IP_COUNT = 5;
48
59
  var DEFAULT_FETCH_URL_TIMEOUT = 300;
49
60
  var isMock = false;
50
61
  // 用于判断是否是IP地址,简单的正则表达式判断示例,可根据实际完善
51
- var isIP = function isIP(ip) {
62
+ var isIP = exports.isIP = function isIP(ip) {
52
63
  var ipRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
53
64
  return ipRegex.test(ip);
54
65
  };
55
66
 
56
67
  // 判断是否为域名的函数
57
- var isDomainName = function isDomainName(str) {
68
+ var isDomainName = exports.isDomainName = function isDomainName(str) {
58
69
  var domainRegex = /^(?!:\/\/)(?=^.{1,253}$)([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
59
70
  return domainRegex.test(str);
60
71
  };
72
+
73
+ // 移除url的前缀 http/https
74
+ var removeHttpPrefix = function removeHttpPrefix(url) {
75
+ // 定义一个正则表达式,用于匹配以 http:// 或 https:// 开头的字符串
76
+ var regex = /^https?:\/\//;
77
+ // 使用 replace 方法替换匹配到的前缀为空字符串
78
+ return url.replace(regex, '');
79
+ };
80
+ var transformUrlToRequestUrl = exports.transformUrlToRequestUrl = function transformUrlToRequestUrl(url, isElectron, isMock) {
81
+ var pureUrl = removeHttpPrefix(url);
82
+ if (isMock) {
83
+ return "http://".concat(pureUrl);
84
+ } else if (isElectron) {
85
+ return "https://".concat(pureUrl);
86
+ } else {
87
+ if (isIP(pureUrl)) {
88
+ var modifiedIp = pureUrl.split('.').join('-') + '.rtctest.com';
89
+ var getUrl = "https://".concat(modifiedIp);
90
+ return getUrl;
91
+ } else if (isDomainName(pureUrl)) {
92
+ return "https://".concat(pureUrl);
93
+ }
94
+ return '';
95
+ }
96
+ };
61
97
  var AgoraRteApDetectorImpl = exports.AgoraRteApDetectorImpl = /*#__PURE__*/function () {
62
98
  function AgoraRteApDetectorImpl(internalRtcConfig, externalRtcConfig) {
63
99
  (0, _classCallCheck2["default"])(this, AgoraRteApDetectorImpl);
64
100
  (0, _defineProperty2["default"])(this, "finished", false);
101
+ (0, _defineProperty2["default"])(this, "_minCount", 5);
65
102
  (0, _defineProperty2["default"])(this, "detectWorkMap", this._getDetectWorkMapRawVal());
66
103
  (0, _defineProperty2["default"])(this, "_apDetectorObserver", new _imports.AgoraObservable());
67
104
  (0, _defineProperty2["default"])(this, "_rawObjGroups", []);
105
+ (0, _defineProperty2["default"])(this, "availableRtcAccessPointConfig", {
106
+ serverList: []
107
+ });
68
108
  this.init(internalRtcConfig, externalRtcConfig);
69
109
  }
70
110
  return (0, _createClass2["default"])(AgoraRteApDetectorImpl, [{
@@ -92,24 +132,6 @@ var AgoraRteApDetectorImpl = exports.AgoraRteApDetectorImpl = /*#__PURE__*/funct
92
132
  };
93
133
  return newMap;
94
134
  }
95
- }, {
96
- key: "_transformUrlToRequestUrl",
97
- value: function _transformUrlToRequestUrl(url) {
98
- if (isMock) {
99
- return "http://".concat(url);
100
- } else if ((0, _imports.isElectron)()) {
101
- return "https://".concat(url);
102
- } else {
103
- if (isIP(url)) {
104
- var modifiedIp = url.split('.').join('-') + '.rtctest.com';
105
- var getUrl = "https://".concat(modifiedIp);
106
- return getUrl;
107
- } else if (isDomainName(url)) {
108
- return "https://".concat(url);
109
- }
110
- return '';
111
- }
112
- }
113
135
 
114
136
  // 请求 url,300ms 内返回 HTTP 状态 为 200 且包体为 hello 表示成功,其他情况均为失败
115
137
  }, {
@@ -166,7 +188,7 @@ var AgoraRteApDetectorImpl = exports.AgoraRteApDetectorImpl = /*#__PURE__*/funct
166
188
  urlObjs = [];
167
189
  for (i = 0; i < rawUrls.length; i++) {
168
190
  rawUrl = rawUrls[i];
169
- requestUrl = this._transformUrlToRequestUrl(rawUrl);
191
+ requestUrl = transformUrlToRequestUrl(rawUrl, (0, _imports.isElectron)(), isMock);
170
192
  if (requestUrl) {
171
193
  urlObjs.push({
172
194
  rawUrl: rawUrl,
@@ -263,7 +285,6 @@ var AgoraRteApDetectorImpl = exports.AgoraRteApDetectorImpl = /*#__PURE__*/funct
263
285
  }
264
286
  var internalIpList = (_this$_internalRtcCon = (_this$_internalRtcCon2 = this._internalRtcConfig) === null || _this$_internalRtcCon2 === void 0 ? void 0 : _this$_internalRtcCon2.serverList) !== null && _this$_internalRtcCon !== void 0 ? _this$_internalRtcCon : [];
265
287
  var externalIpList = (_this$_externalRtcCon = (_this$_externalRtcCon2 = this._externalRtcConfig) === null || _this$_externalRtcCon2 === void 0 ? void 0 : _this$_externalRtcCon2.serverList) !== null && _this$_externalRtcCon !== void 0 ? _this$_externalRtcCon : [];
266
- var maxConcurrency = 5;
267
288
  (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4() {
268
289
  var _this2$detectWorkMap$;
269
290
  var resUrls, internalResultIpList, _resUrls;
@@ -277,13 +298,12 @@ var AgoraRteApDetectorImpl = exports.AgoraRteApDetectorImpl = /*#__PURE__*/funct
277
298
  break;
278
299
  }
279
300
  _context4.next = 4;
280
- return _this2._runTasksWithConcurrency(internalIpList, maxConcurrency);
301
+ return _this2._runTasksWithConcurrency(internalIpList, _this2._minCount);
281
302
  case 4:
282
303
  resUrls = _context4.sent;
283
- _this2.detectWorkMap.internal.result = {
284
- serverList: resUrls,
285
- verifyDomainName: _this2._internalRtcConfig.verifyDomainName
286
- };
304
+ _this2.detectWorkMap.internal.result = _objectSpread(_objectSpread({}, _this2._internalRtcConfig), {}, {
305
+ serverList: resUrls
306
+ });
287
307
  case 6:
288
308
  internalResultIpList = ((_this2$detectWorkMap$ = _this2.detectWorkMap.internal) === null || _this2$detectWorkMap$ === void 0 || (_this2$detectWorkMap$ = _this2$detectWorkMap$.result) === null || _this2$detectWorkMap$ === void 0 ? void 0 : _this2$detectWorkMap$.serverList) || []; // 如果传入了外部IP的合法配置 并且 内网配置结果的ipList未有合格项
289
309
  if (!(_this2._externalRtcConfig && externalIpList.length > 0 && internalResultIpList.length == 0)) {
@@ -291,13 +311,12 @@ var AgoraRteApDetectorImpl = exports.AgoraRteApDetectorImpl = /*#__PURE__*/funct
291
311
  break;
292
312
  }
293
313
  _context4.next = 10;
294
- return _this2._runTasksWithConcurrency(externalIpList, maxConcurrency);
314
+ return _this2._runTasksWithConcurrency(externalIpList, _this2._minCount);
295
315
  case 10:
296
316
  _resUrls = _context4.sent;
297
- _this2.detectWorkMap.external.result = {
298
- serverList: _resUrls,
299
- verifyDomainName: _this2._externalRtcConfig.verifyDomainName
300
- };
317
+ _this2.detectWorkMap.external.result = _objectSpread(_objectSpread({}, _this2._externalRtcConfig), {}, {
318
+ serverList: _resUrls
319
+ });
301
320
  case 12:
302
321
  _this2.detectWorkMap.isDetecting = false;
303
322
  _this2._checkResultAndNotifyResult();
@@ -312,7 +331,7 @@ var AgoraRteApDetectorImpl = exports.AgoraRteApDetectorImpl = /*#__PURE__*/funct
312
331
  key: "_checkResultAndNotifyResult",
313
332
  value: function _checkResultAndNotifyResult() {
314
333
  var cfg = this.getAvailableRtcAccessPointConfig();
315
- if (!cfg) {
334
+ if (!cfg || cfg.serverList.length === 0) {
316
335
  this._apDetectorObserver.notifyObservers('onDetectionFailure');
317
336
  } else {
318
337
  this._apDetectorObserver.notifyObservers('onDetectionSuccess');
@@ -323,11 +342,28 @@ var AgoraRteApDetectorImpl = exports.AgoraRteApDetectorImpl = /*#__PURE__*/funct
323
342
  }, {
324
343
  key: "isDetectRequired",
325
344
  value: function isDetectRequired() {
326
- if (this._internalRtcConfig || this._externalRtcConfig) {
345
+ if (this._internalRtcConfig || this._externalRtcConfig || !isMock) {
327
346
  var _this$_internalRtcCon3, _this$_internalRtcCon4, _this$_externalRtcCon3, _this$_externalRtcCon4;
328
347
  var internalLen = (_this$_internalRtcCon3 = (_this$_internalRtcCon4 = this._internalRtcConfig) === null || _this$_internalRtcCon4 === void 0 ? void 0 : _this$_internalRtcCon4.serverList.length) !== null && _this$_internalRtcCon3 !== void 0 ? _this$_internalRtcCon3 : 0;
329
348
  var externalLen = (_this$_externalRtcCon3 = (_this$_externalRtcCon4 = this._externalRtcConfig) === null || _this$_externalRtcCon4 === void 0 ? void 0 : _this$_externalRtcCon4.serverList.length) !== null && _this$_externalRtcCon3 !== void 0 ? _this$_externalRtcCon3 : 0;
330
- return internalLen >= NEED_DETECT_MAX_IP_COUNT || externalLen >= NEED_DETECT_MAX_IP_COUNT;
349
+ if (internalLen === 0 && externalLen === 0) {
350
+ return false;
351
+ }
352
+ if (internalLen === 0 || externalLen === 0) {
353
+ var _notZeroRtcConfig$ser;
354
+ var notZeroRtcConfig = internalLen === 0 ? this._externalRtcConfig : this._internalRtcConfig;
355
+ var notZeroRtcConfigServerListLen = (_notZeroRtcConfig$ser = notZeroRtcConfig === null || notZeroRtcConfig === void 0 ? void 0 : notZeroRtcConfig.serverList.length) !== null && _notZeroRtcConfig$ser !== void 0 ? _notZeroRtcConfig$ser : 0;
356
+ if (notZeroRtcConfigServerListLen < this._minCount) {
357
+ this.availableRtcAccessPointConfig = _objectSpread({
358
+ serverList: (notZeroRtcConfig === null || notZeroRtcConfig === void 0 ? void 0 : notZeroRtcConfig.serverList) || []
359
+ }, notZeroRtcConfig);
360
+ return false;
361
+ } else {
362
+ return true;
363
+ }
364
+ } else {
365
+ return true;
366
+ }
331
367
  }
332
368
  return false;
333
369
  }
@@ -336,6 +372,9 @@ var AgoraRteApDetectorImpl = exports.AgoraRteApDetectorImpl = /*#__PURE__*/funct
336
372
  value: function stop() {
337
373
  this._rawObjGroups = [];
338
374
  this.detectWorkMap = this._getDetectWorkMapRawVal();
375
+ this.availableRtcAccessPointConfig = {
376
+ serverList: []
377
+ };
339
378
  }
340
379
  }, {
341
380
  key: "isFinished",
@@ -346,16 +385,18 @@ var AgoraRteApDetectorImpl = exports.AgoraRteApDetectorImpl = /*#__PURE__*/funct
346
385
  key: "getAvailableRtcAccessPointConfig",
347
386
  value: function getAvailableRtcAccessPointConfig() {
348
387
  if (!this.isDetectRequired() || this.isFinished()) {
349
- return this._internalRtcConfig || this._externalRtcConfig || null;
388
+ return this.availableRtcAccessPointConfig;
350
389
  }
351
390
  var res = null;
352
391
  var internalResult = this.detectWorkMap.internal.result;
353
392
  if (internalResult && Array.isArray(internalResult.serverList) && internalResult.serverList.length > 0) {
354
393
  res = internalResult;
394
+ this.availableRtcAccessPointConfig = res;
355
395
  }
356
396
  var externalResult = this.detectWorkMap.external.result;
357
397
  if (!res && externalResult && Array.isArray(externalResult.serverList) && externalResult.serverList.length > 0) {
358
398
  res = externalResult;
399
+ this.availableRtcAccessPointConfig = res;
359
400
  }
360
401
  return res;
361
402
  }
@@ -198,7 +198,8 @@ var AgoraRteEngine = exports.AgoraRteEngine = /*#__PURE__*/function () {
198
198
  this._rtcClient.sourceManager.addObserver({
199
199
  onCameraStateUpdated: rteScene.onCameraVideoStateUpdated,
200
200
  onMicrophoneStateUpdated: rteScene.onMicrophoneAudioStateUpdated,
201
- onLoopbackStateUpdated: rteScene.onLoopbackAudioStateUpdated
201
+ onLoopbackStateUpdated: rteScene.onLoopbackAudioStateUpdated,
202
+ onScreenCaptureStateUpdated: rteScene.onScreenCaptureVideoStateUpdated
202
203
  });
203
204
  return rteScene;
204
205
  }
@@ -242,11 +243,20 @@ var AgoraRteEngine = exports.AgoraRteEngine = /*#__PURE__*/function () {
242
243
  }, {
243
244
  key: "setParameters",
244
245
  value: function setParameters(parameters) {
246
+ var _this = this;
245
247
  try {
246
248
  var _ref = parameters,
247
- rtc = _ref.rtc;
249
+ rtc = _ref.rtc,
250
+ rtm = _ref.rtm;
248
251
  if (rtc) {
249
- this._rtcClient.setParameters(rtc);
252
+ rtc.forEach(function (param) {
253
+ _this._rtcClient.setParameters(param);
254
+ });
255
+ }
256
+ if (rtm) {
257
+ rtm.forEach(function (param) {
258
+ _this._rtmClient.setParameters(param);
259
+ });
250
260
  }
251
261
  } catch (e) {
252
262
  this.logger.warn('[AgoraRteEngine] setParameters failed', e);
@@ -303,7 +313,7 @@ var AgoraRteEngine = exports.AgoraRteEngine = /*#__PURE__*/function () {
303
313
  }, {
304
314
  key: "_handlePeerMessageReceived",
305
315
  value: function _handlePeerMessageReceived(userId, message) {
306
- var _this = this;
316
+ var _this2 = this;
307
317
  var _ref2 = JSON.parse(message),
308
318
  list = _ref2.list;
309
319
  list.forEach(function (_ref3) {
@@ -313,7 +323,7 @@ var AgoraRteEngine = exports.AgoraRteEngine = /*#__PURE__*/function () {
313
323
  payload = _ref3$data.payload,
314
324
  fromUser = _ref3$data.fromUser;
315
325
  if (cmd === _type3.AgoraRtePeerMessageCmd.FLEXIBLE) {
316
- _this._observable.notifyObservers('onPeerMessageReceived', {
326
+ _this2._observable.notifyObservers('onPeerMessageReceived', {
317
327
  payload: payload,
318
328
  timestamp: ts,
319
329
  senderId: fromUser.userUuid
@@ -1,6 +1,5 @@
1
1
  import { AgoraRtcAudioOutputRouting, AgoraRtcCapability, AgoraRtcDeviceInfo, AgoraRtcDisplayInfo, AgoraRtcWindowInfo } from '../rtc/type';
2
2
  import { AgoraRteCameraVideoTrack } from './camera';
3
- import { AgoraRteAudioEffectEnhancer, AgoraRteVideoEffectEnhancer } from './effect-enhancer';
4
3
  import { AgoraRteLoopbackAudioTrack } from './loopback';
5
4
  import { AgoraRteMicrophoneAudioTrack } from './microphone';
6
5
  import { AgoraRteScreenVideoTrack } from './screen';
@@ -79,7 +78,7 @@ export interface AgoraRteMediaControl {
79
78
  * Enable/Disable speaker playback.
80
79
  * @param enable Whether to enable speaker playback.
81
80
  */
82
- setEnableSpeaker(enable: boolean): number;
81
+ setEnableSpeaker(enable: boolean): void;
83
82
  /**
84
83
  * Get the current audio output routing of the SDK
85
84
  */
@@ -113,14 +112,6 @@ export interface AgoraRteMediaControl {
113
112
  * Get the volume of the selected speaker
114
113
  */
115
114
  getSelectedSpeakerVolume(): number;
116
- /**
117
- * Get the audio effect enhancer
118
- */
119
- getAudioEffectEnhancer(): AgoraRteAudioEffectEnhancer;
120
- /**
121
- * Get the video effect enhancer
122
- */
123
- getVideoEffectEnhancer(): AgoraRteVideoEffectEnhancer;
124
115
  /**
125
116
  * Check loopback device status
126
117
  * @returns 0 if the loopback device is available; otherwise,
@@ -128,6 +119,16 @@ export interface AgoraRteMediaControl {
128
119
  * 2 if not installed/activated
129
120
  */
130
121
  checkLoopbackDevice(): Promise<number>;
122
+ /**
123
+ * Follow the system speaker
124
+ * @param follow
125
+ */
126
+ followSystemSpeaker(follow: boolean): void;
127
+ /**
128
+ * Follow the system microphone
129
+ * @param follow
130
+ */
131
+ followSystemMicrophone(follow: boolean): void;
131
132
  /**
132
133
  * Adds an observer to be notified of media device events.
133
134
  * @param observer The observer to add.
@@ -3,6 +3,8 @@
3
3
  require("core-js/modules/es.symbol.js");
4
4
  require("core-js/modules/es.symbol.description.js");
5
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");
6
8
  require("core-js/modules/es.array.is-array.js");
7
9
  require("core-js/modules/es.array.push.js");
8
10
  require("core-js/modules/es.date.to-primitive.js");
@@ -20,8 +22,6 @@ Object.defineProperty(exports, "__esModule", {
20
22
  value: true
21
23
  });
22
24
  exports.AgoraRteMediaControlImpl = void 0;
23
- require("core-js/modules/es.error.cause.js");
24
- require("core-js/modules/es.error.to-string.js");
25
25
  require("core-js/modules/es.array.for-each.js");
26
26
  require("core-js/modules/es.array.iterator.js");
27
27
  require("core-js/modules/es.map.js");
@@ -127,6 +127,16 @@ var AgoraRteMediaControlImpl = exports.AgoraRteMediaControlImpl = /*#__PURE__*/f
127
127
  this._rtcClient.addObserver(this._rtcClientObserver);
128
128
  }
129
129
  return (0, _createClass2["default"])(AgoraRteMediaControlImpl, [{
130
+ key: "followSystemSpeaker",
131
+ value: function followSystemSpeaker(follow) {
132
+ this._rtcClient.followSystemSpeaker(follow);
133
+ }
134
+ }, {
135
+ key: "followSystemMicrophone",
136
+ value: function followSystemMicrophone(follow) {
137
+ this._rtcClient.followSystemMicrophone(follow);
138
+ }
139
+ }, {
130
140
  key: "setSelectedSpeaker",
131
141
  value: function setSelectedSpeaker(deviceId) {
132
142
  this._rtcClient.setSelectedSpeaker(deviceId);
@@ -141,16 +151,6 @@ var AgoraRteMediaControlImpl = exports.AgoraRteMediaControlImpl = /*#__PURE__*/f
141
151
  value: function getSelectedSpeakerVolume() {
142
152
  return this._rtcClient.getSelectedSpeakerVolume();
143
153
  }
144
- }, {
145
- key: "getAudioEffectEnhancer",
146
- value: function getAudioEffectEnhancer() {
147
- throw new Error('Method not implemented.');
148
- }
149
- }, {
150
- key: "getVideoEffectEnhancer",
151
- value: function getVideoEffectEnhancer() {
152
- throw new Error('Method not implemented.');
153
- }
154
154
  }, {
155
155
  key: "getAudioOutputRouting",
156
156
  value: function getAudioOutputRouting() {
@@ -159,7 +159,7 @@ var AgoraRteMediaControlImpl = exports.AgoraRteMediaControlImpl = /*#__PURE__*/f
159
159
  }, {
160
160
  key: "setEnableSpeaker",
161
161
  value: function setEnableSpeaker(enable) {
162
- return this._rtcClient.setEnableSpeaker(enable);
162
+ this._rtcClient.setEnableSpeaker(enable);
163
163
  }
164
164
  }, {
165
165
  key: "getCameraVideoTrack",
@@ -272,7 +272,7 @@ var AgoraRteMediaControlImpl = exports.AgoraRteMediaControlImpl = /*#__PURE__*/f
272
272
  }]);
273
273
  }();
274
274
  _AgoraRteMediaControlImpl = AgoraRteMediaControlImpl;
275
- var _applyDecs$e = _applyDecs(_AgoraRteMediaControlImpl, [[_logger.trace, 2, "setSelectedSpeaker"], [_logger.trace, 2, "setSelectedSpeakerVolume"], [_logger.trace, 2, "setEnableSpeaker"], [_logger.trace, 2, "startSpeakerTest"], [_logger.trace, 2, "stopSpeakerTest"], [_logger.trace, 2, "adjustAudioOutputVolume"], [_logger.trace, 2, "release"], [_logger.trace, 2, "checkLoopbackDevice"]], []).e;
275
+ var _applyDecs$e = _applyDecs(_AgoraRteMediaControlImpl, [[_logger.trace, 2, "followSystemSpeaker"], [_logger.trace, 2, "followSystemMicrophone"], [_logger.trace, 2, "setSelectedSpeaker"], [_logger.trace, 2, "setSelectedSpeakerVolume"], [_logger.trace, 2, "setEnableSpeaker"], [_logger.trace, 2, "startSpeakerTest"], [_logger.trace, 2, "stopSpeakerTest"], [_logger.trace, 2, "adjustAudioOutputVolume"], [_logger.trace, 2, "release"], [_logger.trace, 2, "checkLoopbackDevice"]], []).e;
276
276
  var _applyDecs$e2 = (0, _slicedToArray2["default"])(_applyDecs$e, 1);
277
277
  _initProto = _applyDecs$e2[0];
278
278
  _applyDecs$e;
@@ -1,10 +1,23 @@
1
+ import { Logger } from '../../imports';
1
2
  import { AgoraRteRenderView } from '../../type';
2
- import { AgoraRtcRenderMode, AgoraRtcRenderResultType, AgoraRtcRenderSourceType } from './type';
3
+ import { AgoraRtcConnection, AgoraRtcRenderMode, AgoraRtcRenderResultType, AgoraRtcRenderSourceType } from './type';
3
4
  export declare abstract class AgoraRtcCanvasHelper {
5
+ logger: Logger;
4
6
  canvasMap: Map<AgoraRteRenderView, string>;
5
- abstract bind(canvasAddress: unknown, renderSourceId: string, type: AgoraRtcRenderSourceType): AgoraRtcRenderResultType;
6
- abstract unbind(canvasAddress: unknown): number;
7
+ abstract bind(canvasAddress: AgoraRteRenderView, renderSourceId: string, type: AgoraRtcRenderSourceType): AgoraRtcRenderResultType;
8
+ abstract unbind(canvasAddress: AgoraRteRenderView): number;
7
9
  abstract unbindAll(renderSourceId: string, type: AgoraRtcRenderSourceType): number;
10
+ canvasTagPool: Map<AgoraRteRenderView, AgoraRtcCanvasTag>;
11
+ abstract getTagWithCanvasId(canvasAddress: AgoraRteRenderView): AgoraRtcCanvasTag | undefined;
12
+ abstract addTagWithCanvasId(canvasAddress: AgoraRteRenderView, sourceId: string, canvas: AgoraRtcVideoCanvas, connection?: AgoraRtcConnection): void;
13
+ abstract ifNeedStopRenderCanvas(canvasAddress: AgoraRteRenderView): void;
14
+ abstract stopRenderOnAllCanvasWithSourceId(sourceId: string): void;
15
+ }
16
+ export declare class AgoraRtcCanvasTag {
17
+ canvas: AgoraRtcVideoCanvas;
18
+ sourceId: string;
19
+ connection?: AgoraRtcConnection;
20
+ constructor(canvas: AgoraRtcVideoCanvas, sourceId: string, connection?: AgoraRtcConnection);
8
21
  }
9
22
  export declare class AgoraRtcVideoCanvas {
10
23
  readonly view: unknown;
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.AgoraRtcVideoCanvas = exports.AgoraRtcCanvasHelper = void 0;
8
+ exports.AgoraRtcVideoCanvas = exports.AgoraRtcCanvasTag = exports.AgoraRtcCanvasHelper = void 0;
9
9
  require("core-js/modules/es.array.concat.js");
10
10
  require("core-js/modules/es.array.iterator.js");
11
11
  require("core-js/modules/es.date.now.js");
@@ -30,10 +30,19 @@ require("core-js/modules/web.dom-collections.iterator.js");
30
30
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
31
31
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
32
32
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
33
+ var _imports = require("../../imports");
33
34
  var _type = require("./type");
34
35
  var AgoraRtcCanvasHelper = exports.AgoraRtcCanvasHelper = /*#__PURE__*/(0, _createClass2["default"])(function AgoraRtcCanvasHelper() {
35
36
  (0, _classCallCheck2["default"])(this, AgoraRtcCanvasHelper);
37
+ (0, _defineProperty2["default"])(this, "logger", (0, _imports.getLogger)());
36
38
  (0, _defineProperty2["default"])(this, "canvasMap", new Map());
39
+ (0, _defineProperty2["default"])(this, "canvasTagPool", new Map());
40
+ });
41
+ var AgoraRtcCanvasTag = exports.AgoraRtcCanvasTag = /*#__PURE__*/(0, _createClass2["default"])(function AgoraRtcCanvasTag(canvas, sourceId, connection) {
42
+ (0, _classCallCheck2["default"])(this, AgoraRtcCanvasTag);
43
+ this.canvas = canvas;
44
+ this.sourceId = sourceId;
45
+ this.connection = connection;
37
46
  });
38
47
  var AgoraRtcVideoCanvas = exports.AgoraRtcVideoCanvas = /*#__PURE__*/function () {
39
48
  function AgoraRtcVideoCanvas(view, opts) {
@@ -164,4 +164,14 @@ export declare abstract class AgoraRtcClient {
164
164
  * @param config The access point configuration.
165
165
  */
166
166
  abstract setAccessPoint(config: AgoraRtcAccessPointConfig): void;
167
+ /**
168
+ * Follows the system speaker
169
+ * @param follow
170
+ */
171
+ abstract followSystemSpeaker(follow: boolean): number;
172
+ /**
173
+ * Follows the system microphone
174
+ * @param follow
175
+ */
176
+ abstract followSystemMicrophone(follow: boolean): number;
167
177
  }
@@ -44,4 +44,9 @@ export declare abstract class AgoraRtmClient {
44
44
  * @returns A promise that resolves when the message has been sent.
45
45
  */
46
46
  abstract sendPeerMessage(message: string, guaranteedDelivery: boolean, receiverId: string): Promise<void>;
47
+ /**
48
+ * Sets the parameters for the RTM client.
49
+ * @param parameters The parameters to set.
50
+ */
51
+ abstract setParameters(parameters: string): void;
47
52
  }
@@ -6,7 +6,7 @@ import { AgoraRteStreamPlayer } from './stream-player';
6
6
  import { AgoraRteLocalUser } from './local-user';
7
7
  import { AgoraRteServiceApi } from '../services/api';
8
8
  import { AgoraObservable } from '../../imports';
9
- import { AgoraRtcMediaSourceState } from '../rtc/type';
9
+ import { AgoraRtcMediaSourceState, AgoraRtcScreenCaptureType } from '../rtc/type';
10
10
  export declare class AgoraRteScene {
11
11
  protected logger: import("agora-foundation/lib/logger/type").Logger;
12
12
  protected readonly observable: AgoraObservable<Partial<{
@@ -46,13 +46,17 @@ export declare class AgoraRteScene {
46
46
  private _streamPlayer?;
47
47
  private _timestampGap;
48
48
  private _totalUserCount;
49
- private _joinOptions?;
49
+ private _joinSuccess;
50
+ private _joining;
51
+ private _joinState;
50
52
  private _localCameraStateMap;
51
53
  private _localMicrophoneStateMap;
54
+ private _localScreenCaptureStateMap;
52
55
  private _localLoopbackStateMap;
53
56
  private _deviceStateSyncTimer?;
54
57
  private _messageHandlerObservers;
55
58
  private _rtmClientObserver;
59
+ private _deviceSyncMutex;
56
60
  private _startDeviceStateSync;
57
61
  private _stopDeviceStateSync;
58
62
  get apiService(): AgoraRteServiceApi;
@@ -193,8 +197,9 @@ export declare class AgoraRteScene {
193
197
  */
194
198
  removeObserver(observer: AgoraRteSceneObserver): void;
195
199
  onCameraVideoStateUpdated: (deviceId: string, state: AgoraRtcMediaSourceState) => void;
196
- onLoopbackAudioStateUpdated: (deviceId: string, state: AgoraRtcMediaSourceState) => void;
197
200
  onMicrophoneAudioStateUpdated: (deviceId: string, state: AgoraRtcMediaSourceState, error?: Error | undefined) => void;
201
+ onScreenCaptureVideoStateUpdated: (deviceId: string, type: AgoraRtcScreenCaptureType, state: AgoraRtcMediaSourceState) => void;
202
+ onLoopbackAudioStateUpdated: (deviceId: string, state: AgoraRtcMediaSourceState) => void;
198
203
  private _joinRTMChannel;
199
204
  private _entryRoom;
200
205
  private _joinRTCChannel;
@@ -205,9 +210,11 @@ export declare class AgoraRteScene {
205
210
  private _getChannelMessageEventListeners;
206
211
  private _handleUserAdded;
207
212
  private _handleUserRemoved;
208
- private _syncLocalCameraVideoState;
209
- private _syncLocalLoopbackAudioState;
210
- private _syncLocalMicrophoneAudioState;
213
+ private _getLocalCameraVideoStatePatches;
214
+ private _getLocalLoopbackAudioStatePatches;
215
+ private _getLocalMicrophoneAudioStatePatches;
216
+ private _getLocalScreenCaptureVideoStatePatches;
217
+ private _syncDeviceState;
211
218
  private _cleanup;
212
219
  private _keypathObjectToNormalObject;
213
220
  private _setRtcClientAccessPoint;