@tencentcloud/trtc-cloud-wx 0.0.28 → 0.0.30-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/package.json +4 -45
  2. package/{dist/trtc-cloud-wx.js → trtc-cloud-wx.js} +573 -663
  3. package/.babelrc +0 -6
  4. package/.eslintrc.json +0 -129
  5. package/build/chokidar.js +0 -19
  6. package/build/clear.js +0 -24
  7. package/build/copy.js +0 -24
  8. package/build/copy_to_roomkit.js +0 -19
  9. package/dist/package.json +0 -15
  10. package/docs/API/TRTCCloud.html +0 -4353
  11. package/docs/API/index.html +0 -98
  12. package/docs/API/scripts/add-toc.js +0 -57
  13. package/docs/API/scripts/collapse.js +0 -20
  14. package/docs/API/scripts/highlight/highlight.min.js +0 -1282
  15. package/docs/API/scripts/highlight/highlightjs-line-numbers.min.js +0 -1
  16. package/docs/API/scripts/linenumber.js +0 -25
  17. package/docs/API/scripts/nav.js +0 -12
  18. package/docs/API/scripts/polyfill.js +0 -4
  19. package/docs/API/scripts/prettify/Apache-License-2.0.txt +0 -202
  20. package/docs/API/scripts/prettify/lang-css.js +0 -2
  21. package/docs/API/scripts/prettify/prettify.js +0 -28
  22. package/docs/API/scripts/search.js +0 -83
  23. package/docs/API/styles/font.css +0 -81
  24. package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3g3D_vx3rCubqg.woff2 +0 -0
  25. package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3gTD_vx3rCubqg.woff2 +0 -0
  26. package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3gbD_vx3rCubqg.woff2 +0 -0
  27. package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3gfD_vx3rCubqg.woff2 +0 -0
  28. package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3gnD_vx3rCs.woff2 +0 -0
  29. package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459W1hyyTh89ZNpQ.woff2 +0 -0
  30. package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459WRhyyTh89ZNpQ.woff2 +0 -0
  31. package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459WZhyyTh89ZNpQ.woff2 +0 -0
  32. package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459WdhyyTh89ZNpQ.woff2 +0 -0
  33. package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459WlhyyTh89Y.woff2 +0 -0
  34. package/docs/API/styles/highlight/highlight.min.css +0 -26
  35. package/docs/API/styles/highlight/rainbow.min.css +0 -1
  36. package/docs/API/styles/jsdoc.css +0 -684
  37. package/docs/API/styles/prettify.css +0 -79
  38. package/docs/API/styles/toc.css +0 -44
  39. package/docs/API/tutorial-00-guideline.html +0 -81
  40. package/docs/doc-src/home.md +0 -7
  41. package/docs/doc-src/tutorials/00-guideline.md +0 -1
  42. package/docs/doc-src/tutorials/tutorials.json +0 -5
  43. package/jsdoc.json +0 -43
  44. package/rollup.config.js +0 -19
  45. package/sdk_publish.bash +0 -5
  46. package/src/TaskMachine.ts +0 -368
  47. package/src/deviceAuthorize.ts +0 -75
  48. package/src/index.ts +0 -1091
  49. package/src/interface/index.ts +0 -44
  50. package/src/interface/types.ts +0 -88
  51. package/src/log/logger.ts +0 -103
  52. package/src/types.d.ts +0 -1
  53. package/src/utils/common.ts +0 -67
  54. package/src/utils/index.ts +0 -2
  55. package/src/utils/translate.ts +0 -125
  56. package/tsconfig.json +0 -15
  57. package/typedoc.json +0 -21
@@ -6,477 +6,459 @@ var EventEmitter = require('eventemitter3');
6
6
  var TRTC = require('trtc-wx-sdk');
7
7
  var Aegis = require('aegis-mp-sdk');
8
8
 
9
- function _iterableToArrayLimit(arr, i) {
10
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
11
- if (null != _i) {
12
- var _s,
13
- _e,
14
- _x,
15
- _r,
16
- _arr = [],
17
- _n = !0,
18
- _d = !1;
9
+ function _arrayLikeToArray(r, a) {
10
+ (null == a || a > r.length) && (a = r.length);
11
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
12
+ return n;
13
+ }
14
+ function _arrayWithHoles(r) {
15
+ if (Array.isArray(r)) return r;
16
+ }
17
+ function _arrayWithoutHoles(r) {
18
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
19
+ }
20
+ function _classCallCheck(a, n) {
21
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
22
+ }
23
+ function _defineProperties(e, r) {
24
+ for (var t = 0; t < r.length; t++) {
25
+ var o = r[t];
26
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
27
+ }
28
+ }
29
+ function _createClass(e, r, t) {
30
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
31
+ writable: !1
32
+ }), e;
33
+ }
34
+ function _createForOfIteratorHelper(r, e) {
35
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
36
+ if (!t) {
37
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
38
+ t && (r = t);
39
+ var n = 0,
40
+ F = function () {};
41
+ return {
42
+ s: F,
43
+ n: function () {
44
+ return n >= r.length ? {
45
+ done: !0
46
+ } : {
47
+ done: !1,
48
+ value: r[n++]
49
+ };
50
+ },
51
+ e: function (r) {
52
+ throw r;
53
+ },
54
+ f: F
55
+ };
56
+ }
57
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
58
+ }
59
+ var o,
60
+ a = !0,
61
+ u = !1;
62
+ return {
63
+ s: function () {
64
+ t = t.call(r);
65
+ },
66
+ n: function () {
67
+ var r = t.next();
68
+ return a = r.done, r;
69
+ },
70
+ e: function (r) {
71
+ u = !0, o = r;
72
+ },
73
+ f: function () {
74
+ try {
75
+ a || null == t.return || t.return();
76
+ } finally {
77
+ if (u) throw o;
78
+ }
79
+ }
80
+ };
81
+ }
82
+ function _defineProperty(e, r, t) {
83
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
84
+ value: t,
85
+ enumerable: !0,
86
+ configurable: !0,
87
+ writable: !0
88
+ }) : e[r] = t, e;
89
+ }
90
+ function _iterableToArray(r) {
91
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
92
+ }
93
+ function _iterableToArrayLimit(r, l) {
94
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
95
+ if (null != t) {
96
+ var e,
97
+ n,
98
+ i,
99
+ u,
100
+ a = [],
101
+ f = !0,
102
+ o = !1;
19
103
  try {
20
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
21
- if (Object(_i) !== _i) return;
22
- _n = !1;
23
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
24
- } catch (err) {
25
- _d = !0, _e = err;
104
+ if (i = (t = t.call(r)).next, 0 === l) {
105
+ if (Object(t) !== t) return;
106
+ f = !1;
107
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
108
+ } catch (r) {
109
+ o = !0, n = r;
26
110
  } finally {
27
111
  try {
28
- if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
112
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
29
113
  } finally {
30
- if (_d) throw _e;
114
+ if (o) throw n;
31
115
  }
32
116
  }
33
- return _arr;
117
+ return a;
34
118
  }
35
119
  }
120
+ function _nonIterableRest() {
121
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
122
+ }
123
+ function _nonIterableSpread() {
124
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
125
+ }
36
126
  function _regeneratorRuntime() {
37
127
  _regeneratorRuntime = function () {
38
- return exports;
128
+ return e;
39
129
  };
40
- var exports = {},
41
- Op = Object.prototype,
42
- hasOwn = Op.hasOwnProperty,
43
- defineProperty = Object.defineProperty || function (obj, key, desc) {
44
- obj[key] = desc.value;
130
+ var t,
131
+ e = {},
132
+ r = Object.prototype,
133
+ n = r.hasOwnProperty,
134
+ o = Object.defineProperty || function (t, e, r) {
135
+ t[e] = r.value;
45
136
  },
46
- $Symbol = "function" == typeof Symbol ? Symbol : {},
47
- iteratorSymbol = $Symbol.iterator || "@@iterator",
48
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
49
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
50
- function define(obj, key, value) {
51
- return Object.defineProperty(obj, key, {
52
- value: value,
137
+ i = "function" == typeof Symbol ? Symbol : {},
138
+ a = i.iterator || "@@iterator",
139
+ c = i.asyncIterator || "@@asyncIterator",
140
+ u = i.toStringTag || "@@toStringTag";
141
+ function define(t, e, r) {
142
+ return Object.defineProperty(t, e, {
143
+ value: r,
53
144
  enumerable: !0,
54
145
  configurable: !0,
55
146
  writable: !0
56
- }), obj[key];
147
+ }), t[e];
57
148
  }
58
149
  try {
59
150
  define({}, "");
60
- } catch (err) {
61
- define = function (obj, key, value) {
62
- return obj[key] = value;
151
+ } catch (t) {
152
+ define = function (t, e, r) {
153
+ return t[e] = r;
63
154
  };
64
155
  }
65
- function wrap(innerFn, outerFn, self, tryLocsList) {
66
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
67
- generator = Object.create(protoGenerator.prototype),
68
- context = new Context(tryLocsList || []);
69
- return defineProperty(generator, "_invoke", {
70
- value: makeInvokeMethod(innerFn, self, context)
71
- }), generator;
156
+ function wrap(t, e, r, n) {
157
+ var i = e && e.prototype instanceof Generator ? e : Generator,
158
+ a = Object.create(i.prototype),
159
+ c = new Context(n || []);
160
+ return o(a, "_invoke", {
161
+ value: makeInvokeMethod(t, r, c)
162
+ }), a;
72
163
  }
73
- function tryCatch(fn, obj, arg) {
164
+ function tryCatch(t, e, r) {
74
165
  try {
75
166
  return {
76
167
  type: "normal",
77
- arg: fn.call(obj, arg)
168
+ arg: t.call(e, r)
78
169
  };
79
- } catch (err) {
170
+ } catch (t) {
80
171
  return {
81
172
  type: "throw",
82
- arg: err
173
+ arg: t
83
174
  };
84
175
  }
85
176
  }
86
- exports.wrap = wrap;
87
- var ContinueSentinel = {};
177
+ e.wrap = wrap;
178
+ var h = "suspendedStart",
179
+ l = "suspendedYield",
180
+ f = "executing",
181
+ s = "completed",
182
+ y = {};
88
183
  function Generator() {}
89
184
  function GeneratorFunction() {}
90
185
  function GeneratorFunctionPrototype() {}
91
- var IteratorPrototype = {};
92
- define(IteratorPrototype, iteratorSymbol, function () {
186
+ var p = {};
187
+ define(p, a, function () {
93
188
  return this;
94
189
  });
95
- var getProto = Object.getPrototypeOf,
96
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
97
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
98
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
99
- function defineIteratorMethods(prototype) {
100
- ["next", "throw", "return"].forEach(function (method) {
101
- define(prototype, method, function (arg) {
102
- return this._invoke(method, arg);
190
+ var d = Object.getPrototypeOf,
191
+ v = d && d(d(values([])));
192
+ v && v !== r && n.call(v, a) && (p = v);
193
+ var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
194
+ function defineIteratorMethods(t) {
195
+ ["next", "throw", "return"].forEach(function (e) {
196
+ define(t, e, function (t) {
197
+ return this._invoke(e, t);
103
198
  });
104
199
  });
105
200
  }
106
- function AsyncIterator(generator, PromiseImpl) {
107
- function invoke(method, arg, resolve, reject) {
108
- var record = tryCatch(generator[method], generator, arg);
109
- if ("throw" !== record.type) {
110
- var result = record.arg,
111
- value = result.value;
112
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
113
- invoke("next", value, resolve, reject);
114
- }, function (err) {
115
- invoke("throw", err, resolve, reject);
116
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
117
- result.value = unwrapped, resolve(result);
118
- }, function (error) {
119
- return invoke("throw", error, resolve, reject);
201
+ function AsyncIterator(t, e) {
202
+ function invoke(r, o, i, a) {
203
+ var c = tryCatch(t[r], t, o);
204
+ if ("throw" !== c.type) {
205
+ var u = c.arg,
206
+ h = u.value;
207
+ return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
208
+ invoke("next", t, i, a);
209
+ }, function (t) {
210
+ invoke("throw", t, i, a);
211
+ }) : e.resolve(h).then(function (t) {
212
+ u.value = t, i(u);
213
+ }, function (t) {
214
+ return invoke("throw", t, i, a);
120
215
  });
121
216
  }
122
- reject(record.arg);
217
+ a(c.arg);
123
218
  }
124
- var previousPromise;
125
- defineProperty(this, "_invoke", {
126
- value: function (method, arg) {
219
+ var r;
220
+ o(this, "_invoke", {
221
+ value: function (t, n) {
127
222
  function callInvokeWithMethodAndArg() {
128
- return new PromiseImpl(function (resolve, reject) {
129
- invoke(method, arg, resolve, reject);
223
+ return new e(function (e, r) {
224
+ invoke(t, n, e, r);
130
225
  });
131
226
  }
132
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
227
+ return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
133
228
  }
134
229
  });
135
230
  }
136
- function makeInvokeMethod(innerFn, self, context) {
137
- var state = "suspendedStart";
138
- return function (method, arg) {
139
- if ("executing" === state) throw new Error("Generator is already running");
140
- if ("completed" === state) {
141
- if ("throw" === method) throw arg;
142
- return doneResult();
231
+ function makeInvokeMethod(e, r, n) {
232
+ var o = h;
233
+ return function (i, a) {
234
+ if (o === f) throw Error("Generator is already running");
235
+ if (o === s) {
236
+ if ("throw" === i) throw a;
237
+ return {
238
+ value: t,
239
+ done: !0
240
+ };
143
241
  }
144
- for (context.method = method, context.arg = arg;;) {
145
- var delegate = context.delegate;
146
- if (delegate) {
147
- var delegateResult = maybeInvokeDelegate(delegate, context);
148
- if (delegateResult) {
149
- if (delegateResult === ContinueSentinel) continue;
150
- return delegateResult;
242
+ for (n.method = i, n.arg = a;;) {
243
+ var c = n.delegate;
244
+ if (c) {
245
+ var u = maybeInvokeDelegate(c, n);
246
+ if (u) {
247
+ if (u === y) continue;
248
+ return u;
151
249
  }
152
250
  }
153
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
154
- if ("suspendedStart" === state) throw state = "completed", context.arg;
155
- context.dispatchException(context.arg);
156
- } else "return" === context.method && context.abrupt("return", context.arg);
157
- state = "executing";
158
- var record = tryCatch(innerFn, self, context);
159
- if ("normal" === record.type) {
160
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
251
+ if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
252
+ if (o === h) throw o = s, n.arg;
253
+ n.dispatchException(n.arg);
254
+ } else "return" === n.method && n.abrupt("return", n.arg);
255
+ o = f;
256
+ var p = tryCatch(e, r, n);
257
+ if ("normal" === p.type) {
258
+ if (o = n.done ? s : l, p.arg === y) continue;
161
259
  return {
162
- value: record.arg,
163
- done: context.done
260
+ value: p.arg,
261
+ done: n.done
164
262
  };
165
263
  }
166
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
264
+ "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
167
265
  }
168
266
  };
169
267
  }
170
- function maybeInvokeDelegate(delegate, context) {
171
- var methodName = context.method,
172
- method = delegate.iterator[methodName];
173
- if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
174
- var record = tryCatch(method, delegate.iterator, context.arg);
175
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
176
- var info = record.arg;
177
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
268
+ function maybeInvokeDelegate(e, r) {
269
+ var n = r.method,
270
+ o = e.iterator[n];
271
+ if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
272
+ var i = tryCatch(o, e.iterator, r.arg);
273
+ if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
274
+ var a = i.arg;
275
+ return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
178
276
  }
179
- function pushTryEntry(locs) {
180
- var entry = {
181
- tryLoc: locs[0]
277
+ function pushTryEntry(t) {
278
+ var e = {
279
+ tryLoc: t[0]
182
280
  };
183
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
281
+ 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
184
282
  }
185
- function resetTryEntry(entry) {
186
- var record = entry.completion || {};
187
- record.type = "normal", delete record.arg, entry.completion = record;
283
+ function resetTryEntry(t) {
284
+ var e = t.completion || {};
285
+ e.type = "normal", delete e.arg, t.completion = e;
188
286
  }
189
- function Context(tryLocsList) {
287
+ function Context(t) {
190
288
  this.tryEntries = [{
191
289
  tryLoc: "root"
192
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
290
+ }], t.forEach(pushTryEntry, this), this.reset(!0);
193
291
  }
194
- function values(iterable) {
195
- if (iterable) {
196
- var iteratorMethod = iterable[iteratorSymbol];
197
- if (iteratorMethod) return iteratorMethod.call(iterable);
198
- if ("function" == typeof iterable.next) return iterable;
199
- if (!isNaN(iterable.length)) {
200
- var i = -1,
201
- next = function next() {
202
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
203
- return next.value = undefined, next.done = !0, next;
292
+ function values(e) {
293
+ if (e || "" === e) {
294
+ var r = e[a];
295
+ if (r) return r.call(e);
296
+ if ("function" == typeof e.next) return e;
297
+ if (!isNaN(e.length)) {
298
+ var o = -1,
299
+ i = function next() {
300
+ for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
301
+ return next.value = t, next.done = !0, next;
204
302
  };
205
- return next.next = next;
303
+ return i.next = i;
206
304
  }
207
305
  }
208
- return {
209
- next: doneResult
210
- };
211
- }
212
- function doneResult() {
213
- return {
214
- value: undefined,
215
- done: !0
216
- };
306
+ throw new TypeError(typeof e + " is not iterable");
217
307
  }
218
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
308
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
219
309
  value: GeneratorFunctionPrototype,
220
310
  configurable: !0
221
- }), defineProperty(GeneratorFunctionPrototype, "constructor", {
311
+ }), o(GeneratorFunctionPrototype, "constructor", {
222
312
  value: GeneratorFunction,
223
313
  configurable: !0
224
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
225
- var ctor = "function" == typeof genFun && genFun.constructor;
226
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
227
- }, exports.mark = function (genFun) {
228
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
229
- }, exports.awrap = function (arg) {
314
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
315
+ var e = "function" == typeof t && t.constructor;
316
+ return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
317
+ }, e.mark = function (t) {
318
+ return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
319
+ }, e.awrap = function (t) {
230
320
  return {
231
- __await: arg
321
+ __await: t
232
322
  };
233
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
323
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
234
324
  return this;
235
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
236
- void 0 === PromiseImpl && (PromiseImpl = Promise);
237
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
238
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
239
- return result.done ? result.value : iter.next();
325
+ }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
326
+ void 0 === i && (i = Promise);
327
+ var a = new AsyncIterator(wrap(t, r, n, o), i);
328
+ return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
329
+ return t.done ? t.value : a.next();
240
330
  });
241
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
331
+ }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
242
332
  return this;
243
- }), define(Gp, "toString", function () {
333
+ }), define(g, "toString", function () {
244
334
  return "[object Generator]";
245
- }), exports.keys = function (val) {
246
- var object = Object(val),
247
- keys = [];
248
- for (var key in object) keys.push(key);
249
- return keys.reverse(), function next() {
250
- for (; keys.length;) {
251
- var key = keys.pop();
252
- if (key in object) return next.value = key, next.done = !1, next;
335
+ }), e.keys = function (t) {
336
+ var e = Object(t),
337
+ r = [];
338
+ for (var n in e) r.push(n);
339
+ return r.reverse(), function next() {
340
+ for (; r.length;) {
341
+ var t = r.pop();
342
+ if (t in e) return next.value = t, next.done = !1, next;
253
343
  }
254
344
  return next.done = !0, next;
255
345
  };
256
- }, exports.values = values, Context.prototype = {
346
+ }, e.values = values, Context.prototype = {
257
347
  constructor: Context,
258
- reset: function (skipTempReset) {
259
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
348
+ reset: function (e) {
349
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
260
350
  },
261
351
  stop: function () {
262
352
  this.done = !0;
263
- var rootRecord = this.tryEntries[0].completion;
264
- if ("throw" === rootRecord.type) throw rootRecord.arg;
353
+ var t = this.tryEntries[0].completion;
354
+ if ("throw" === t.type) throw t.arg;
265
355
  return this.rval;
266
356
  },
267
- dispatchException: function (exception) {
268
- if (this.done) throw exception;
269
- var context = this;
270
- function handle(loc, caught) {
271
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
357
+ dispatchException: function (e) {
358
+ if (this.done) throw e;
359
+ var r = this;
360
+ function handle(n, o) {
361
+ return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
272
362
  }
273
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
274
- var entry = this.tryEntries[i],
275
- record = entry.completion;
276
- if ("root" === entry.tryLoc) return handle("end");
277
- if (entry.tryLoc <= this.prev) {
278
- var hasCatch = hasOwn.call(entry, "catchLoc"),
279
- hasFinally = hasOwn.call(entry, "finallyLoc");
280
- if (hasCatch && hasFinally) {
281
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
282
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
283
- } else if (hasCatch) {
284
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
363
+ for (var o = this.tryEntries.length - 1; o >= 0; --o) {
364
+ var i = this.tryEntries[o],
365
+ a = i.completion;
366
+ if ("root" === i.tryLoc) return handle("end");
367
+ if (i.tryLoc <= this.prev) {
368
+ var c = n.call(i, "catchLoc"),
369
+ u = n.call(i, "finallyLoc");
370
+ if (c && u) {
371
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
372
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
373
+ } else if (c) {
374
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
285
375
  } else {
286
- if (!hasFinally) throw new Error("try statement without catch or finally");
287
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
376
+ if (!u) throw Error("try statement without catch or finally");
377
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
288
378
  }
289
379
  }
290
380
  }
291
381
  },
292
- abrupt: function (type, arg) {
293
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
294
- var entry = this.tryEntries[i];
295
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
296
- var finallyEntry = entry;
382
+ abrupt: function (t, e) {
383
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
384
+ var o = this.tryEntries[r];
385
+ if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
386
+ var i = o;
297
387
  break;
298
388
  }
299
389
  }
300
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
301
- var record = finallyEntry ? finallyEntry.completion : {};
302
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
390
+ i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
391
+ var a = i ? i.completion : {};
392
+ return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
303
393
  },
304
- complete: function (record, afterLoc) {
305
- if ("throw" === record.type) throw record.arg;
306
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
394
+ complete: function (t, e) {
395
+ if ("throw" === t.type) throw t.arg;
396
+ return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
307
397
  },
308
- finish: function (finallyLoc) {
309
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
310
- var entry = this.tryEntries[i];
311
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
398
+ finish: function (t) {
399
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
400
+ var r = this.tryEntries[e];
401
+ if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
312
402
  }
313
403
  },
314
- catch: function (tryLoc) {
315
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
316
- var entry = this.tryEntries[i];
317
- if (entry.tryLoc === tryLoc) {
318
- var record = entry.completion;
319
- if ("throw" === record.type) {
320
- var thrown = record.arg;
321
- resetTryEntry(entry);
404
+ catch: function (t) {
405
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
406
+ var r = this.tryEntries[e];
407
+ if (r.tryLoc === t) {
408
+ var n = r.completion;
409
+ if ("throw" === n.type) {
410
+ var o = n.arg;
411
+ resetTryEntry(r);
322
412
  }
323
- return thrown;
413
+ return o;
324
414
  }
325
415
  }
326
- throw new Error("illegal catch attempt");
416
+ throw Error("illegal catch attempt");
327
417
  },
328
- delegateYield: function (iterable, resultName, nextLoc) {
418
+ delegateYield: function (e, r, n) {
329
419
  return this.delegate = {
330
- iterator: values(iterable),
331
- resultName: resultName,
332
- nextLoc: nextLoc
333
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
420
+ iterator: values(e),
421
+ resultName: r,
422
+ nextLoc: n
423
+ }, "next" === this.method && (this.arg = t), y;
334
424
  }
335
- }, exports;
425
+ }, e;
336
426
  }
337
- function _typeof(obj) {
338
- "@babel/helpers - typeof";
339
-
340
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
341
- return typeof obj;
342
- } : function (obj) {
343
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
344
- }, _typeof(obj);
427
+ function _slicedToArray(r, e) {
428
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
345
429
  }
346
- function _classCallCheck(instance, Constructor) {
347
- if (!(instance instanceof Constructor)) {
348
- throw new TypeError("Cannot call a class as a function");
349
- }
430
+ function _toConsumableArray(r) {
431
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
350
432
  }
351
- function _defineProperties(target, props) {
352
- for (var i = 0; i < props.length; i++) {
353
- var descriptor = props[i];
354
- descriptor.enumerable = descriptor.enumerable || false;
355
- descriptor.configurable = true;
356
- if ("value" in descriptor) descriptor.writable = true;
357
- Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
358
- }
359
- }
360
- function _createClass(Constructor, protoProps, staticProps) {
361
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
362
- if (staticProps) _defineProperties(Constructor, staticProps);
363
- Object.defineProperty(Constructor, "prototype", {
364
- writable: false
365
- });
366
- return Constructor;
367
- }
368
- function _defineProperty(obj, key, value) {
369
- key = _toPropertyKey(key);
370
- if (key in obj) {
371
- Object.defineProperty(obj, key, {
372
- value: value,
373
- enumerable: true,
374
- configurable: true,
375
- writable: true
376
- });
377
- } else {
378
- obj[key] = value;
433
+ function _toPrimitive(t, r) {
434
+ if ("object" != typeof t || !t) return t;
435
+ var e = t[Symbol.toPrimitive];
436
+ if (void 0 !== e) {
437
+ var i = e.call(t, r || "default");
438
+ if ("object" != typeof i) return i;
439
+ throw new TypeError("@@toPrimitive must return a primitive value.");
379
440
  }
380
- return obj;
381
- }
382
- function _slicedToArray(arr, i) {
383
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
384
- }
385
- function _toConsumableArray(arr) {
386
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
387
- }
388
- function _arrayWithoutHoles(arr) {
389
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
390
- }
391
- function _arrayWithHoles(arr) {
392
- if (Array.isArray(arr)) return arr;
393
- }
394
- function _iterableToArray(iter) {
395
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
396
- }
397
- function _unsupportedIterableToArray(o, minLen) {
398
- if (!o) return;
399
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
400
- var n = Object.prototype.toString.call(o).slice(8, -1);
401
- if (n === "Object" && o.constructor) n = o.constructor.name;
402
- if (n === "Map" || n === "Set") return Array.from(o);
403
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
404
- }
405
- function _arrayLikeToArray(arr, len) {
406
- if (len == null || len > arr.length) len = arr.length;
407
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
408
- return arr2;
409
- }
410
- function _nonIterableSpread() {
411
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
441
+ return ("string" === r ? String : Number)(t);
412
442
  }
413
- function _nonIterableRest() {
414
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
443
+ function _toPropertyKey(t) {
444
+ var i = _toPrimitive(t, "string");
445
+ return "symbol" == typeof i ? i : i + "";
415
446
  }
416
- function _createForOfIteratorHelper(o, allowArrayLike) {
417
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
418
- if (!it) {
419
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
420
- if (it) o = it;
421
- var i = 0;
422
- var F = function () {};
423
- return {
424
- s: F,
425
- n: function () {
426
- if (i >= o.length) return {
427
- done: true
428
- };
429
- return {
430
- done: false,
431
- value: o[i++]
432
- };
433
- },
434
- e: function (e) {
435
- throw e;
436
- },
437
- f: F
438
- };
439
- }
440
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
441
- }
442
- var normalCompletion = true,
443
- didErr = false,
444
- err;
445
- return {
446
- s: function () {
447
- it = it.call(o);
448
- },
449
- n: function () {
450
- var step = it.next();
451
- normalCompletion = step.done;
452
- return step;
453
- },
454
- e: function (e) {
455
- didErr = true;
456
- err = e;
457
- },
458
- f: function () {
459
- try {
460
- if (!normalCompletion && it.return != null) it.return();
461
- } finally {
462
- if (didErr) throw err;
463
- }
464
- }
465
- };
447
+ function _typeof(o) {
448
+ "@babel/helpers - typeof";
449
+
450
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
451
+ return typeof o;
452
+ } : function (o) {
453
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
454
+ }, _typeof(o);
466
455
  }
467
- function _toPrimitive(input, hint) {
468
- if (typeof input !== "object" || input === null) return input;
469
- var prim = input[Symbol.toPrimitive];
470
- if (prim !== undefined) {
471
- var res = prim.call(input, hint || "default");
472
- if (typeof res !== "object") return res;
473
- throw new TypeError("@@toPrimitive must return a primitive value.");
456
+ function _unsupportedIterableToArray(r, a) {
457
+ if (r) {
458
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
459
+ var t = {}.toString.call(r).slice(8, -1);
460
+ 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;
474
461
  }
475
- return (hint === "string" ? String : Number)(input);
476
- }
477
- function _toPropertyKey(arg) {
478
- var key = _toPrimitive(arg, "string");
479
- return typeof key === "symbol" ? key : String(key);
480
462
  }
481
463
 
482
464
  /******************************************************************************
@@ -493,7 +475,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
493
475
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
494
476
  PERFORMANCE OF THIS SOFTWARE.
495
477
  ***************************************************************************** */
496
- /* global Reflect, Promise, SuppressedError, Symbol */
478
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
497
479
 
498
480
  function __decorate(decorators, target, key, desc) {
499
481
  var c = arguments.length,
@@ -622,6 +604,13 @@ exports.TRTCBeautyStyle = void 0;
622
604
  TRTCBeautyStyle[TRTCBeautyStyle["TRTCBeautyStyleSmooth"] = 0] = "TRTCBeautyStyleSmooth";
623
605
  TRTCBeautyStyle[TRTCBeautyStyle["TRTCBeautyStyleNature"] = 1] = "TRTCBeautyStyleNature";
624
606
  })(exports.TRTCBeautyStyle || (exports.TRTCBeautyStyle = {}));
607
+ exports.TRTCAudioRoute = void 0;
608
+ (function (TRTCAudioRoute) {
609
+ /** 扬声器模式 */
610
+ TRTCAudioRoute[TRTCAudioRoute["TRTC_AUDIO_ROUTE_SPEAKER"] = 0] = "TRTC_AUDIO_ROUTE_SPEAKER";
611
+ /** 听筒模式 */
612
+ TRTCAudioRoute[TRTCAudioRoute["TRTC_AUDIO_ROUTE_EARPIECE"] = 1] = "TRTC_AUDIO_ROUTE_EARPIECE";
613
+ })(exports.TRTCAudioRoute || (exports.TRTCAudioRoute = {}));
625
614
 
626
615
  var Handletype;
627
616
  (function (Handletype) {
@@ -738,7 +727,7 @@ var Task = /*#__PURE__*/function () {
738
727
  this.type = ((_a = TaskMap[name]) === null || _a === void 0 ? void 0 : _a.type) || Handletype.setPusher;
739
728
  this.sequenceNumber = Task.nextSequenceNumber++;
740
729
  }
741
- _createClass(Task, [{
730
+ return _createClass(Task, [{
742
731
  key: "whetherSingle",
743
732
  value: function whetherSingle(funName) {
744
733
  switch (funName) {
@@ -749,7 +738,6 @@ var Task = /*#__PURE__*/function () {
749
738
  }
750
739
  }
751
740
  }]);
752
- return Task;
753
741
  }();
754
742
  Task.nextSequenceNumber = 0;
755
743
  var TaskQueueState;
@@ -773,7 +761,7 @@ var TaskMachine = /*#__PURE__*/function () {
773
761
  this.playerTasks = {}; // 存储每个 player 的任务队列
774
762
  this.state = TaskQueueState.IDLE;
775
763
  }
776
- _createClass(TaskMachine, [{
764
+ return _createClass(TaskMachine, [{
777
765
  key: "reset",
778
766
  value: function reset() {
779
767
  this.state = TaskQueueState.IDLE;
@@ -1112,7 +1100,6 @@ var TaskMachine = /*#__PURE__*/function () {
1112
1100
  }));
1113
1101
  }
1114
1102
  }]);
1115
- return TaskMachine;
1116
1103
  }();
1117
1104
  var taskMachine = new TaskMachine();
1118
1105
  var setHandle = function setHandle(target, key, descriptor) {
@@ -1144,7 +1131,7 @@ var setHandle = function setHandle(target, key, descriptor) {
1144
1131
  return descriptor;
1145
1132
  };
1146
1133
 
1147
- var _TRTCVideoResolutionM, _TRTCBeautyStyleMap, _TRTCVideoFillModeMap;
1134
+ var _TRTCVideoResolutionM;
1148
1135
  var translateTRTCAppScene = function translateTRTCAppScene(scene) {
1149
1136
  switch (scene) {
1150
1137
  case 0:
@@ -1174,7 +1161,7 @@ var translateTRTCVideoStreamType = function translateTRTCVideoStreamType(streamT
1174
1161
  var translateTRTCStreamId = function translateTRTCStreamId(userId, streamType) {
1175
1162
  return "".concat(userId, "_").concat(translateTRTCVideoStreamType(streamType));
1176
1163
  };
1177
- var TRTCVideoResolutionMap = (_TRTCVideoResolutionM = {}, _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_120_120, [120, 120]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_160_160, [160, 160]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_270_270, [270, 270]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_480_480, [480, 480]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_160_120, [160, 120]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_240_180, [240, 180]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_280_210, [280, 210]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_320_240, [320, 240]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_400_300, [400, 300]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_480_360, [480, 360]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_640_480, [640, 480]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_960_720, [960, 720]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_160_90, [160, 90]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_256_144, [256, 144]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_320_180, [320, 180]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_480_270, [480, 270]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_640_360, [640, 360]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_960_540, [960, 540]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_1280_720, [1280, 720]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_1920_1080, [1920, 1080]), _TRTCVideoResolutionM);
1164
+ var TRTCVideoResolutionMap = (_TRTCVideoResolutionM = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_120_120, [120, 120]), exports.TRTCVideoResolution.TRTCVideoResolution_160_160, [160, 160]), exports.TRTCVideoResolution.TRTCVideoResolution_270_270, [270, 270]), exports.TRTCVideoResolution.TRTCVideoResolution_480_480, [480, 480]), exports.TRTCVideoResolution.TRTCVideoResolution_160_120, [160, 120]), exports.TRTCVideoResolution.TRTCVideoResolution_240_180, [240, 180]), exports.TRTCVideoResolution.TRTCVideoResolution_280_210, [280, 210]), exports.TRTCVideoResolution.TRTCVideoResolution_320_240, [320, 240]), exports.TRTCVideoResolution.TRTCVideoResolution_400_300, [400, 300]), exports.TRTCVideoResolution.TRTCVideoResolution_480_360, [480, 360]), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_640_480, [640, 480]), exports.TRTCVideoResolution.TRTCVideoResolution_960_720, [960, 720]), exports.TRTCVideoResolution.TRTCVideoResolution_160_90, [160, 90]), exports.TRTCVideoResolution.TRTCVideoResolution_256_144, [256, 144]), exports.TRTCVideoResolution.TRTCVideoResolution_320_180, [320, 180]), exports.TRTCVideoResolution.TRTCVideoResolution_480_270, [480, 270]), exports.TRTCVideoResolution.TRTCVideoResolution_640_360, [640, 360]), exports.TRTCVideoResolution.TRTCVideoResolution_960_540, [960, 540]), exports.TRTCVideoResolution.TRTCVideoResolution_1280_720, [1280, 720]), exports.TRTCVideoResolution.TRTCVideoResolution_1920_1080, [1920, 1080]));
1178
1165
  var translateTRTCVideoResolution = function translateTRTCVideoResolution(resolution) {
1179
1166
  var _TRTCVideoResolutionM2 = _slicedToArray(TRTCVideoResolutionMap[resolution], 2),
1180
1167
  _TRTCVideoResolutionM3 = _TRTCVideoResolutionM2[0],
@@ -1218,11 +1205,21 @@ var translateTRTCVideoMirrorType = function translateTRTCVideoMirrorType(mirrorT
1218
1205
  return '';
1219
1206
  }
1220
1207
  };
1221
- var TRTCBeautyStyleMap = (_TRTCBeautyStyleMap = {}, _defineProperty(_TRTCBeautyStyleMap, exports.TRTCBeautyStyle.TRTCBeautyStyleSmooth, 'smooth'), _defineProperty(_TRTCBeautyStyleMap, exports.TRTCBeautyStyle.TRTCBeautyStyleNature, 'nature'), _TRTCBeautyStyleMap);
1208
+ var translateTRTCAudioRoute = function translateTRTCAudioRoute(route) {
1209
+ switch (route) {
1210
+ case exports.TRTCAudioRoute.TRTC_AUDIO_ROUTE_SPEAKER:
1211
+ return 'speaker';
1212
+ case exports.TRTCAudioRoute.TRTC_AUDIO_ROUTE_EARPIECE:
1213
+ return 'ear';
1214
+ default:
1215
+ return '';
1216
+ }
1217
+ };
1218
+ var TRTCBeautyStyleMap = _defineProperty(_defineProperty({}, exports.TRTCBeautyStyle.TRTCBeautyStyleSmooth, 'smooth'), exports.TRTCBeautyStyle.TRTCBeautyStyleNature, 'nature');
1222
1219
  var translateBeautyStyle = function translateBeautyStyle(beautyStyle) {
1223
1220
  return TRTCBeautyStyleMap[beautyStyle];
1224
1221
  };
1225
- var TRTCVideoFillModeMap = (_TRTCVideoFillModeMap = {}, _defineProperty(_TRTCVideoFillModeMap, exports.TRTCVideoFillMode.TRTCVideoFillMode_Fill, 'fillCrop'), _defineProperty(_TRTCVideoFillModeMap, exports.TRTCVideoFillMode.TRTCVideoFillMode_Fit, 'contain'), _TRTCVideoFillModeMap);
1222
+ var TRTCVideoFillModeMap = _defineProperty(_defineProperty({}, exports.TRTCVideoFillMode.TRTCVideoFillMode_Fill, 'fillCrop'), exports.TRTCVideoFillMode.TRTCVideoFillMode_Fit, 'contain');
1226
1223
  var translateVideoFillMod = function translateVideoFillMod(videoFillMod) {
1227
1224
  return TRTCVideoFillModeMap[videoFillMod];
1228
1225
  };
@@ -1274,37 +1271,19 @@ var formatTime = function formatTime() {
1274
1271
  second = second < 10 ? "0".concat(second) : second;
1275
1272
  return "".concat(hour, ":").concat(minute, ":").concat(second, ".").concat(millisecond);
1276
1273
  };
1277
- function debounce(func, wait) {
1278
- var timeout = null;
1279
- return function () {
1280
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1281
- args[_key] = arguments[_key];
1282
- }
1283
- // 清除上一次的定时器
1284
- if (timeout) {
1285
- clearTimeout(timeout);
1286
- }
1287
- // 设置一个新的定时器,在 wait 毫秒后执行原函数
1288
- timeout = setTimeout(function () {
1289
- func.apply(void 0, args);
1290
- timeout = null;
1291
- }, wait);
1292
- };
1293
- }
1294
1274
 
1295
1275
  var aegis = new Aegis({
1296
1276
  id: 'iHWefAYqxoRsFYGQvR' // 项目ID,即上报id
1297
1277
  });
1298
-
1299
1278
  var LOGLEVEL = {
1300
1279
  LOG: 0,
1301
1280
  INFO: 1,
1302
1281
  DEBUG: 2,
1303
1282
  WARN: 3,
1304
1283
  ERROR: 4,
1284
+ // 无日志记录级别,sdk将不打印任何日志
1305
1285
  NON_LOGGING: 5 // 无日志记录级别,sdk将不打印任何日志
1306
1286
  };
1307
-
1308
1287
  var Logger = /*#__PURE__*/function () {
1309
1288
  function Logger(tagName) {
1310
1289
  _classCallCheck(this, Logger);
@@ -1312,7 +1291,7 @@ var Logger = /*#__PURE__*/function () {
1312
1291
  this.TAG_NAME = '';
1313
1292
  this.TAG_NAME = tagName || '[TRTCCloud-WX]';
1314
1293
  }
1315
- _createClass(Logger, [{
1294
+ return _createClass(Logger, [{
1316
1295
  key: "loggerInfo",
1317
1296
  value: function loggerInfo() {
1318
1297
  if (Number(this.sdkAppId) !== 1400188366 && Number(this.sdkAppId) !== 1400704311) return;
@@ -1408,18 +1387,17 @@ var Logger = /*#__PURE__*/function () {
1408
1387
  }
1409
1388
  }
1410
1389
  }]);
1411
- return Logger;
1412
1390
  }();
1413
1391
  var logger = new Logger();
1414
1392
 
1415
1393
  var name = "@tencentcloud/trtc-cloud-wx";
1416
- var version = "0.0.28";
1394
+ var version = "0.0.30-beta.0";
1417
1395
  var description = "";
1418
1396
  var main = "dist/trtc-cloud-wx.js";
1419
1397
  var module$1 = "dist/trtc-cloud-wx.js";
1420
1398
  var type = "module";
1421
1399
  var scripts = {
1422
- build: "npm run clear && rollup -c && node ./build/copy_to_roomkit.js",
1400
+ build: "npm run clear && rollup -c",
1423
1401
  dev: "node ./build/chokidar.js",
1424
1402
  clear: "node ./build/clear.js",
1425
1403
  copy: "node ./build/copy.js",
@@ -1482,132 +1460,6 @@ var packageJson = {
1482
1460
  dependencies: dependencies
1483
1461
  };
1484
1462
 
1485
- var DeviceScope;
1486
- (function (DeviceScope) {
1487
- DeviceScope["RECORD"] = "scope.record";
1488
- DeviceScope["CAMERA"] = "scope.camera";
1489
- })(DeviceScope || (DeviceScope = {}));
1490
- var DeviceType;
1491
- (function (DeviceType) {
1492
- DeviceType["MIC"] = "mic";
1493
- DeviceType["CAMERA"] = "camera";
1494
- })(DeviceType || (DeviceType = {}));
1495
- /**
1496
- * 获取设备权限,查看当前是否有麦克风以及摄像头权限
1497
- * @param {Object} params - 参数对象
1498
- * @param {Boolean} params.microphone 麦克风权限
1499
- * @param {Boolean} params.camera 摄像头权限
1500
- */
1501
- function deviceCheck(types) {
1502
- return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1503
- var microphone, camera, res, isMicrophone, isCamera;
1504
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1505
- while (1) switch (_context.prev = _context.next) {
1506
- case 0:
1507
- if (types) {
1508
- _context.next = 2;
1509
- break;
1510
- }
1511
- return _context.abrupt("return", false);
1512
- case 2:
1513
- microphone = types.includes(DeviceType.MIC);
1514
- camera = types.includes(DeviceType.CAMERA);
1515
- _context.prev = 4;
1516
- _context.next = 7;
1517
- return wx.getSetting();
1518
- case 7:
1519
- res = _context.sent;
1520
- isMicrophone = res.authSetting[DeviceScope.RECORD];
1521
- isCamera = res.authSetting[DeviceScope.CAMERA]; // 同时检查麦克风和摄像头权限
1522
- if (!(microphone && camera)) {
1523
- _context.next = 12;
1524
- break;
1525
- }
1526
- return _context.abrupt("return", isMicrophone && isCamera);
1527
- case 12:
1528
- if (!microphone) {
1529
- _context.next = 14;
1530
- break;
1531
- }
1532
- return _context.abrupt("return", isMicrophone);
1533
- case 14:
1534
- if (!camera) {
1535
- _context.next = 16;
1536
- break;
1537
- }
1538
- return _context.abrupt("return", isCamera);
1539
- case 16:
1540
- return _context.abrupt("return", false);
1541
- case 19:
1542
- _context.prev = 19;
1543
- _context.t0 = _context["catch"](4);
1544
- return _context.abrupt("return", false);
1545
- case 22:
1546
- case "end":
1547
- return _context.stop();
1548
- }
1549
- }, _callee, null, [[4, 19]]);
1550
- }));
1551
- }
1552
- function permissionPopup() {
1553
- wx.showModal({
1554
- title: '设备授权',
1555
- content: '使用音视频功能请对相应设备进行授权',
1556
- confirmText: '去设置',
1557
- success: function success(res) {
1558
- if (res.confirm) {
1559
- wx.openSetting();
1560
- }
1561
- }
1562
- });
1563
- }
1564
- var debouncePermissionPopup = debounce(permissionPopup, 300);
1565
- function deviceAuthorize(deviceType, scope) {
1566
- return function (target, key, descriptor) {
1567
- var originalMethod = descriptor.value;
1568
- descriptor.value = function () {
1569
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1570
- args[_key] = arguments[_key];
1571
- }
1572
- return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
1573
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1574
- while (1) switch (_context2.prev = _context2.next) {
1575
- case 0:
1576
- _context2.next = 2;
1577
- return deviceCheck([deviceType]);
1578
- case 2:
1579
- if (_context2.sent) {
1580
- _context2.next = 13;
1581
- break;
1582
- }
1583
- _context2.prev = 3;
1584
- _context2.next = 6;
1585
- return wx.authorize({
1586
- scope: scope
1587
- });
1588
- case 6:
1589
- _context2.next = 12;
1590
- break;
1591
- case 8:
1592
- _context2.prev = 8;
1593
- _context2.t0 = _context2["catch"](3);
1594
- debouncePermissionPopup();
1595
- throw new Error(_context2.t0);
1596
- case 12:
1597
- return _context2.abrupt("return");
1598
- case 13:
1599
- return _context2.abrupt("return", originalMethod.apply(this, args));
1600
- case 14:
1601
- case "end":
1602
- return _context2.stop();
1603
- }
1604
- }, _callee2, this, [[3, 8]]);
1605
- }));
1606
- };
1607
- return descriptor;
1608
- };
1609
- }
1610
-
1611
1463
  /**
1612
1464
  * TRTCCloud
1613
1465
  * @interface
@@ -1626,6 +1478,7 @@ var TRTCCloud = /*#__PURE__*/function () {
1626
1478
  this.isEnterRoom = false;
1627
1479
  this.isVideoMuted = false;
1628
1480
  this.isOpenCamera = false;
1481
+ this.currentSoundMode = exports.TRTCAudioRoute.TRTC_AUDIO_ROUTE_SPEAKER;
1629
1482
  this.audioVolumeEvaluation = 0;
1630
1483
  this.allTimer = {};
1631
1484
  this.renderMap = new Map();
@@ -1636,7 +1489,7 @@ var TRTCCloud = /*#__PURE__*/function () {
1636
1489
  * 获取 TRTCCloud 实例(单例模式)
1637
1490
  * @category Base
1638
1491
  */
1639
- _createClass(TRTCCloud, [{
1492
+ return _createClass(TRTCCloud, [{
1640
1493
  key: "getSDKVersion",
1641
1494
  value: function getSDKVersion() {
1642
1495
  return this.version;
@@ -1668,6 +1521,7 @@ var TRTCCloud = /*#__PURE__*/function () {
1668
1521
  this.isEnterRoom = false;
1669
1522
  this.isVideoMuted = false;
1670
1523
  this.isOpenCamera = false;
1524
+ this.currentSoundMode = exports.TRTCAudioRoute.TRTC_AUDIO_ROUTE_SPEAKER;
1671
1525
  taskMachine.reset();
1672
1526
  Object.keys(this.allTimer).forEach(function (key) {
1673
1527
  clearInterval(_this.allTimer[key]);
@@ -1923,15 +1777,21 @@ var TRTCCloud = /*#__PURE__*/function () {
1923
1777
  return this.setAttributes({
1924
1778
  params: {
1925
1779
  sdkAppID: sdkAppId,
1780
+ // 您的腾讯云账号
1926
1781
  userID: userId,
1782
+ // 当前进房用户的userID
1927
1783
  userSig: userSig,
1784
+ // 您服务端生成的userSig
1928
1785
  roomID: roomId,
1786
+ // 您进房的房间号,
1929
1787
  strRoomID: strRoomId,
1930
1788
  role: role,
1931
1789
  privateMapKey: privateMapKey,
1932
1790
  scene: translateTRTCAppScene(scene),
1933
1791
  enableMic: false,
1792
+ // 进房默认开启音频上行
1934
1793
  enableCamera: false,
1794
+ // 进房默认开启视频上行
1935
1795
  videoPreview: false
1936
1796
  }
1937
1797
  }, 'enterRoom');
@@ -2054,6 +1914,9 @@ var TRTCCloud = /*#__PURE__*/function () {
2054
1914
  }, {
2055
1915
  key: "setDefaultStreamRecvMode",
2056
1916
  value: function setDefaultStreamRecvMode() {}
1917
+ }, {
1918
+ key: "useVirtualBackground",
1919
+ value: function useVirtualBackground() {}
2057
1920
  /**
2058
1921
  * 启动本地摄像头采集和预览
2059
1922
  * @category 视频
@@ -2061,44 +1924,46 @@ var TRTCCloud = /*#__PURE__*/function () {
2061
1924
  }, {
2062
1925
  key: "startLocalPreview",
2063
1926
  value: function startLocalPreview() {
2064
- var frontCamera = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
2065
- return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
1927
+ return __awaiter(this, arguments, void 0, function () {
2066
1928
  var _this8 = this;
2067
- var pusher;
2068
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
2069
- while (1) switch (_context4.prev = _context4.next) {
2070
- case 0:
2071
- logger.info('startLocalPreview with options: ', frontCamera);
2072
- if (!(this.role !== exports.TRTCRoleType.TRTCRoleAnchor)) {
2073
- _context4.next = 3;
2074
- break;
2075
- }
2076
- return _context4.abrupt("return");
2077
- case 3:
2078
- _context4.next = 5;
2079
- return this.setAttributes({
2080
- params: function params() {
2081
- return {
2082
- videoPreview: _this8.isEnterRoom ? _this8.isVideoMuted : true,
2083
- enableCamera: _this8.isEnterRoom ? !_this8.isVideoMuted : false,
2084
- frontCamera: frontCamera ? 'front' : 'back'
2085
- };
1929
+ var frontCamera = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
1930
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
1931
+ var pusher;
1932
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1933
+ while (1) switch (_context4.prev = _context4.next) {
1934
+ case 0:
1935
+ logger.info('startLocalPreview with options: ', frontCamera);
1936
+ if (!(_this8.role !== exports.TRTCRoleType.TRTCRoleAnchor)) {
1937
+ _context4.next = 3;
1938
+ break;
2086
1939
  }
2087
- }, 'startLocalPreview');
2088
- case 5:
2089
- pusher = _context4.sent;
2090
- logger.info('startLocalPreview success');
2091
- this.emit('onFirstVideoFrame', '', exports.TRTCVideoStreamType.TRTCVideoStreamTypeBig, pusher.videoWidth, pusher.videoHeight);
2092
- if (this.isEnterRoom) {
2093
- this.emit('onSendFirstLocalVideoFrame', exports.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
2094
- }
2095
- this.isOpenCamera = true;
2096
- case 10:
2097
- case "end":
2098
- return _context4.stop();
2099
- }
2100
- }, _callee4, this);
2101
- }));
1940
+ return _context4.abrupt("return");
1941
+ case 3:
1942
+ _context4.next = 5;
1943
+ return _this8.setAttributes({
1944
+ params: function params() {
1945
+ return {
1946
+ videoPreview: _this8.isEnterRoom ? _this8.isVideoMuted : true,
1947
+ enableCamera: _this8.isEnterRoom ? !_this8.isVideoMuted : false,
1948
+ frontCamera: frontCamera ? 'front' : 'back'
1949
+ };
1950
+ }
1951
+ }, 'startLocalPreview');
1952
+ case 5:
1953
+ pusher = _context4.sent;
1954
+ logger.info('startLocalPreview success');
1955
+ _this8.emit('onFirstVideoFrame', '', exports.TRTCVideoStreamType.TRTCVideoStreamTypeBig, pusher.videoWidth, pusher.videoHeight);
1956
+ if (_this8.isEnterRoom) {
1957
+ _this8.emit('onSendFirstLocalVideoFrame', exports.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
1958
+ }
1959
+ _this8.isOpenCamera = true;
1960
+ case 10:
1961
+ case "end":
1962
+ return _context4.stop();
1963
+ }
1964
+ }, _callee4);
1965
+ })();
1966
+ });
2102
1967
  }
2103
1968
  /**
2104
1969
  * 停止本地摄像头采集和预览
@@ -2227,9 +2092,10 @@ var TRTCCloud = /*#__PURE__*/function () {
2227
2092
  view: view
2228
2093
  }, 'startRemoteView');
2229
2094
  case 5:
2095
+ this.updateAudioRoute();
2230
2096
  logger.info('startRemoteView success');
2231
2097
  this.emit('onFirstVideoFrame', userId, streamType, 0, 0);
2232
- case 7:
2098
+ case 8:
2233
2099
  case "end":
2234
2100
  return _context7.stop();
2235
2101
  }
@@ -2627,16 +2493,78 @@ var TRTCCloud = /*#__PURE__*/function () {
2627
2493
  }));
2628
2494
  }
2629
2495
  }, {
2630
- key: "muteRemoteAudio",
2631
- value: function muteRemoteAudio(userId, mute) {
2496
+ key: "setAudioRoute",
2497
+ value: function setAudioRoute(route) {
2632
2498
  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2633
- var streamId;
2499
+ var soundMode;
2634
2500
  return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2635
2501
  while (1) switch (_context21.prev = _context21.next) {
2502
+ case 0:
2503
+ logger.info('setAudioRoute with options: ', route);
2504
+ this.currentSoundMode = route;
2505
+ soundMode = translateTRTCAudioRoute(route);
2506
+ _context21.prev = 3;
2507
+ _context21.next = 6;
2508
+ return this.playerAudioRouteChange({
2509
+ soundMode: soundMode
2510
+ });
2511
+ case 6:
2512
+ logger.info('setAudioRoute success');
2513
+ _context21.next = 13;
2514
+ break;
2515
+ case 9:
2516
+ _context21.prev = 9;
2517
+ _context21.t0 = _context21["catch"](3);
2518
+ logger.error('Error in setAttributes: ', _context21.t0);
2519
+ throw _context21.t0;
2520
+ case 13:
2521
+ case "end":
2522
+ return _context21.stop();
2523
+ }
2524
+ }, _callee21, this, [[3, 9]]);
2525
+ }));
2526
+ }
2527
+ }, {
2528
+ key: "updateAudioRoute",
2529
+ value: function updateAudioRoute() {
2530
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
2531
+ var soundMode;
2532
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2533
+ while (1) switch (_context22.prev = _context22.next) {
2534
+ case 0:
2535
+ logger.info('updateAudioRoute with options: ', this.currentSoundMode);
2536
+ soundMode = translateTRTCAudioRoute(this.currentSoundMode);
2537
+ _context22.prev = 2;
2538
+ _context22.next = 5;
2539
+ return this.playerAudioRouteChange({
2540
+ soundMode: soundMode
2541
+ });
2542
+ case 5:
2543
+ _context22.next = 11;
2544
+ break;
2545
+ case 7:
2546
+ _context22.prev = 7;
2547
+ _context22.t0 = _context22["catch"](2);
2548
+ logger.error('Error in setAttributes: ', _context22.t0);
2549
+ throw _context22.t0;
2550
+ case 11:
2551
+ case "end":
2552
+ return _context22.stop();
2553
+ }
2554
+ }, _callee22, this, [[2, 7]]);
2555
+ }));
2556
+ }
2557
+ }, {
2558
+ key: "muteRemoteAudio",
2559
+ value: function muteRemoteAudio(userId, mute) {
2560
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
2561
+ var streamId;
2562
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2563
+ while (1) switch (_context23.prev = _context23.next) {
2636
2564
  case 0:
2637
2565
  logger.info('muteRemoteAudio with options: ', userId, mute);
2638
2566
  streamId = translateTRTCStreamId(userId, exports.TRTCVideoStreamType.TRTCVideoStreamTypeBig); // 音频默认都是主流
2639
- _context21.next = 4;
2567
+ _context23.next = 4;
2640
2568
  return this.setAttributes({
2641
2569
  params: {
2642
2570
  muteAudio: mute
@@ -2648,30 +2576,30 @@ var TRTCCloud = /*#__PURE__*/function () {
2648
2576
  logger.info('muteRemoteAudio success');
2649
2577
  case 5:
2650
2578
  case "end":
2651
- return _context21.stop();
2579
+ return _context23.stop();
2652
2580
  }
2653
- }, _callee21, this);
2581
+ }, _callee23, this);
2654
2582
  }));
2655
2583
  }
2656
2584
  }, {
2657
2585
  key: "muteAllRemoteAudio",
2658
2586
  value: function muteAllRemoteAudio(mute) {
2659
- return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
2587
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2660
2588
  var _this11 = this;
2661
2589
  var playerList;
2662
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2663
- while (1) switch (_context23.prev = _context23.next) {
2590
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2591
+ while (1) switch (_context25.prev = _context25.next) {
2664
2592
  case 0:
2665
2593
  logger.info('muteAllRemoteAudio with options: ', mute);
2666
2594
  playerList = this.trtc.getPlayerList();
2667
2595
  playerList.forEach(function (player) {
2668
- return __awaiter(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
2596
+ return __awaiter(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2669
2597
  var streamId;
2670
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2671
- while (1) switch (_context22.prev = _context22.next) {
2598
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2599
+ while (1) switch (_context24.prev = _context24.next) {
2672
2600
  case 0:
2673
2601
  streamId = player.streamID;
2674
- _context22.next = 3;
2602
+ _context24.next = 3;
2675
2603
  return this.setAttributes({
2676
2604
  params: {
2677
2605
  muteAudio: mute
@@ -2681,17 +2609,17 @@ var TRTCCloud = /*#__PURE__*/function () {
2681
2609
  }, 'muteRemoteAudio');
2682
2610
  case 3:
2683
2611
  case "end":
2684
- return _context22.stop();
2612
+ return _context24.stop();
2685
2613
  }
2686
- }, _callee22, this);
2614
+ }, _callee24, this);
2687
2615
  }));
2688
2616
  });
2689
2617
  logger.info('muteAllRemoteAudio success');
2690
2618
  case 4:
2691
2619
  case "end":
2692
- return _context23.stop();
2620
+ return _context25.stop();
2693
2621
  }
2694
- }, _callee23, this);
2622
+ }, _callee25, this);
2695
2623
  }));
2696
2624
  }
2697
2625
  }, {
@@ -2706,49 +2634,20 @@ var TRTCCloud = /*#__PURE__*/function () {
2706
2634
  }, {
2707
2635
  key: "switchCamera",
2708
2636
  value: function switchCamera(frontCamera) {
2709
- var _this12 = this;
2710
2637
  logger.info('switchCamera with options: ', frontCamera);
2711
2638
  var pusher = this.trtc.getPusherInstance();
2712
2639
  if (frontCamera === (pusher.pusherAttributes.frontCamera === 'front')) return Promise.resolve();
2713
- return new Promise(function (resolve, reject) {
2714
- wx.createLivePusherContext().switchCamera({
2715
- success: function success(event) {
2716
- return __awaiter(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2717
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2718
- while (1) switch (_context24.prev = _context24.next) {
2719
- case 0:
2720
- _context24.next = 2;
2721
- return this.setAttributes({
2722
- params: {
2723
- frontCamera: frontCamera
2724
- }
2725
- }, 'switchCamera');
2726
- case 2:
2727
- logger.info('switchCamera success');
2728
- resolve(event);
2729
- case 4:
2730
- case "end":
2731
- return _context24.stop();
2732
- }
2733
- }, _callee24, this);
2734
- }));
2735
- },
2736
- fail: function fail(error) {
2737
- logger.info('switchCamera fail');
2738
- reject(error);
2739
- }
2740
- });
2741
- });
2640
+ return new Promise(function (resolve, reject) {});
2742
2641
  }
2743
2642
  }, {
2744
2643
  key: "setBeautyStyle",
2745
2644
  value: function setBeautyStyle(style, beauty, white, ruddiness) {
2746
- return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2747
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2748
- while (1) switch (_context25.prev = _context25.next) {
2645
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
2646
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2647
+ while (1) switch (_context26.prev = _context26.next) {
2749
2648
  case 0:
2750
2649
  logger.info('setBeautyStyle with options: ', style, beauty, white, ruddiness);
2751
- _context25.next = 3;
2650
+ _context26.next = 3;
2752
2651
  return this.setAttributes({
2753
2652
  params: {
2754
2653
  beautyStyle: style,
@@ -2760,9 +2659,9 @@ var TRTCCloud = /*#__PURE__*/function () {
2760
2659
  logger.info('setBeautyStyle success');
2761
2660
  case 4:
2762
2661
  case "end":
2763
- return _context25.stop();
2662
+ return _context26.stop();
2764
2663
  }
2765
- }, _callee25, this);
2664
+ }, _callee26, this);
2766
2665
  }));
2767
2666
  }
2768
2667
  }, {
@@ -2930,9 +2829,9 @@ var TRTCCloud = /*#__PURE__*/function () {
2930
2829
  }, {
2931
2830
  key: "pusherAttributesChange",
2932
2831
  value: function pusherAttributesChange(pusher) {
2933
- var _this13 = this;
2832
+ var _this12 = this;
2934
2833
  return new Promise(function (resolve) {
2935
- _this13.InterfaceEventEmitter.emit('pusherAttributesChange', {
2834
+ _this12.InterfaceEventEmitter.emit('pusherAttributesChange', {
2936
2835
  pusher: pusher,
2937
2836
  callback: function callback() {
2938
2837
  resolve(pusher);
@@ -2943,13 +2842,13 @@ var TRTCCloud = /*#__PURE__*/function () {
2943
2842
  }, {
2944
2843
  key: "playerAttributesChange",
2945
2844
  value: function playerAttributesChange(params) {
2946
- var _this14 = this;
2845
+ var _this13 = this;
2947
2846
  var streamId = params.streamId,
2948
2847
  playerAttributes = params.playerAttributes;
2949
2848
  return new Promise(function (resolve) {
2950
- _this14.InterfaceEventEmitter.emit('playerAttributesChange', {
2849
+ _this13.InterfaceEventEmitter.emit('playerAttributesChange', {
2951
2850
  streamId: streamId,
2952
- view: _this14.renderMap.get(streamId),
2851
+ view: _this13.renderMap.get(streamId),
2953
2852
  playerAttributes: playerAttributes,
2954
2853
  callback: function callback() {
2955
2854
  resolve(playerAttributes);
@@ -2957,126 +2856,139 @@ var TRTCCloud = /*#__PURE__*/function () {
2957
2856
  });
2958
2857
  });
2959
2858
  }
2859
+ }, {
2860
+ key: "playerAudioRouteChange",
2861
+ value: function playerAudioRouteChange(params) {
2862
+ var _this14 = this;
2863
+ var soundMode = params.soundMode;
2864
+ return new Promise(function (resolve) {
2865
+ _this14.InterfaceEventEmitter.emit('playerAudioRouteChange', {
2866
+ soundMode: soundMode,
2867
+ callback: function callback() {
2868
+ resolve(soundMode);
2869
+ }
2870
+ });
2871
+ });
2872
+ }
2960
2873
  }, {
2961
2874
  key: "setAttributes",
2962
2875
  value: function setAttributes(options, funName, handleType) {
2963
- return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2964
- var _this15 = this,
2965
- _handleMap;
2876
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2877
+ var _this15 = this;
2966
2878
  var params, streamId, handleMap, timeoutDuration, retriesNumber;
2967
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2968
- while (1) switch (_context28.prev = _context28.next) {
2879
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2880
+ while (1) switch (_context29.prev = _context29.next) {
2969
2881
  case 0:
2970
2882
  params = options.params, streamId = options.streamId;
2971
- handleMap = (_handleMap = {}, _defineProperty(_handleMap, Handletype.setPlayer, function () {
2972
- return __awaiter(_this15, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
2883
+ handleMap = _defineProperty(_defineProperty({}, Handletype.setPlayer, function () {
2884
+ return __awaiter(_this15, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
2973
2885
  var playerAttributes;
2974
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2975
- while (1) switch (_context26.prev = _context26.next) {
2886
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2887
+ while (1) switch (_context27.prev = _context27.next) {
2976
2888
  case 0:
2977
- _context26.next = 2;
2889
+ _context27.next = 2;
2978
2890
  return this.playerAttributesChange({
2979
2891
  playerAttributes: this.setTRTCPlayerAttributes(streamId, params),
2980
2892
  streamId: streamId
2981
2893
  });
2982
2894
  case 2:
2983
- playerAttributes = _context26.sent;
2984
- return _context26.abrupt("return", playerAttributes);
2895
+ playerAttributes = _context27.sent;
2896
+ return _context27.abrupt("return", playerAttributes);
2985
2897
  case 4:
2986
2898
  case "end":
2987
- return _context26.stop();
2899
+ return _context27.stop();
2988
2900
  }
2989
- }, _callee26, this);
2901
+ }, _callee27, this);
2990
2902
  }));
2991
- }), _defineProperty(_handleMap, Handletype.setPusher, function () {
2992
- return __awaiter(_this15, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
2903
+ }), Handletype.setPusher, function () {
2904
+ return __awaiter(_this15, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2993
2905
  var _pusher, pusher;
2994
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2995
- while (1) switch (_context27.prev = _context27.next) {
2906
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2907
+ while (1) switch (_context28.prev = _context28.next) {
2996
2908
  case 0:
2997
2909
  if (!(funName === 'enterRoom')) {
2998
- _context27.next = 5;
2910
+ _context28.next = 5;
2999
2911
  break;
3000
2912
  }
3001
- _context27.next = 3;
2913
+ _context28.next = 3;
3002
2914
  return this.pusherAttributesChange(this.trtc.enterRoom(params));
3003
2915
  case 3:
3004
- _pusher = _context27.sent;
3005
- return _context27.abrupt("return", _pusher);
2916
+ _pusher = _context28.sent;
2917
+ return _context28.abrupt("return", _pusher);
3006
2918
  case 5:
3007
- _context27.next = 7;
2919
+ _context28.next = 7;
3008
2920
  return this.pusherAttributesChange(this.trtc.setPusherAttributes(params));
3009
2921
  case 7:
3010
- pusher = _context27.sent;
3011
- return _context27.abrupt("return", pusher);
2922
+ pusher = _context28.sent;
2923
+ return _context28.abrupt("return", pusher);
3012
2924
  case 9:
3013
2925
  case "end":
3014
- return _context27.stop();
2926
+ return _context28.stop();
3015
2927
  }
3016
- }, _callee27, this);
2928
+ }, _callee28, this);
3017
2929
  }));
3018
- }), _handleMap); // 定义一个超时时间(以毫秒为单位)
2930
+ }); // 定义一个超时时间(以毫秒为单位)
3019
2931
  timeoutDuration = 2000; // 定义超时重试次数
3020
2932
  retriesNumber = 3;
3021
- return _context28.abrupt("return", this.retryWithTimeout(function () {
2933
+ return _context29.abrupt("return", this.retryWithTimeout(function () {
3022
2934
  return handleMap[handleType] ? handleMap[handleType]() : Promise.reject(Object.assign(new Error('setAttributes fail'), {
3023
2935
  errorCode: -1
3024
2936
  }));
3025
2937
  }, timeoutDuration, retriesNumber));
3026
2938
  case 5:
3027
2939
  case "end":
3028
- return _context28.stop();
2940
+ return _context29.stop();
3029
2941
  }
3030
- }, _callee28, this);
2942
+ }, _callee29, this);
3031
2943
  }));
3032
2944
  }
3033
2945
  }, {
3034
2946
  key: "retryWithTimeout",
3035
2947
  value: function retryWithTimeout(fn, timeout, retries) {
3036
- return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2948
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
3037
2949
  var lastError, i, result;
3038
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3039
- while (1) switch (_context29.prev = _context29.next) {
2950
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2951
+ while (1) switch (_context30.prev = _context30.next) {
3040
2952
  case 0:
3041
2953
  lastError = null;
3042
2954
  i = 0;
3043
2955
  case 2:
3044
2956
  if (!(i < retries)) {
3045
- _context29.next = 19;
2957
+ _context30.next = 19;
3046
2958
  break;
3047
2959
  }
3048
- _context29.prev = 3;
2960
+ _context30.prev = 3;
3049
2961
  logger.info("setAttributes ".concat(i + 1, "st retry"));
3050
- _context29.next = 7;
2962
+ _context30.next = 7;
3051
2963
  return Promise.race([fn(), new Promise(function (resolve, reject) {
3052
2964
  return setTimeout(function () {
3053
2965
  return reject(new Error('setAttributes timed out'));
3054
2966
  }, timeout);
3055
2967
  })]);
3056
2968
  case 7:
3057
- result = _context29.sent;
3058
- return _context29.abrupt("return", result);
2969
+ result = _context30.sent;
2970
+ return _context30.abrupt("return", result);
3059
2971
  case 11:
3060
- _context29.prev = 11;
3061
- _context29.t0 = _context29["catch"](3);
3062
- if (!((_context29.t0 === null || _context29.t0 === void 0 ? void 0 : _context29.t0.errorCode) === -1)) {
3063
- _context29.next = 15;
2972
+ _context30.prev = 11;
2973
+ _context30.t0 = _context30["catch"](3);
2974
+ if (!((_context30.t0 === null || _context30.t0 === void 0 ? void 0 : _context30.t0.errorCode) === -1)) {
2975
+ _context30.next = 15;
3064
2976
  break;
3065
2977
  }
3066
- return _context29.abrupt("return", _context29.t0);
2978
+ return _context30.abrupt("return", _context30.t0);
3067
2979
  case 15:
3068
- lastError = _context29.t0;
2980
+ lastError = _context30.t0;
3069
2981
  case 16:
3070
2982
  i++;
3071
- _context29.next = 2;
2983
+ _context30.next = 2;
3072
2984
  break;
3073
2985
  case 19:
3074
2986
  throw lastError;
3075
2987
  case 20:
3076
2988
  case "end":
3077
- return _context29.stop();
2989
+ return _context30.stop();
3078
2990
  }
3079
- }, _callee29, null, [[3, 11]]);
2991
+ }, _callee30, null, [[3, 11]]);
3080
2992
  }));
3081
2993
  }
3082
2994
  }], [{
@@ -3099,16 +3011,14 @@ var TRTCCloud = /*#__PURE__*/function () {
3099
3011
  TRTCCloud.instance = null;
3100
3012
  }
3101
3013
  }]);
3102
- return TRTCCloud;
3103
3014
  }();
3104
- __decorate([deviceAuthorize(DeviceType.CAMERA, DeviceScope.CAMERA)], TRTCCloud.prototype, "startLocalPreview", null);
3105
- __decorate([deviceAuthorize(DeviceType.MIC, DeviceScope.RECORD)], TRTCCloud.prototype, "startLocalAudio", null);
3106
3015
  __decorate([setHandle], TRTCCloud.prototype, "setAttributes", null);
3107
3016
 
3108
3017
  exports.TRTCCloud = TRTCCloud;
3109
3018
  exports.default = TRTCCloud;
3110
3019
  exports.translateBeautyStyle = translateBeautyStyle;
3111
3020
  exports.translateTRTCAppScene = translateTRTCAppScene;
3021
+ exports.translateTRTCAudioRoute = translateTRTCAudioRoute;
3112
3022
  exports.translateTRTCStreamId = translateTRTCStreamId;
3113
3023
  exports.translateTRTCVideoMirrorType = translateTRTCVideoMirrorType;
3114
3024
  exports.translateTRTCVideoResolution = translateTRTCVideoResolution;