agora-rte-sdk 3.11.0-rc.2 → 3.11.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.
- package/lib/core/scene/stream-player.js +16 -3
- package/lib/core/scene/type.d.ts +1 -0
- package/lib/plugin/audio-player.js +0 -1
- package/lib/plugin/rtc/electron/canvas-tag-pool.js +4 -2
- package/lib/plugin/rtc/electron/channel.js +4 -31
- package/lib/plugin/rtc/electron/constants.d.ts +0 -140
- package/lib/plugin/rtc/electron/constants.js +1 -85
- package/lib/plugin/rtc/electron/media-recorder/media-recorder-manager.js +78 -39
- package/lib/plugin/rtc/electron/publisher.js +15 -10
- package/lib/plugin/rtc/electron/utils.d.ts +1 -1
- package/lib/plugin/rtc/electron/utils.js +13 -4
- package/lib/plugin/rtc/web/channel.js +2 -1
- package/lib-es/core/scene/stream-player.js +16 -3
- package/lib-es/plugin/audio-player.js +0 -1
- package/lib-es/plugin/rtc/electron/canvas-tag-pool.js +4 -2
- package/lib-es/plugin/rtc/electron/channel.js +1 -28
- package/lib-es/plugin/rtc/electron/constants.js +0 -84
- package/lib-es/plugin/rtc/electron/media-recorder/media-recorder-manager.js +78 -39
- package/lib-es/plugin/rtc/electron/publisher.js +15 -10
- package/lib-es/plugin/rtc/electron/utils.js +13 -4
- package/lib-es/plugin/rtc/web/channel.js +2 -1
- package/package.json +5 -6
|
@@ -186,7 +186,7 @@ var AgoraRteStreamPlayer = exports.AgoraRteStreamPlayer = /*#__PURE__*/function
|
|
|
186
186
|
key: "takeSnapshot",
|
|
187
187
|
value: function () {
|
|
188
188
|
var _takeSnapshot = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(streamId, filePath) {
|
|
189
|
-
var _yield$this$_rtcChann, data, type;
|
|
189
|
+
var _yield$this$_rtcChann, data, type, imageData;
|
|
190
190
|
return _regenerator["default"].wrap(function (_context) {
|
|
191
191
|
while (1) switch (_context.prev = _context.next) {
|
|
192
192
|
case 0:
|
|
@@ -196,13 +196,26 @@ var AgoraRteStreamPlayer = exports.AgoraRteStreamPlayer = /*#__PURE__*/function
|
|
|
196
196
|
_yield$this$_rtcChann = _context.sent;
|
|
197
197
|
data = _yield$this$_rtcChann.data;
|
|
198
198
|
type = _yield$this$_rtcChann.type;
|
|
199
|
+
if (!(type === 'filepath')) {
|
|
200
|
+
_context.next = 2;
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
199
203
|
return _context.abrupt("return", Promise.resolve({
|
|
200
|
-
streamId:
|
|
201
|
-
filePath:
|
|
204
|
+
streamId: streamId,
|
|
205
|
+
filePath: data,
|
|
202
206
|
width: 0,
|
|
203
207
|
height: 0
|
|
204
208
|
}));
|
|
205
209
|
case 2:
|
|
210
|
+
imageData = data;
|
|
211
|
+
return _context.abrupt("return", Promise.resolve({
|
|
212
|
+
streamId: streamId,
|
|
213
|
+
filePath: filePath,
|
|
214
|
+
width: imageData.width,
|
|
215
|
+
height: imageData.height,
|
|
216
|
+
imageData: imageData
|
|
217
|
+
}));
|
|
218
|
+
case 3:
|
|
206
219
|
case "end":
|
|
207
220
|
return _context.stop();
|
|
208
221
|
}
|
package/lib/core/scene/type.d.ts
CHANGED
|
@@ -312,7 +312,6 @@ var AgoraWebAudioPlayer = exports.AgoraWebAudioPlayer = /*#__PURE__*/function ()
|
|
|
312
312
|
this._analyserNode = this._audioContext.createAnalyser();
|
|
313
313
|
this._analyserNode.smoothingTimeConstant = 0.3;
|
|
314
314
|
this._analyserNode.fftSize = 1024;
|
|
315
|
-
this._analyserNode.connect(this._audioContext.destination);
|
|
316
315
|
if (this._audioContext.state === 'running') {
|
|
317
316
|
this._initialized = true;
|
|
318
317
|
}
|
|
@@ -233,7 +233,8 @@ var AgoraRtcCanvasTagPoolImpl = exports.AgoraRtcCanvasTagPoolImpl = /*#__PURE__*
|
|
|
233
233
|
uid: +canvasTag.sourceId,
|
|
234
234
|
view: canvasTag.canvas.view,
|
|
235
235
|
sourceType: _constants.RENDER_CONSTANTS.REMOTE_SOURCE_TYPE,
|
|
236
|
-
setupMode: _constants.RENDER_CONSTANTS.SETUP_MODES.REMOVE
|
|
236
|
+
setupMode: _constants.RENDER_CONSTANTS.SETUP_MODES.REMOVE,
|
|
237
|
+
position: 1 << 0 | 1 << 1
|
|
237
238
|
};
|
|
238
239
|
this._decrementRenderCount(this._rtcEngine);
|
|
239
240
|
this._rtcEngine.setupRemoteVideoEx(canvas, canvasTag.connection);
|
|
@@ -288,7 +289,8 @@ var AgoraRtcCanvasTagPoolImpl = exports.AgoraRtcCanvasTagPoolImpl = /*#__PURE__*
|
|
|
288
289
|
uid: +canvasTag.sourceId,
|
|
289
290
|
view: null,
|
|
290
291
|
sourceType: _constants.RENDER_CONSTANTS.REMOTE_SOURCE_TYPE,
|
|
291
|
-
setupMode: _constants.RENDER_CONSTANTS.SETUP_MODES.REPLACE
|
|
292
|
+
setupMode: _constants.RENDER_CONSTANTS.SETUP_MODES.REPLACE,
|
|
293
|
+
position: 1 << 0 | 1 << 1
|
|
292
294
|
};
|
|
293
295
|
this._rtcEngine.setupRemoteVideoEx(canvas, canvasTag.connection);
|
|
294
296
|
this._logRenderInfo(this._rtcEngine, 'setupRemoteVideoEx', _constants.RENDER_CONSTANTS.SETUP_MODES.REPLACE);
|
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.symbol.js");
|
|
4
4
|
require("core-js/modules/es.symbol.description.js");
|
|
5
|
-
require("core-js/modules/es.symbol.iterator.js");
|
|
6
5
|
require("core-js/modules/es.symbol.to-primitive.js");
|
|
7
|
-
require("core-js/modules/es.array.from.js");
|
|
8
6
|
require("core-js/modules/es.array.is-array.js");
|
|
9
7
|
require("core-js/modules/es.array.push.js");
|
|
10
|
-
require("core-js/modules/es.array.slice.js");
|
|
11
8
|
require("core-js/modules/es.date.to-primitive.js");
|
|
12
9
|
require("core-js/modules/es.function.bind.js");
|
|
13
10
|
require("core-js/modules/es.function.name.js");
|
|
@@ -15,8 +12,6 @@ require("core-js/modules/es.object.create.js");
|
|
|
15
12
|
require("core-js/modules/es.object.define-property.js");
|
|
16
13
|
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
17
14
|
require("core-js/modules/es.reflect.construct.js");
|
|
18
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
19
|
-
require("core-js/modules/es.regexp.test.js");
|
|
20
15
|
require("core-js/modules/esnext.function.metadata.js");
|
|
21
16
|
require("core-js/modules/esnext.symbol.metadata.js");
|
|
22
17
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -68,7 +63,7 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
68
63
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
69
64
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
70
65
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
71
|
-
var
|
|
66
|
+
var _errorCode = require("agora-foundation/lib/utilities/error/error-code");
|
|
72
67
|
var _decorator = require("agora-foundation/lib/decorator");
|
|
73
68
|
var _schedule = require("agora-foundation/lib/schedule");
|
|
74
69
|
var _scheduler = require("agora-foundation/lib/schedule/scheduler");
|
|
@@ -86,9 +81,6 @@ var _type2 = require("./type");
|
|
|
86
81
|
var _utils = require("./utils");
|
|
87
82
|
var _AgoraRtcChannelClientImpl;
|
|
88
83
|
var _initProto, _addAudioRawDataObserverDecs, _removeAudioRawDataObserverDecs, _joinDecs, _setEncryptionConfigDecs, _startRenderRemoteVideoStreamDecs, _stopRenderRemoteVideoStreamDecs, _stopRenderRemoteVideoStreamOnAllCanvasDecs, _takeSnapshotDecs, _adjustRemoteAudioStreamVolumeDecs, _renewTokenDecs, _setVideoEncoderConfigDecs, _setDualStreamModeDecs, _updateRemoteAudioStreamVolumeDecs, _setScreenScenarioDecs, _handleConnectionStateChangedDecs, _ref;
|
|
89
|
-
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; } } }; }
|
|
90
|
-
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; } }
|
|
91
|
-
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; }
|
|
92
84
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
93
85
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
94
86
|
function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function set(e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O["static"] = l, O["private"] = f, f ? 2 === o ? k = function k(e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function k(e) { return e[n]; }, (o < 2 || 4 === o) && (F = function F(e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == _typeof(P) && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol["for"]("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol["for"]("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function s(t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
|
|
@@ -239,29 +231,10 @@ var AgoraRtcChannelClientImpl = exports.AgoraRtcChannelClientImpl = /*#__PURE__*
|
|
|
239
231
|
channelType: _this2._channelType === _type.AgoraRtcChannelType.LargeScale ? 1 : 0
|
|
240
232
|
};
|
|
241
233
|
_this2.logger.info("rtcEngine joinChannelEx with mediaOptions: ".concat(JSON.stringify(mediaOptions)));
|
|
242
|
-
|
|
243
|
-
// 如果是大规模频道,先逐项设置 RTC 私有参数
|
|
244
|
-
if (_this2._channelType === _type.AgoraRtcChannelType.LargeScale) {
|
|
245
|
-
var _iterator = _createForOfIteratorHelper(_constants.LARGE_SCALE_RTC_PARAMETERS),
|
|
246
|
-
_step;
|
|
247
|
-
try {
|
|
248
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
249
|
-
var param = _step.value;
|
|
250
|
-
var _errorCode = _this2._rtcEngine.setParameters(JSON.stringify(param));
|
|
251
|
-
if (_errorCode !== 0) {
|
|
252
|
-
_this2.logger.warn("Failed to set parameter: ".concat(JSON.stringify(param), ", errorCode: ").concat(_errorCode));
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
} catch (err) {
|
|
256
|
-
_iterator.e(err);
|
|
257
|
-
} finally {
|
|
258
|
-
_iterator.f();
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
234
|
var errorCode = _this2._rtcEngine.joinChannelEx(token, _this2._rtcConnection, mediaOptions);
|
|
262
235
|
if (errorCode !== 0) {
|
|
263
236
|
_this2._rtcEngine.removeListener('onJoinChannelSuccess', _callback);
|
|
264
|
-
var error = _type2.AgoraRtcError.create(
|
|
237
|
+
var error = _type2.AgoraRtcError.create(_errorCode.ErrorServiceType.NATIVE_RTC, _errorCode.ErrorModuleCode.NO_MODULE, Math.abs(errorCode), errorMessage);
|
|
265
238
|
reject(error);
|
|
266
239
|
}
|
|
267
240
|
} catch (error) {
|
|
@@ -276,7 +249,7 @@ var AgoraRtcChannelClientImpl = exports.AgoraRtcChannelClientImpl = /*#__PURE__*
|
|
|
276
249
|
if (error instanceof _type2.AgoraRtcError) {
|
|
277
250
|
throw error;
|
|
278
251
|
}
|
|
279
|
-
throw _type2.AgoraRtcError.create(
|
|
252
|
+
throw _type2.AgoraRtcError.create(_errorCode.ErrorServiceType.NATIVE_RTC, _errorCode.ErrorModuleCode.NO_MODULE, _errorCode.DetailErrorCode.JOIN_RTC_TIMEOUT, 'join rtc channel timeout');
|
|
280
253
|
}));
|
|
281
254
|
case 1:
|
|
282
255
|
case "end":
|
|
@@ -426,7 +399,7 @@ var AgoraRtcChannelClientImpl = exports.AgoraRtcChannelClientImpl = /*#__PURE__*
|
|
|
426
399
|
var code = _this4._rtcEngine.takeSnapshotEx(_this4._rtcConnection, +streamId, filePath);
|
|
427
400
|
if (code !== 0) {
|
|
428
401
|
_this4._rtcEngine.removeListener('onSnapshotTaken', callback);
|
|
429
|
-
var error = _type2.AgoraRtcError.create(
|
|
402
|
+
var error = _type2.AgoraRtcError.create(_errorCode.ErrorServiceType.NATIVE_RTC, _errorCode.ErrorModuleCode.NO_MODULE, code, "failed to take snapshot: ".concat(code));
|
|
430
403
|
reject(error);
|
|
431
404
|
}
|
|
432
405
|
});
|
|
@@ -83,146 +83,6 @@ export declare const RTC_PARAMS: {
|
|
|
83
83
|
};
|
|
84
84
|
};
|
|
85
85
|
};
|
|
86
|
-
export declare const LARGE_SCALE_RTC_PARAMETERS: ({
|
|
87
|
-
'rtc.audio.filter_streams': number;
|
|
88
|
-
'rtc.log_size'?: undefined;
|
|
89
|
-
'rtc.use_const_ack_delay'?: undefined;
|
|
90
|
-
'rtc.ack_delay'?: undefined;
|
|
91
|
-
'rtc.metadata.enable_report'?: undefined;
|
|
92
|
-
'rtc.max_sub_peers'?: undefined;
|
|
93
|
-
'rtc.vos_aut_use_old_sync'?: undefined;
|
|
94
|
-
'rtc.report_config'?: undefined;
|
|
95
|
-
} | {
|
|
96
|
-
'rtc.log_size': number;
|
|
97
|
-
'rtc.audio.filter_streams'?: undefined;
|
|
98
|
-
'rtc.use_const_ack_delay'?: undefined;
|
|
99
|
-
'rtc.ack_delay'?: undefined;
|
|
100
|
-
'rtc.metadata.enable_report'?: undefined;
|
|
101
|
-
'rtc.max_sub_peers'?: undefined;
|
|
102
|
-
'rtc.vos_aut_use_old_sync'?: undefined;
|
|
103
|
-
'rtc.report_config'?: undefined;
|
|
104
|
-
} | {
|
|
105
|
-
'rtc.use_const_ack_delay': boolean;
|
|
106
|
-
'rtc.audio.filter_streams'?: undefined;
|
|
107
|
-
'rtc.log_size'?: undefined;
|
|
108
|
-
'rtc.ack_delay'?: undefined;
|
|
109
|
-
'rtc.metadata.enable_report'?: undefined;
|
|
110
|
-
'rtc.max_sub_peers'?: undefined;
|
|
111
|
-
'rtc.vos_aut_use_old_sync'?: undefined;
|
|
112
|
-
'rtc.report_config'?: undefined;
|
|
113
|
-
} | {
|
|
114
|
-
'rtc.ack_delay': number;
|
|
115
|
-
'rtc.audio.filter_streams'?: undefined;
|
|
116
|
-
'rtc.log_size'?: undefined;
|
|
117
|
-
'rtc.use_const_ack_delay'?: undefined;
|
|
118
|
-
'rtc.metadata.enable_report'?: undefined;
|
|
119
|
-
'rtc.max_sub_peers'?: undefined;
|
|
120
|
-
'rtc.vos_aut_use_old_sync'?: undefined;
|
|
121
|
-
'rtc.report_config'?: undefined;
|
|
122
|
-
} | {
|
|
123
|
-
'rtc.metadata.enable_report': boolean;
|
|
124
|
-
'rtc.audio.filter_streams'?: undefined;
|
|
125
|
-
'rtc.log_size'?: undefined;
|
|
126
|
-
'rtc.use_const_ack_delay'?: undefined;
|
|
127
|
-
'rtc.ack_delay'?: undefined;
|
|
128
|
-
'rtc.max_sub_peers'?: undefined;
|
|
129
|
-
'rtc.vos_aut_use_old_sync'?: undefined;
|
|
130
|
-
'rtc.report_config'?: undefined;
|
|
131
|
-
} | {
|
|
132
|
-
'rtc.max_sub_peers': number;
|
|
133
|
-
'rtc.audio.filter_streams'?: undefined;
|
|
134
|
-
'rtc.log_size'?: undefined;
|
|
135
|
-
'rtc.use_const_ack_delay'?: undefined;
|
|
136
|
-
'rtc.ack_delay'?: undefined;
|
|
137
|
-
'rtc.metadata.enable_report'?: undefined;
|
|
138
|
-
'rtc.vos_aut_use_old_sync'?: undefined;
|
|
139
|
-
'rtc.report_config'?: undefined;
|
|
140
|
-
} | {
|
|
141
|
-
'rtc.vos_aut_use_old_sync': boolean;
|
|
142
|
-
'rtc.audio.filter_streams'?: undefined;
|
|
143
|
-
'rtc.log_size'?: undefined;
|
|
144
|
-
'rtc.use_const_ack_delay'?: undefined;
|
|
145
|
-
'rtc.ack_delay'?: undefined;
|
|
146
|
-
'rtc.metadata.enable_report'?: undefined;
|
|
147
|
-
'rtc.max_sub_peers'?: undefined;
|
|
148
|
-
'rtc.report_config'?: undefined;
|
|
149
|
-
} | {
|
|
150
|
-
'rtc.report_config': {
|
|
151
|
-
'data.report.event.19': {
|
|
152
|
-
id: number;
|
|
153
|
-
report_count: number;
|
|
154
|
-
report_interval: number;
|
|
155
|
-
type: string;
|
|
156
|
-
};
|
|
157
|
-
'data.report.event.20': {
|
|
158
|
-
id: number;
|
|
159
|
-
report_count: number;
|
|
160
|
-
report_interval: number;
|
|
161
|
-
type: string;
|
|
162
|
-
};
|
|
163
|
-
'data.report.event.5': {
|
|
164
|
-
id: number;
|
|
165
|
-
report_count: number;
|
|
166
|
-
report_interval: number;
|
|
167
|
-
type: string;
|
|
168
|
-
};
|
|
169
|
-
'data.report.event.6': {
|
|
170
|
-
id: number;
|
|
171
|
-
report_count: number;
|
|
172
|
-
report_interval: number;
|
|
173
|
-
type: string;
|
|
174
|
-
};
|
|
175
|
-
'data.report.event.262': {
|
|
176
|
-
id: number;
|
|
177
|
-
report_count: number;
|
|
178
|
-
report_interval: number;
|
|
179
|
-
type: string;
|
|
180
|
-
};
|
|
181
|
-
'data.report.event.263': {
|
|
182
|
-
id: number;
|
|
183
|
-
report_count: number;
|
|
184
|
-
report_interval: number;
|
|
185
|
-
type: string;
|
|
186
|
-
};
|
|
187
|
-
'data.report.event.341': {
|
|
188
|
-
id: number;
|
|
189
|
-
report_count: number;
|
|
190
|
-
report_interval: number;
|
|
191
|
-
type: string;
|
|
192
|
-
};
|
|
193
|
-
'data.report.event.342': {
|
|
194
|
-
id: number;
|
|
195
|
-
report_count: number;
|
|
196
|
-
report_interval: number;
|
|
197
|
-
type: string;
|
|
198
|
-
};
|
|
199
|
-
'data.report.event.8': {
|
|
200
|
-
id: number;
|
|
201
|
-
report_count: number;
|
|
202
|
-
report_interval: number;
|
|
203
|
-
type: string;
|
|
204
|
-
};
|
|
205
|
-
'data.report.event.13': {
|
|
206
|
-
id: number;
|
|
207
|
-
report_count: number;
|
|
208
|
-
report_interval: number;
|
|
209
|
-
type: string;
|
|
210
|
-
};
|
|
211
|
-
'data.report.event.136': {
|
|
212
|
-
id: number;
|
|
213
|
-
report_count: number;
|
|
214
|
-
report_interval: number;
|
|
215
|
-
type: string;
|
|
216
|
-
};
|
|
217
|
-
};
|
|
218
|
-
'rtc.audio.filter_streams'?: undefined;
|
|
219
|
-
'rtc.log_size'?: undefined;
|
|
220
|
-
'rtc.use_const_ack_delay'?: undefined;
|
|
221
|
-
'rtc.ack_delay'?: undefined;
|
|
222
|
-
'rtc.metadata.enable_report'?: undefined;
|
|
223
|
-
'rtc.max_sub_peers'?: undefined;
|
|
224
|
-
'rtc.vos_aut_use_old_sync'?: undefined;
|
|
225
|
-
})[];
|
|
226
86
|
export declare const RENDER_CONSTANTS: {
|
|
227
87
|
readonly REMOTE_SOURCE_TYPE: VideoSourceType.VideoSourceRemote;
|
|
228
88
|
readonly SETUP_MODES: {
|
|
@@ -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.VIDEO_PATTERNS = exports.VALID_BACKGROUND_TYPES = exports.STATS_INTERVAL = exports.STANDARD_BITRATE = exports.RTC_PARAMS = exports.RENDER_CONSTANTS = exports.REDUCE_LOOPBACK_VOLUME_MICROPHONE = exports.REDUCE_LOOPBACK_VOLUME = exports.MEDIA_DEVICE_TYPE = exports.MEDIA_DEVICE_STATE = exports.
|
|
8
|
+
exports.VIDEO_PATTERNS = exports.VALID_BACKGROUND_TYPES = exports.STATS_INTERVAL = exports.STANDARD_BITRATE = exports.RTC_PARAMS = exports.RENDER_CONSTANTS = exports.REDUCE_LOOPBACK_VOLUME_MICROPHONE = exports.REDUCE_LOOPBACK_VOLUME = exports.MEDIA_DEVICE_TYPE = exports.MEDIA_DEVICE_STATE = exports.IMAGE_PATTERNS = exports.HIFI_BITRATE = exports.ELECTRON_CLOUD_PROXY_UDP = exports.ELECTRON_CLOUD_PROXY_TCP = exports.ELECTRON_CLOUD_PROXY_NONE = exports.DISCONNECTED_TIMEOUT = exports.DISABLE_AI_DENOISE_CONFIG = exports.DEVICE_SCORE_THRESHOLD = exports.DEFAULT_VOLUME = exports.DEFAULT_SPEAKER_DEVICE_ID = exports.DEFAULT_RENDERING_FPS = exports.DEFAULT_MICROPHONE_DEVICE_ID = exports.DEFAULT_LOG_LEVEL = exports.DEFAULT_LOG_FILE_SIZE = exports.AUDIO_PROFILES = exports.AUDIO_CHANNELS = exports.AI_DENOISE_CONFIGS = exports.AGORA_ALD_LOOPBACK_DEVICE = void 0;
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _type = require("../../../core/rtc/type");
|
|
11
11
|
var DEFAULT_LOG_FILE_SIZE = exports.DEFAULT_LOG_FILE_SIZE = 512;
|
|
@@ -190,90 +190,6 @@ var RTC_PARAMS = exports.RTC_PARAMS = {
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
};
|
|
193
|
-
var LARGE_SCALE_RTC_PARAMETERS = exports.LARGE_SCALE_RTC_PARAMETERS = [{
|
|
194
|
-
'rtc.audio.filter_streams': 4
|
|
195
|
-
}, {
|
|
196
|
-
'rtc.log_size': 5120
|
|
197
|
-
}, {
|
|
198
|
-
'rtc.use_const_ack_delay': true
|
|
199
|
-
}, {
|
|
200
|
-
'rtc.ack_delay': 100
|
|
201
|
-
}, {
|
|
202
|
-
'rtc.metadata.enable_report': false
|
|
203
|
-
}, {
|
|
204
|
-
'rtc.max_sub_peers': 50
|
|
205
|
-
}, {
|
|
206
|
-
'rtc.vos_aut_use_old_sync': false
|
|
207
|
-
}, {
|
|
208
|
-
'rtc.report_config': {
|
|
209
|
-
'data.report.event.19': {
|
|
210
|
-
id: 19,
|
|
211
|
-
report_count: 0,
|
|
212
|
-
report_interval: 6,
|
|
213
|
-
type: 'event'
|
|
214
|
-
},
|
|
215
|
-
'data.report.event.20': {
|
|
216
|
-
id: 20,
|
|
217
|
-
report_count: 0,
|
|
218
|
-
report_interval: 6,
|
|
219
|
-
type: 'event'
|
|
220
|
-
},
|
|
221
|
-
'data.report.event.5': {
|
|
222
|
-
id: 5,
|
|
223
|
-
report_count: 0,
|
|
224
|
-
report_interval: 6,
|
|
225
|
-
type: 'event'
|
|
226
|
-
},
|
|
227
|
-
'data.report.event.6': {
|
|
228
|
-
id: 6,
|
|
229
|
-
report_count: 0,
|
|
230
|
-
report_interval: 6,
|
|
231
|
-
type: 'event'
|
|
232
|
-
},
|
|
233
|
-
'data.report.event.262': {
|
|
234
|
-
id: 262,
|
|
235
|
-
report_count: 0,
|
|
236
|
-
report_interval: 6,
|
|
237
|
-
type: 'event'
|
|
238
|
-
},
|
|
239
|
-
'data.report.event.263': {
|
|
240
|
-
id: 263,
|
|
241
|
-
report_count: 0,
|
|
242
|
-
report_interval: 6,
|
|
243
|
-
type: 'event'
|
|
244
|
-
},
|
|
245
|
-
'data.report.event.341': {
|
|
246
|
-
id: 341,
|
|
247
|
-
report_count: 0,
|
|
248
|
-
report_interval: 6,
|
|
249
|
-
type: 'event'
|
|
250
|
-
},
|
|
251
|
-
'data.report.event.342': {
|
|
252
|
-
id: 342,
|
|
253
|
-
report_count: 0,
|
|
254
|
-
report_interval: 6,
|
|
255
|
-
type: 'event'
|
|
256
|
-
},
|
|
257
|
-
'data.report.event.8': {
|
|
258
|
-
id: 8,
|
|
259
|
-
report_count: 0,
|
|
260
|
-
report_interval: 6,
|
|
261
|
-
type: 'event'
|
|
262
|
-
},
|
|
263
|
-
'data.report.event.13': {
|
|
264
|
-
id: 13,
|
|
265
|
-
report_count: 0,
|
|
266
|
-
report_interval: 6,
|
|
267
|
-
type: 'event'
|
|
268
|
-
},
|
|
269
|
-
'data.report.event.136': {
|
|
270
|
-
id: 136,
|
|
271
|
-
report_count: 0,
|
|
272
|
-
report_interval: 6,
|
|
273
|
-
type: 'event'
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}];
|
|
277
193
|
var RENDER_CONSTANTS = exports.RENDER_CONSTANTS = {
|
|
278
194
|
REMOTE_SOURCE_TYPE: 9,
|
|
279
195
|
SETUP_MODES: {
|
|
@@ -269,7 +269,7 @@ var AgoraElectronMediaRecorderManager = exports.AgoraElectronMediaRecorderManage
|
|
|
269
269
|
recordingHeight = (_currentWindowInfo$bo2 = currentWindowInfo.bounds) === null || _currentWindowInfo$bo2 === void 0 ? void 0 : _currentWindowInfo$bo2.height;
|
|
270
270
|
this.logger.info("startClientRecording: using window bounds for recording resolution, width=".concat(recordingWidth, ", height=").concat(recordingHeight));
|
|
271
271
|
}
|
|
272
|
-
this._sourceManager.startScreenCaptureByWindowId(currentWindowInfo.id,
|
|
272
|
+
this._sourceManager.startScreenCaptureByWindowId(currentWindowInfo.id, false);
|
|
273
273
|
this.logger.info("startClientRecording: started own window capture for recording (without highlight), windowId: ".concat(currentWindowInfo.id));
|
|
274
274
|
} else {
|
|
275
275
|
this.logger.warn('startClientRecording: failed to find current window for recording');
|
|
@@ -362,7 +362,7 @@ var AgoraElectronMediaRecorderManager = exports.AgoraElectronMediaRecorderManage
|
|
|
362
362
|
key: "resumeOwnCapture",
|
|
363
363
|
value: (function () {
|
|
364
364
|
var _resumeOwnCapture = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
365
|
-
var currentWindowInfo, maxRetries, retryInterval, i, res;
|
|
365
|
+
var currentWindowInfo, maxRetries, retryInterval, i, maxStartAttempts, startRetryInterval, res, attempt;
|
|
366
366
|
return _regenerator["default"].wrap(function (_context3) {
|
|
367
367
|
while (1) switch (_context3.prev = _context3.next) {
|
|
368
368
|
case 0:
|
|
@@ -411,44 +411,80 @@ var AgoraElectronMediaRecorderManager = exports.AgoraElectronMediaRecorderManage
|
|
|
411
411
|
_context3.next = 3;
|
|
412
412
|
break;
|
|
413
413
|
case 7:
|
|
414
|
-
if (currentWindowInfo) {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
// 启动自己的窗口采集
|
|
419
|
-
this._clientRecordingSourceId = currentWindowInfo.id;
|
|
420
|
-
this._clientRecordingCaptureType = _type.AgoraRtcScreenCaptureType.WINDOW;
|
|
421
|
-
this._clientRecordingOwnsCapture = true;
|
|
422
|
-
res = this._sourceManager.startScreenCaptureByWindowId(currentWindowInfo.id, true);
|
|
423
|
-
this.logger.info("resumeOwnCapture: startScreenCaptureByWindowId result=".concat(res, ", windowId: ").concat(currentWindowInfo.id));
|
|
424
|
-
if (res !== 0) {
|
|
425
|
-
this.logger.warn("resumeOwnCapture: startScreenCaptureByWindowId failed with code ".concat(res));
|
|
426
|
-
this._sourceManager.unprotectSourceId(currentWindowInfo.id);
|
|
427
|
-
this._clientRecordingSourceId = undefined;
|
|
428
|
-
this._clientRecordingCaptureType = undefined;
|
|
429
|
-
this._clientRecordingOwnsCapture = false;
|
|
430
|
-
} else if (this._channelId && this._uid) {
|
|
431
|
-
// 采集成功后重建 MediaRecorder,因为屏幕共享停止时 SDK 内部管道已断开,
|
|
432
|
-
// 旧的 MediaRecorder 无法接收新采集源的视频帧。
|
|
433
|
-
this.logger.info('resumeOwnCapture: recreating MediaRecorder for new capture source');
|
|
434
|
-
if (this._mediaRecorder && this._isRecordingStarted) {
|
|
435
|
-
this._mediaRecorder.stopRecording();
|
|
436
|
-
this._isRecordingStarted = false;
|
|
437
|
-
}
|
|
438
|
-
if (this._mediaRecorder) {
|
|
439
|
-
this._recorderGeneration++;
|
|
440
|
-
this._rtcEngine.destroyMediaRecorder(this._mediaRecorder);
|
|
441
|
-
this._mediaRecorder = undefined;
|
|
442
|
-
this._mediaRecorderObserver = undefined;
|
|
443
|
-
}
|
|
444
|
-
this._createMediaRecorder(this._channelId, this._uid);
|
|
445
|
-
this._setupMediaRecorderObserver(this._channelId, this._uid);
|
|
446
|
-
this._startRecording(this._lastRecordingConfig);
|
|
447
|
-
}
|
|
448
|
-
} else {
|
|
449
|
-
this.logger.warn('resumeOwnCapture: failed to find current window after retries, recording may be affected');
|
|
414
|
+
if (!currentWindowInfo) {
|
|
415
|
+
_context3.next = 12;
|
|
416
|
+
break;
|
|
450
417
|
}
|
|
418
|
+
// 保护这个 sourceId 不被 onLocalVideoStateChanged 的延迟回调误杀
|
|
419
|
+
this._sourceManager.protectSourceId(currentWindowInfo.id);
|
|
420
|
+
|
|
421
|
+
// 启动自己的窗口采集
|
|
422
|
+
this._clientRecordingSourceId = currentWindowInfo.id;
|
|
423
|
+
this._clientRecordingCaptureType = _type.AgoraRtcScreenCaptureType.WINDOW;
|
|
424
|
+
this._clientRecordingOwnsCapture = true;
|
|
425
|
+
|
|
426
|
+
// 屏幕共享停止后 RTC 内部的 VideoSourceScreenPrimary 通道还在异步拆除,
|
|
427
|
+
// 此时立刻调用 startScreenCaptureByWindowId 会返回 -2 (ERR_INVALID_ARGUMENT),
|
|
428
|
+
// 导致后续录制全是黑帧。这里做有界重试。
|
|
429
|
+
maxStartAttempts = 6;
|
|
430
|
+
startRetryInterval = 200;
|
|
431
|
+
res = -1;
|
|
432
|
+
attempt = 0;
|
|
451
433
|
case 8:
|
|
434
|
+
if (!(attempt < maxStartAttempts)) {
|
|
435
|
+
_context3.next = 11;
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
res = this._sourceManager.startScreenCaptureByWindowId(currentWindowInfo.id, false);
|
|
439
|
+
this.logger.info("resumeOwnCapture: startScreenCaptureByWindowId result=".concat(res, ", windowId: ").concat(currentWindowInfo.id, ", attempt: ").concat(attempt + 1, "/").concat(maxStartAttempts));
|
|
440
|
+
if (!(res === 0)) {
|
|
441
|
+
_context3.next = 9;
|
|
442
|
+
break;
|
|
443
|
+
}
|
|
444
|
+
return _context3.abrupt("continue", 11);
|
|
445
|
+
case 9:
|
|
446
|
+
this.logger.warn("resumeOwnCapture: startScreenCaptureByWindowId attempt ".concat(attempt + 1, " failed with code ").concat(res, ", retrying in ").concat(startRetryInterval, "ms..."));
|
|
447
|
+
_context3.next = 10;
|
|
448
|
+
return new Promise(function (r) {
|
|
449
|
+
return setTimeout(r, startRetryInterval);
|
|
450
|
+
});
|
|
451
|
+
case 10:
|
|
452
|
+
attempt++;
|
|
453
|
+
_context3.next = 8;
|
|
454
|
+
break;
|
|
455
|
+
case 11:
|
|
456
|
+
if (res !== 0) {
|
|
457
|
+
this.logger.warn("resumeOwnCapture: startScreenCaptureByWindowId failed with code ".concat(res, " after ").concat(maxStartAttempts, " attempts"));
|
|
458
|
+
this._sourceManager.unprotectSourceId(currentWindowInfo.id);
|
|
459
|
+
this._clientRecordingSourceId = undefined;
|
|
460
|
+
this._clientRecordingCaptureType = undefined;
|
|
461
|
+
this._clientRecordingOwnsCapture = false;
|
|
462
|
+
}
|
|
463
|
+
// else if (this._channelId && this._uid) {
|
|
464
|
+
// // 采集成功后重建 MediaRecorder,因为屏幕共享停止时 SDK 内部管道已断开,
|
|
465
|
+
// // 旧的 MediaRecorder 无法接收新采集源的视频帧。
|
|
466
|
+
// this.logger.info('resumeOwnCapture: recreating MediaRecorder for new capture source');
|
|
467
|
+
|
|
468
|
+
// if (this._mediaRecorder && this._isRecordingStarted) {
|
|
469
|
+
// this._mediaRecorder.stopRecording();
|
|
470
|
+
// this._isRecordingStarted = false;
|
|
471
|
+
// }
|
|
472
|
+
// if (this._mediaRecorder) {
|
|
473
|
+
// this._recorderGeneration++;
|
|
474
|
+
// this._rtcEngine.destroyMediaRecorder(this._mediaRecorder);
|
|
475
|
+
// this._mediaRecorder = undefined;
|
|
476
|
+
// this._mediaRecorderObserver = undefined;
|
|
477
|
+
// }
|
|
478
|
+
|
|
479
|
+
// this._createMediaRecorder(this._channelId, this._uid);
|
|
480
|
+
// this._setupMediaRecorderObserver(this._channelId, this._uid);
|
|
481
|
+
// this._startRecording(this._lastRecordingConfig);
|
|
482
|
+
// }
|
|
483
|
+
_context3.next = 13;
|
|
484
|
+
break;
|
|
485
|
+
case 12:
|
|
486
|
+
this.logger.warn('resumeOwnCapture: failed to find current window after retries, recording may be affected');
|
|
487
|
+
case 13:
|
|
452
488
|
case "end":
|
|
453
489
|
return _context3.stop();
|
|
454
490
|
}
|
|
@@ -588,7 +624,10 @@ var AgoraElectronMediaRecorderManager = exports.AgoraElectronMediaRecorderManage
|
|
|
588
624
|
videoSourceType: 2,
|
|
589
625
|
width: config === null || config === void 0 ? void 0 : config.width,
|
|
590
626
|
height: config === null || config === void 0 ? void 0 : config.height,
|
|
591
|
-
fps: config === null || config === void 0 ? void 0 : config.fps
|
|
627
|
+
fps: config === null || config === void 0 ? void 0 : config.fps,
|
|
628
|
+
audioConfiguration: {
|
|
629
|
+
audioRecordingType: 4
|
|
630
|
+
}
|
|
592
631
|
};
|
|
593
632
|
var result = (_this$_mediaRecorder2 = this._mediaRecorder) === null || _this$_mediaRecorder2 === void 0 ? void 0 : _this$_mediaRecorder2.startRecording(recordingConfig);
|
|
594
633
|
if (result !== undefined && result !== 0) {
|
|
@@ -136,7 +136,8 @@ var AgoraRtcChannelPublisherImpl = exports.AgoraRtcChannelPublisherImpl = /*#__P
|
|
|
136
136
|
|
|
137
137
|
// disable dual stream for screen
|
|
138
138
|
if (item.videoSourceType === _type.AgoraRtcVideoSourceType.SCREEN) {
|
|
139
|
-
|
|
139
|
+
var screenStreamConfig = _this._getVideoStreamConfig(item.connection.localUid.toString(), false);
|
|
140
|
+
(0, _utils.disableDualStream)(_this._rtcEngine, item.connection, screenStreamConfig.lowVideoEncoderConfig, _this.logger);
|
|
140
141
|
}
|
|
141
142
|
if (oldHandleLocalVideoStats) {
|
|
142
143
|
_this._rtcEngine.removeListener('onLocalVideoStats', oldHandleLocalVideoStats);
|
|
@@ -440,23 +441,27 @@ var AgoraRtcChannelPublisherImpl = exports.AgoraRtcChannelPublisherImpl = /*#__P
|
|
|
440
441
|
|
|
441
442
|
// 非摄像头视频源或禁用双流模式时,禁用双流
|
|
442
443
|
var shouldDisable = !enable || !isCamera;
|
|
443
|
-
if (shouldDisable) {
|
|
444
|
-
this.logger.info("rtcEngine setDualStreamModeEx disable dual stream, connection: ".concat(JSON.stringify(connection)));
|
|
445
|
-
return this._rtcEngine.setDualStreamModeEx(0, {}, connection);
|
|
446
|
-
}
|
|
447
444
|
|
|
448
|
-
//
|
|
449
|
-
|
|
450
|
-
|
|
445
|
+
// 即使是 disable,也要把期望的小流配置带上,避免 native 落到默认 160x120 污染 SDK 内部 simulcast 状态,
|
|
446
|
+
// 导致后续重新 enable 双流时 LOW VFA 被算成 120x68(详见 APAAS-15529)。
|
|
447
|
+
var targetStreamConfig = this._getVideoStreamConfig(streamId, isCamera);
|
|
451
448
|
var _targetStreamConfig$l = targetStreamConfig.lowVideoEncoderConfig,
|
|
452
449
|
dimensions = _targetStreamConfig$l.dimensions,
|
|
453
450
|
bitrate = _targetStreamConfig$l.bitrate,
|
|
454
451
|
frameRate = _targetStreamConfig$l.frameRate;
|
|
455
|
-
|
|
452
|
+
var streamConfig = {
|
|
456
453
|
dimensions: dimensions,
|
|
457
454
|
kBitrate: bitrate,
|
|
458
455
|
framerate: frameRate
|
|
459
|
-
}
|
|
456
|
+
};
|
|
457
|
+
if (shouldDisable) {
|
|
458
|
+
this.logger.info("rtcEngine setDualStreamModeEx disable dual stream, connection: ".concat(JSON.stringify(connection), ", lowVideoEncoderConfig: ").concat(JSON.stringify(targetStreamConfig.lowVideoEncoderConfig)));
|
|
459
|
+
return this._rtcEngine.setDualStreamModeEx(0, streamConfig, connection);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// 启用双流模式
|
|
463
|
+
this.logger.info("rtcEngine setDualStreamModeEx enable dual stream, connection: ".concat(JSON.stringify(connection), ", lowVideoEncoderConfig: ").concat(JSON.stringify(targetStreamConfig.lowVideoEncoderConfig)));
|
|
464
|
+
return this._rtcEngine.setDualStreamModeEx(1, streamConfig, connection);
|
|
460
465
|
}
|
|
461
466
|
}, {
|
|
462
467
|
key: "setScreenScenario",
|
|
@@ -90,7 +90,7 @@ export declare const startVideoRender: ({ rtcEngine, sourceId, view, renderMode,
|
|
|
90
90
|
* @returns 设置结果代码
|
|
91
91
|
*/
|
|
92
92
|
export declare const setVideoEncoderConfig: ({ config, streamLayer, rtcEngine, rtcConnection, encodingPreference }: VideoEncoderParams, logger: Logger) => number;
|
|
93
|
-
export declare const disableDualStream: (rtcEngine: IRtcEngineEx, rtcConnection: AgoraRtcConnection, logger: Logger) => number;
|
|
93
|
+
export declare const disableDualStream: (rtcEngine: IRtcEngineEx, rtcConnection: AgoraRtcConnection, lowVideoEncoderConfig: AgoraRtcVideoEncoderConfiguration, logger: Logger) => number;
|
|
94
94
|
export declare const defaultThumbSize: Size;
|
|
95
95
|
export declare const defaultWindowIconSize: Size;
|
|
96
96
|
export declare const defaultDisplayIconSize: Size;
|
|
@@ -185,7 +185,8 @@ var setupRemoteVideoRenderer = function setupRemoteVideoRenderer(rtcEngine, sour
|
|
|
185
185
|
sourceType: 9,
|
|
186
186
|
setupMode: 1,
|
|
187
187
|
renderMode: renderModeType,
|
|
188
|
-
mirrorMode: mirrorModeType
|
|
188
|
+
mirrorMode: mirrorModeType,
|
|
189
|
+
position: 1 << 0 | 1 << 1
|
|
189
190
|
}, connection);
|
|
190
191
|
logger.info(// @ts-ignore
|
|
191
192
|
"[RenderCounter] setupRemoteVideoEx, setupMode: ".concat(1, ", current render count: ", rtcEngine.__renderCount, ", len of render caches: ").concat(AgoraEnv.AgoraRendererManager._rendererCaches.length));
|
|
@@ -500,9 +501,17 @@ var setVideoEncoderConfig = exports.setVideoEncoderConfig = function setVideoEnc
|
|
|
500
501
|
return setLowStreamEncoderConfig(config, rtcEngine, rtcConnection, logger);
|
|
501
502
|
}
|
|
502
503
|
};
|
|
503
|
-
var disableDualStream = exports.disableDualStream = function disableDualStream(rtcEngine, rtcConnection, logger) {
|
|
504
|
-
|
|
505
|
-
|
|
504
|
+
var disableDualStream = exports.disableDualStream = function disableDualStream(rtcEngine, rtcConnection, lowVideoEncoderConfig, logger) {
|
|
505
|
+
var dimensions = lowVideoEncoderConfig.dimensions,
|
|
506
|
+
bitrate = lowVideoEncoderConfig.bitrate,
|
|
507
|
+
frameRate = lowVideoEncoderConfig.frameRate;
|
|
508
|
+
// 即使是 disable 也带上期望的小流配置,避免 native 落到默认 160x120 污染 SDK 内部 simulcast 状态(APAAS-15529)。
|
|
509
|
+
logger.info("[disableDualStream]: call setDualStreamModeEx disable dual stream, streamId: ".concat(rtcConnection.localUid, ", lowVideoEncoderConfig: ").concat(JSON.stringify(lowVideoEncoderConfig)));
|
|
510
|
+
return rtcEngine.setDualStreamModeEx(0, {
|
|
511
|
+
dimensions: dimensions,
|
|
512
|
+
kBitrate: bitrate,
|
|
513
|
+
framerate: frameRate
|
|
514
|
+
}, rtcConnection);
|
|
506
515
|
};
|
|
507
516
|
|
|
508
517
|
/**
|
|
@@ -397,9 +397,10 @@ var AgoraRtcChannelWebAdapterImp = exports.AgoraRtcChannelWebAdapterImp = /*#__P
|
|
|
397
397
|
}, {
|
|
398
398
|
key: "takeSnapshot",
|
|
399
399
|
value: function takeSnapshot(streamId, filePath) {
|
|
400
|
+
var imageData = this.subscriber.takeSnapshot(streamId);
|
|
400
401
|
return Promise.resolve({
|
|
401
402
|
type: 'imageData',
|
|
402
|
-
data:
|
|
403
|
+
data: imageData
|
|
403
404
|
});
|
|
404
405
|
}
|
|
405
406
|
}, {
|
|
@@ -179,7 +179,7 @@ export var AgoraRteStreamPlayer = /*#__PURE__*/function () {
|
|
|
179
179
|
key: "takeSnapshot",
|
|
180
180
|
value: function () {
|
|
181
181
|
var _takeSnapshot = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(streamId, filePath) {
|
|
182
|
-
var _yield$this$_rtcChann, data, type;
|
|
182
|
+
var _yield$this$_rtcChann, data, type, imageData;
|
|
183
183
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
184
184
|
while (1) switch (_context.prev = _context.next) {
|
|
185
185
|
case 0:
|
|
@@ -189,13 +189,26 @@ export var AgoraRteStreamPlayer = /*#__PURE__*/function () {
|
|
|
189
189
|
_yield$this$_rtcChann = _context.sent;
|
|
190
190
|
data = _yield$this$_rtcChann.data;
|
|
191
191
|
type = _yield$this$_rtcChann.type;
|
|
192
|
+
if (!(type === 'filepath')) {
|
|
193
|
+
_context.next = 2;
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
192
196
|
return _context.abrupt("return", Promise.resolve({
|
|
193
|
-
streamId:
|
|
194
|
-
filePath:
|
|
197
|
+
streamId: streamId,
|
|
198
|
+
filePath: data,
|
|
195
199
|
width: 0,
|
|
196
200
|
height: 0
|
|
197
201
|
}));
|
|
198
202
|
case 2:
|
|
203
|
+
imageData = data;
|
|
204
|
+
return _context.abrupt("return", Promise.resolve({
|
|
205
|
+
streamId: streamId,
|
|
206
|
+
filePath: filePath,
|
|
207
|
+
width: imageData.width,
|
|
208
|
+
height: imageData.height,
|
|
209
|
+
imageData: imageData
|
|
210
|
+
}));
|
|
211
|
+
case 3:
|
|
199
212
|
case "end":
|
|
200
213
|
return _context.stop();
|
|
201
214
|
}
|
|
@@ -305,7 +305,6 @@ export var AgoraWebAudioPlayer = /*#__PURE__*/function () {
|
|
|
305
305
|
this._analyserNode = this._audioContext.createAnalyser();
|
|
306
306
|
this._analyserNode.smoothingTimeConstant = 0.3;
|
|
307
307
|
this._analyserNode.fftSize = 1024;
|
|
308
|
-
this._analyserNode.connect(this._audioContext.destination);
|
|
309
308
|
if (this._audioContext.state === 'running') {
|
|
310
309
|
this._initialized = true;
|
|
311
310
|
}
|
|
@@ -226,7 +226,8 @@ export var AgoraRtcCanvasTagPoolImpl = /*#__PURE__*/function (_AgoraRtcCanvasTag
|
|
|
226
226
|
uid: +canvasTag.sourceId,
|
|
227
227
|
view: canvasTag.canvas.view,
|
|
228
228
|
sourceType: RENDER_CONSTANTS.REMOTE_SOURCE_TYPE,
|
|
229
|
-
setupMode: RENDER_CONSTANTS.SETUP_MODES.REMOVE
|
|
229
|
+
setupMode: RENDER_CONSTANTS.SETUP_MODES.REMOVE,
|
|
230
|
+
position: 1 << 0 | 1 << 1
|
|
230
231
|
};
|
|
231
232
|
this._decrementRenderCount(this._rtcEngine);
|
|
232
233
|
this._rtcEngine.setupRemoteVideoEx(canvas, canvasTag.connection);
|
|
@@ -281,7 +282,8 @@ export var AgoraRtcCanvasTagPoolImpl = /*#__PURE__*/function (_AgoraRtcCanvasTag
|
|
|
281
282
|
uid: +canvasTag.sourceId,
|
|
282
283
|
view: null,
|
|
283
284
|
sourceType: RENDER_CONSTANTS.REMOTE_SOURCE_TYPE,
|
|
284
|
-
setupMode: RENDER_CONSTANTS.SETUP_MODES.REPLACE
|
|
285
|
+
setupMode: RENDER_CONSTANTS.SETUP_MODES.REPLACE,
|
|
286
|
+
position: 1 << 0 | 1 << 1
|
|
285
287
|
};
|
|
286
288
|
this._rtcEngine.setupRemoteVideoEx(canvas, canvasTag.connection);
|
|
287
289
|
this._logRenderInfo(this._rtcEngine, 'setupRemoteVideoEx', RENDER_CONSTANTS.SETUP_MODES.REPLACE);
|
|
@@ -10,24 +10,18 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
10
10
|
var _AgoraRtcChannelClientImpl;
|
|
11
11
|
var _initProto, _addAudioRawDataObserverDecs, _removeAudioRawDataObserverDecs, _joinDecs, _setEncryptionConfigDecs, _startRenderRemoteVideoStreamDecs, _stopRenderRemoteVideoStreamDecs, _stopRenderRemoteVideoStreamOnAllCanvasDecs, _takeSnapshotDecs, _adjustRemoteAudioStreamVolumeDecs, _renewTokenDecs, _setVideoEncoderConfigDecs, _setDualStreamModeDecs, _updateRemoteAudioStreamVolumeDecs, _setScreenScenarioDecs, _handleConnectionStateChangedDecs, _ref;
|
|
12
12
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
13
|
-
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; } } }; }
|
|
14
|
-
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; } }
|
|
15
|
-
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; }
|
|
16
13
|
import "core-js/modules/es.symbol.js";
|
|
17
14
|
import "core-js/modules/es.symbol.description.js";
|
|
18
|
-
import "core-js/modules/es.symbol.iterator.js";
|
|
19
15
|
import "core-js/modules/es.symbol.to-primitive.js";
|
|
20
16
|
import "core-js/modules/es.error.cause.js";
|
|
21
17
|
import "core-js/modules/es.error.to-string.js";
|
|
22
18
|
import "core-js/modules/es.array.concat.js";
|
|
23
19
|
import "core-js/modules/es.array.for-each.js";
|
|
24
|
-
import "core-js/modules/es.array.from.js";
|
|
25
20
|
import "core-js/modules/es.array.includes.js";
|
|
26
21
|
import "core-js/modules/es.array.is-array.js";
|
|
27
22
|
import "core-js/modules/es.array.iterator.js";
|
|
28
23
|
import "core-js/modules/es.array.join.js";
|
|
29
24
|
import "core-js/modules/es.array.push.js";
|
|
30
|
-
import "core-js/modules/es.array.slice.js";
|
|
31
25
|
import "core-js/modules/es.date.to-json.js";
|
|
32
26
|
import "core-js/modules/es.date.to-primitive.js";
|
|
33
27
|
import "core-js/modules/es.date.to-string.js";
|
|
@@ -42,8 +36,6 @@ import "core-js/modules/es.object.get-own-property-descriptor.js";
|
|
|
42
36
|
import "core-js/modules/es.object.to-string.js";
|
|
43
37
|
import "core-js/modules/es.promise.js";
|
|
44
38
|
import "core-js/modules/es.reflect.construct.js";
|
|
45
|
-
import "core-js/modules/es.regexp.exec.js";
|
|
46
|
-
import "core-js/modules/es.regexp.test.js";
|
|
47
39
|
import "core-js/modules/es.regexp.to-string.js";
|
|
48
40
|
import "core-js/modules/es.string.iterator.js";
|
|
49
41
|
import "core-js/modules/esnext.function.metadata.js";
|
|
@@ -83,7 +75,7 @@ import { AgoraRtcChannelClient } from '../../../core/rtc';
|
|
|
83
75
|
import { JOIN_TIMEOUT_MS } from '../../../core/rtc/constant';
|
|
84
76
|
import { AgoraRtcChannelType, AgoraRtcConnectionState, AgoraRtcRenderSourceType } from '../../../core/rtc/type';
|
|
85
77
|
import { createLogger, generateLogObserver } from '../../../core/utilities/logger';
|
|
86
|
-
import { DISCONNECTED_TIMEOUT, STATS_INTERVAL
|
|
78
|
+
import { DISCONNECTED_TIMEOUT, STATS_INTERVAL } from './constants';
|
|
87
79
|
import { convertConnectionState, convertEncryptionMode } from './convert-type';
|
|
88
80
|
import { AgoraRtcChannelPublisherImpl } from './publisher';
|
|
89
81
|
import { AgoraRtcChannelSubscriberImpl } from './subscriber';
|
|
@@ -232,25 +224,6 @@ export var AgoraRtcChannelClientImpl = /*#__PURE__*/function (_AgoraRtcChannelCl
|
|
|
232
224
|
channelType: _this2._channelType === AgoraRtcChannelType.LargeScale ? 1 : 0
|
|
233
225
|
};
|
|
234
226
|
_this2.logger.info("rtcEngine joinChannelEx with mediaOptions: ".concat(JSON.stringify(mediaOptions)));
|
|
235
|
-
|
|
236
|
-
// 如果是大规模频道,先逐项设置 RTC 私有参数
|
|
237
|
-
if (_this2._channelType === AgoraRtcChannelType.LargeScale) {
|
|
238
|
-
var _iterator = _createForOfIteratorHelper(LARGE_SCALE_RTC_PARAMETERS),
|
|
239
|
-
_step;
|
|
240
|
-
try {
|
|
241
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
242
|
-
var param = _step.value;
|
|
243
|
-
var _errorCode = _this2._rtcEngine.setParameters(JSON.stringify(param));
|
|
244
|
-
if (_errorCode !== 0) {
|
|
245
|
-
_this2.logger.warn("Failed to set parameter: ".concat(JSON.stringify(param), ", errorCode: ").concat(_errorCode));
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
} catch (err) {
|
|
249
|
-
_iterator.e(err);
|
|
250
|
-
} finally {
|
|
251
|
-
_iterator.f();
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
227
|
var errorCode = _this2._rtcEngine.joinChannelEx(token, _this2._rtcConnection, mediaOptions);
|
|
255
228
|
if (errorCode !== 0) {
|
|
256
229
|
_this2._rtcEngine.removeListener('onJoinChannelSuccess', _callback);
|
|
@@ -182,90 +182,6 @@ export var RTC_PARAMS = {
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
};
|
|
185
|
-
export var LARGE_SCALE_RTC_PARAMETERS = [{
|
|
186
|
-
'rtc.audio.filter_streams': 4
|
|
187
|
-
}, {
|
|
188
|
-
'rtc.log_size': 5120
|
|
189
|
-
}, {
|
|
190
|
-
'rtc.use_const_ack_delay': true
|
|
191
|
-
}, {
|
|
192
|
-
'rtc.ack_delay': 100
|
|
193
|
-
}, {
|
|
194
|
-
'rtc.metadata.enable_report': false
|
|
195
|
-
}, {
|
|
196
|
-
'rtc.max_sub_peers': 50
|
|
197
|
-
}, {
|
|
198
|
-
'rtc.vos_aut_use_old_sync': false
|
|
199
|
-
}, {
|
|
200
|
-
'rtc.report_config': {
|
|
201
|
-
'data.report.event.19': {
|
|
202
|
-
id: 19,
|
|
203
|
-
report_count: 0,
|
|
204
|
-
report_interval: 6,
|
|
205
|
-
type: 'event'
|
|
206
|
-
},
|
|
207
|
-
'data.report.event.20': {
|
|
208
|
-
id: 20,
|
|
209
|
-
report_count: 0,
|
|
210
|
-
report_interval: 6,
|
|
211
|
-
type: 'event'
|
|
212
|
-
},
|
|
213
|
-
'data.report.event.5': {
|
|
214
|
-
id: 5,
|
|
215
|
-
report_count: 0,
|
|
216
|
-
report_interval: 6,
|
|
217
|
-
type: 'event'
|
|
218
|
-
},
|
|
219
|
-
'data.report.event.6': {
|
|
220
|
-
id: 6,
|
|
221
|
-
report_count: 0,
|
|
222
|
-
report_interval: 6,
|
|
223
|
-
type: 'event'
|
|
224
|
-
},
|
|
225
|
-
'data.report.event.262': {
|
|
226
|
-
id: 262,
|
|
227
|
-
report_count: 0,
|
|
228
|
-
report_interval: 6,
|
|
229
|
-
type: 'event'
|
|
230
|
-
},
|
|
231
|
-
'data.report.event.263': {
|
|
232
|
-
id: 263,
|
|
233
|
-
report_count: 0,
|
|
234
|
-
report_interval: 6,
|
|
235
|
-
type: 'event'
|
|
236
|
-
},
|
|
237
|
-
'data.report.event.341': {
|
|
238
|
-
id: 341,
|
|
239
|
-
report_count: 0,
|
|
240
|
-
report_interval: 6,
|
|
241
|
-
type: 'event'
|
|
242
|
-
},
|
|
243
|
-
'data.report.event.342': {
|
|
244
|
-
id: 342,
|
|
245
|
-
report_count: 0,
|
|
246
|
-
report_interval: 6,
|
|
247
|
-
type: 'event'
|
|
248
|
-
},
|
|
249
|
-
'data.report.event.8': {
|
|
250
|
-
id: 8,
|
|
251
|
-
report_count: 0,
|
|
252
|
-
report_interval: 6,
|
|
253
|
-
type: 'event'
|
|
254
|
-
},
|
|
255
|
-
'data.report.event.13': {
|
|
256
|
-
id: 13,
|
|
257
|
-
report_count: 0,
|
|
258
|
-
report_interval: 6,
|
|
259
|
-
type: 'event'
|
|
260
|
-
},
|
|
261
|
-
'data.report.event.136': {
|
|
262
|
-
id: 136,
|
|
263
|
-
report_count: 0,
|
|
264
|
-
report_interval: 6,
|
|
265
|
-
type: 'event'
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}];
|
|
269
185
|
export var RENDER_CONSTANTS = {
|
|
270
186
|
REMOTE_SOURCE_TYPE: 9,
|
|
271
187
|
SETUP_MODES: {
|
|
@@ -263,7 +263,7 @@ export var AgoraElectronMediaRecorderManager = /*#__PURE__*/function () {
|
|
|
263
263
|
recordingHeight = (_currentWindowInfo$bo2 = currentWindowInfo.bounds) === null || _currentWindowInfo$bo2 === void 0 ? void 0 : _currentWindowInfo$bo2.height;
|
|
264
264
|
this.logger.info("startClientRecording: using window bounds for recording resolution, width=".concat(recordingWidth, ", height=").concat(recordingHeight));
|
|
265
265
|
}
|
|
266
|
-
this._sourceManager.startScreenCaptureByWindowId(currentWindowInfo.id,
|
|
266
|
+
this._sourceManager.startScreenCaptureByWindowId(currentWindowInfo.id, false);
|
|
267
267
|
this.logger.info("startClientRecording: started own window capture for recording (without highlight), windowId: ".concat(currentWindowInfo.id));
|
|
268
268
|
} else {
|
|
269
269
|
this.logger.warn('startClientRecording: failed to find current window for recording');
|
|
@@ -356,7 +356,7 @@ export var AgoraElectronMediaRecorderManager = /*#__PURE__*/function () {
|
|
|
356
356
|
key: "resumeOwnCapture",
|
|
357
357
|
value: (function () {
|
|
358
358
|
var _resumeOwnCapture = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
359
|
-
var currentWindowInfo, maxRetries, retryInterval, i, res;
|
|
359
|
+
var currentWindowInfo, maxRetries, retryInterval, i, maxStartAttempts, startRetryInterval, res, attempt;
|
|
360
360
|
return _regeneratorRuntime.wrap(function (_context3) {
|
|
361
361
|
while (1) switch (_context3.prev = _context3.next) {
|
|
362
362
|
case 0:
|
|
@@ -405,44 +405,80 @@ export var AgoraElectronMediaRecorderManager = /*#__PURE__*/function () {
|
|
|
405
405
|
_context3.next = 3;
|
|
406
406
|
break;
|
|
407
407
|
case 7:
|
|
408
|
-
if (currentWindowInfo) {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
// 启动自己的窗口采集
|
|
413
|
-
this._clientRecordingSourceId = currentWindowInfo.id;
|
|
414
|
-
this._clientRecordingCaptureType = AgoraRtcScreenCaptureType.WINDOW;
|
|
415
|
-
this._clientRecordingOwnsCapture = true;
|
|
416
|
-
res = this._sourceManager.startScreenCaptureByWindowId(currentWindowInfo.id, true);
|
|
417
|
-
this.logger.info("resumeOwnCapture: startScreenCaptureByWindowId result=".concat(res, ", windowId: ").concat(currentWindowInfo.id));
|
|
418
|
-
if (res !== 0) {
|
|
419
|
-
this.logger.warn("resumeOwnCapture: startScreenCaptureByWindowId failed with code ".concat(res));
|
|
420
|
-
this._sourceManager.unprotectSourceId(currentWindowInfo.id);
|
|
421
|
-
this._clientRecordingSourceId = undefined;
|
|
422
|
-
this._clientRecordingCaptureType = undefined;
|
|
423
|
-
this._clientRecordingOwnsCapture = false;
|
|
424
|
-
} else if (this._channelId && this._uid) {
|
|
425
|
-
// 采集成功后重建 MediaRecorder,因为屏幕共享停止时 SDK 内部管道已断开,
|
|
426
|
-
// 旧的 MediaRecorder 无法接收新采集源的视频帧。
|
|
427
|
-
this.logger.info('resumeOwnCapture: recreating MediaRecorder for new capture source');
|
|
428
|
-
if (this._mediaRecorder && this._isRecordingStarted) {
|
|
429
|
-
this._mediaRecorder.stopRecording();
|
|
430
|
-
this._isRecordingStarted = false;
|
|
431
|
-
}
|
|
432
|
-
if (this._mediaRecorder) {
|
|
433
|
-
this._recorderGeneration++;
|
|
434
|
-
this._rtcEngine.destroyMediaRecorder(this._mediaRecorder);
|
|
435
|
-
this._mediaRecorder = undefined;
|
|
436
|
-
this._mediaRecorderObserver = undefined;
|
|
437
|
-
}
|
|
438
|
-
this._createMediaRecorder(this._channelId, this._uid);
|
|
439
|
-
this._setupMediaRecorderObserver(this._channelId, this._uid);
|
|
440
|
-
this._startRecording(this._lastRecordingConfig);
|
|
441
|
-
}
|
|
442
|
-
} else {
|
|
443
|
-
this.logger.warn('resumeOwnCapture: failed to find current window after retries, recording may be affected');
|
|
408
|
+
if (!currentWindowInfo) {
|
|
409
|
+
_context3.next = 12;
|
|
410
|
+
break;
|
|
444
411
|
}
|
|
412
|
+
// 保护这个 sourceId 不被 onLocalVideoStateChanged 的延迟回调误杀
|
|
413
|
+
this._sourceManager.protectSourceId(currentWindowInfo.id);
|
|
414
|
+
|
|
415
|
+
// 启动自己的窗口采集
|
|
416
|
+
this._clientRecordingSourceId = currentWindowInfo.id;
|
|
417
|
+
this._clientRecordingCaptureType = AgoraRtcScreenCaptureType.WINDOW;
|
|
418
|
+
this._clientRecordingOwnsCapture = true;
|
|
419
|
+
|
|
420
|
+
// 屏幕共享停止后 RTC 内部的 VideoSourceScreenPrimary 通道还在异步拆除,
|
|
421
|
+
// 此时立刻调用 startScreenCaptureByWindowId 会返回 -2 (ERR_INVALID_ARGUMENT),
|
|
422
|
+
// 导致后续录制全是黑帧。这里做有界重试。
|
|
423
|
+
maxStartAttempts = 6;
|
|
424
|
+
startRetryInterval = 200;
|
|
425
|
+
res = -1;
|
|
426
|
+
attempt = 0;
|
|
445
427
|
case 8:
|
|
428
|
+
if (!(attempt < maxStartAttempts)) {
|
|
429
|
+
_context3.next = 11;
|
|
430
|
+
break;
|
|
431
|
+
}
|
|
432
|
+
res = this._sourceManager.startScreenCaptureByWindowId(currentWindowInfo.id, false);
|
|
433
|
+
this.logger.info("resumeOwnCapture: startScreenCaptureByWindowId result=".concat(res, ", windowId: ").concat(currentWindowInfo.id, ", attempt: ").concat(attempt + 1, "/").concat(maxStartAttempts));
|
|
434
|
+
if (!(res === 0)) {
|
|
435
|
+
_context3.next = 9;
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
return _context3.abrupt("continue", 11);
|
|
439
|
+
case 9:
|
|
440
|
+
this.logger.warn("resumeOwnCapture: startScreenCaptureByWindowId attempt ".concat(attempt + 1, " failed with code ").concat(res, ", retrying in ").concat(startRetryInterval, "ms..."));
|
|
441
|
+
_context3.next = 10;
|
|
442
|
+
return new Promise(function (r) {
|
|
443
|
+
return setTimeout(r, startRetryInterval);
|
|
444
|
+
});
|
|
445
|
+
case 10:
|
|
446
|
+
attempt++;
|
|
447
|
+
_context3.next = 8;
|
|
448
|
+
break;
|
|
449
|
+
case 11:
|
|
450
|
+
if (res !== 0) {
|
|
451
|
+
this.logger.warn("resumeOwnCapture: startScreenCaptureByWindowId failed with code ".concat(res, " after ").concat(maxStartAttempts, " attempts"));
|
|
452
|
+
this._sourceManager.unprotectSourceId(currentWindowInfo.id);
|
|
453
|
+
this._clientRecordingSourceId = undefined;
|
|
454
|
+
this._clientRecordingCaptureType = undefined;
|
|
455
|
+
this._clientRecordingOwnsCapture = false;
|
|
456
|
+
}
|
|
457
|
+
// else if (this._channelId && this._uid) {
|
|
458
|
+
// // 采集成功后重建 MediaRecorder,因为屏幕共享停止时 SDK 内部管道已断开,
|
|
459
|
+
// // 旧的 MediaRecorder 无法接收新采集源的视频帧。
|
|
460
|
+
// this.logger.info('resumeOwnCapture: recreating MediaRecorder for new capture source');
|
|
461
|
+
|
|
462
|
+
// if (this._mediaRecorder && this._isRecordingStarted) {
|
|
463
|
+
// this._mediaRecorder.stopRecording();
|
|
464
|
+
// this._isRecordingStarted = false;
|
|
465
|
+
// }
|
|
466
|
+
// if (this._mediaRecorder) {
|
|
467
|
+
// this._recorderGeneration++;
|
|
468
|
+
// this._rtcEngine.destroyMediaRecorder(this._mediaRecorder);
|
|
469
|
+
// this._mediaRecorder = undefined;
|
|
470
|
+
// this._mediaRecorderObserver = undefined;
|
|
471
|
+
// }
|
|
472
|
+
|
|
473
|
+
// this._createMediaRecorder(this._channelId, this._uid);
|
|
474
|
+
// this._setupMediaRecorderObserver(this._channelId, this._uid);
|
|
475
|
+
// this._startRecording(this._lastRecordingConfig);
|
|
476
|
+
// }
|
|
477
|
+
_context3.next = 13;
|
|
478
|
+
break;
|
|
479
|
+
case 12:
|
|
480
|
+
this.logger.warn('resumeOwnCapture: failed to find current window after retries, recording may be affected');
|
|
481
|
+
case 13:
|
|
446
482
|
case "end":
|
|
447
483
|
return _context3.stop();
|
|
448
484
|
}
|
|
@@ -582,7 +618,10 @@ export var AgoraElectronMediaRecorderManager = /*#__PURE__*/function () {
|
|
|
582
618
|
videoSourceType: 2,
|
|
583
619
|
width: config === null || config === void 0 ? void 0 : config.width,
|
|
584
620
|
height: config === null || config === void 0 ? void 0 : config.height,
|
|
585
|
-
fps: config === null || config === void 0 ? void 0 : config.fps
|
|
621
|
+
fps: config === null || config === void 0 ? void 0 : config.fps,
|
|
622
|
+
audioConfiguration: {
|
|
623
|
+
audioRecordingType: 4
|
|
624
|
+
}
|
|
586
625
|
};
|
|
587
626
|
var result = (_this$_mediaRecorder2 = this._mediaRecorder) === null || _this$_mediaRecorder2 === void 0 ? void 0 : _this$_mediaRecorder2.startRecording(recordingConfig);
|
|
588
627
|
if (result !== undefined && result !== 0) {
|
|
@@ -129,7 +129,8 @@ export var AgoraRtcChannelPublisherImpl = /*#__PURE__*/function () {
|
|
|
129
129
|
|
|
130
130
|
// disable dual stream for screen
|
|
131
131
|
if (item.videoSourceType === AgoraRtcVideoSourceType.SCREEN) {
|
|
132
|
-
|
|
132
|
+
var screenStreamConfig = _this._getVideoStreamConfig(item.connection.localUid.toString(), false);
|
|
133
|
+
disableDualStream(_this._rtcEngine, item.connection, screenStreamConfig.lowVideoEncoderConfig, _this.logger);
|
|
133
134
|
}
|
|
134
135
|
if (oldHandleLocalVideoStats) {
|
|
135
136
|
_this._rtcEngine.removeListener('onLocalVideoStats', oldHandleLocalVideoStats);
|
|
@@ -433,23 +434,27 @@ export var AgoraRtcChannelPublisherImpl = /*#__PURE__*/function () {
|
|
|
433
434
|
|
|
434
435
|
// 非摄像头视频源或禁用双流模式时,禁用双流
|
|
435
436
|
var shouldDisable = !enable || !isCamera;
|
|
436
|
-
if (shouldDisable) {
|
|
437
|
-
this.logger.info("rtcEngine setDualStreamModeEx disable dual stream, connection: ".concat(JSON.stringify(connection)));
|
|
438
|
-
return this._rtcEngine.setDualStreamModeEx(0, {}, connection);
|
|
439
|
-
}
|
|
440
437
|
|
|
441
|
-
//
|
|
442
|
-
|
|
443
|
-
|
|
438
|
+
// 即使是 disable,也要把期望的小流配置带上,避免 native 落到默认 160x120 污染 SDK 内部 simulcast 状态,
|
|
439
|
+
// 导致后续重新 enable 双流时 LOW VFA 被算成 120x68(详见 APAAS-15529)。
|
|
440
|
+
var targetStreamConfig = this._getVideoStreamConfig(streamId, isCamera);
|
|
444
441
|
var _targetStreamConfig$l = targetStreamConfig.lowVideoEncoderConfig,
|
|
445
442
|
dimensions = _targetStreamConfig$l.dimensions,
|
|
446
443
|
bitrate = _targetStreamConfig$l.bitrate,
|
|
447
444
|
frameRate = _targetStreamConfig$l.frameRate;
|
|
448
|
-
|
|
445
|
+
var streamConfig = {
|
|
449
446
|
dimensions: dimensions,
|
|
450
447
|
kBitrate: bitrate,
|
|
451
448
|
framerate: frameRate
|
|
452
|
-
}
|
|
449
|
+
};
|
|
450
|
+
if (shouldDisable) {
|
|
451
|
+
this.logger.info("rtcEngine setDualStreamModeEx disable dual stream, connection: ".concat(JSON.stringify(connection), ", lowVideoEncoderConfig: ").concat(JSON.stringify(targetStreamConfig.lowVideoEncoderConfig)));
|
|
452
|
+
return this._rtcEngine.setDualStreamModeEx(0, streamConfig, connection);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// 启用双流模式
|
|
456
|
+
this.logger.info("rtcEngine setDualStreamModeEx enable dual stream, connection: ".concat(JSON.stringify(connection), ", lowVideoEncoderConfig: ").concat(JSON.stringify(targetStreamConfig.lowVideoEncoderConfig)));
|
|
457
|
+
return this._rtcEngine.setDualStreamModeEx(1, streamConfig, connection);
|
|
453
458
|
}
|
|
454
459
|
}, {
|
|
455
460
|
key: "setScreenScenario",
|
|
@@ -177,7 +177,8 @@ var setupRemoteVideoRenderer = function setupRemoteVideoRenderer(rtcEngine, sour
|
|
|
177
177
|
sourceType: 9,
|
|
178
178
|
setupMode: 1,
|
|
179
179
|
renderMode: renderModeType,
|
|
180
|
-
mirrorMode: mirrorModeType
|
|
180
|
+
mirrorMode: mirrorModeType,
|
|
181
|
+
position: 1 << 0 | 1 << 1
|
|
181
182
|
}, connection);
|
|
182
183
|
logger.info(// @ts-ignore
|
|
183
184
|
"[RenderCounter] setupRemoteVideoEx, setupMode: ".concat(1, ", current render count: ", rtcEngine.__renderCount, ", len of render caches: ").concat(AgoraEnv.AgoraRendererManager._rendererCaches.length));
|
|
@@ -492,9 +493,17 @@ export var setVideoEncoderConfig = function setVideoEncoderConfig(_ref2, logger)
|
|
|
492
493
|
return setLowStreamEncoderConfig(config, rtcEngine, rtcConnection, logger);
|
|
493
494
|
}
|
|
494
495
|
};
|
|
495
|
-
export var disableDualStream = function disableDualStream(rtcEngine, rtcConnection, logger) {
|
|
496
|
-
|
|
497
|
-
|
|
496
|
+
export var disableDualStream = function disableDualStream(rtcEngine, rtcConnection, lowVideoEncoderConfig, logger) {
|
|
497
|
+
var dimensions = lowVideoEncoderConfig.dimensions,
|
|
498
|
+
bitrate = lowVideoEncoderConfig.bitrate,
|
|
499
|
+
frameRate = lowVideoEncoderConfig.frameRate;
|
|
500
|
+
// 即使是 disable 也带上期望的小流配置,避免 native 落到默认 160x120 污染 SDK 内部 simulcast 状态(APAAS-15529)。
|
|
501
|
+
logger.info("[disableDualStream]: call setDualStreamModeEx disable dual stream, streamId: ".concat(rtcConnection.localUid, ", lowVideoEncoderConfig: ").concat(JSON.stringify(lowVideoEncoderConfig)));
|
|
502
|
+
return rtcEngine.setDualStreamModeEx(0, {
|
|
503
|
+
dimensions: dimensions,
|
|
504
|
+
kBitrate: bitrate,
|
|
505
|
+
framerate: frameRate
|
|
506
|
+
}, rtcConnection);
|
|
498
507
|
};
|
|
499
508
|
|
|
500
509
|
/**
|
|
@@ -390,9 +390,10 @@ export var AgoraRtcChannelWebAdapterImp = /*#__PURE__*/function (_AgoraRtcChanne
|
|
|
390
390
|
}, {
|
|
391
391
|
key: "takeSnapshot",
|
|
392
392
|
value: function takeSnapshot(streamId, filePath) {
|
|
393
|
+
var imageData = this.subscriber.takeSnapshot(streamId);
|
|
393
394
|
return Promise.resolve({
|
|
394
395
|
type: 'imageData',
|
|
395
|
-
data:
|
|
396
|
+
data: imageData
|
|
396
397
|
});
|
|
397
398
|
}
|
|
398
399
|
}, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agora-rte-sdk",
|
|
3
|
-
"version": "3.11.0
|
|
3
|
+
"version": "3.11.0",
|
|
4
4
|
"description": "SDK for building interactive scenarios",
|
|
5
5
|
"author": "agora.io",
|
|
6
6
|
"license": "ISC",
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
"prepare": "husky",
|
|
16
16
|
"build": "agora-tc-transpile --esm",
|
|
17
17
|
"test-browser": "agora-tc-test-karma-browser",
|
|
18
|
-
"test-electron": "agora-tc-test-karma-electron"
|
|
19
|
-
"preinstall": "node ./scripts/check-ai-kb.js"
|
|
18
|
+
"test-electron": "agora-tc-test-karma-electron"
|
|
20
19
|
},
|
|
21
20
|
"devDependencies": {
|
|
22
21
|
"@babel/cli": "^7.17.6",
|
|
@@ -31,7 +30,7 @@
|
|
|
31
30
|
"@types/sinon": "^17.0.2",
|
|
32
31
|
"@types/ua-parser-js": "^0.7.35",
|
|
33
32
|
"agora-token": "^2.0.3",
|
|
34
|
-
"agora-toolchain": "3.11.0
|
|
33
|
+
"agora-toolchain": "3.11.0",
|
|
35
34
|
"core-js": "^3.33.3",
|
|
36
35
|
"electron": "22.3.27",
|
|
37
36
|
"husky": "^9.0.11",
|
|
@@ -42,11 +41,11 @@
|
|
|
42
41
|
"typescript": "^5.3.2"
|
|
43
42
|
},
|
|
44
43
|
"dependencies": {
|
|
45
|
-
"shengwang-electron-sdk": "4.6.3-build.133-rc.
|
|
44
|
+
"shengwang-electron-sdk": "4.6.3-build.133-rc.16",
|
|
46
45
|
"agora-extension-ai-denoiser": "^1.0.0",
|
|
47
46
|
"agora-extension-beauty-effect": "^1.0.1-beta",
|
|
48
47
|
"agora-extension-virtual-background": "^2.1.0",
|
|
49
|
-
"agora-foundation": "3.11.0
|
|
48
|
+
"agora-foundation": "3.11.0",
|
|
50
49
|
"agora-rtc-sdk-ng": "4.23.3",
|
|
51
50
|
"agora-rtm": "2.2.2-3",
|
|
52
51
|
"await-to-js": "^3.0.0",
|