agora-rte-sdk 2.8.21 → 2.8.40
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/dist/index.js +2 -2
- package/lib/configs/index.d.ts +8 -6
- package/lib/configs/index.js +8 -6
- package/lib/core/engine/index.js +1 -7
- package/lib/core/logger/index.d.ts +1 -0
- package/lib/core/logger/index.js +22 -2
- package/lib/core/logger/log.worker.js +4 -2
- package/lib/core/media/control.d.ts +11 -8
- package/lib/core/media/control.js +42 -32
- package/lib/core/media/player.d.ts +9 -0
- package/lib/core/media/player.js +36 -0
- package/lib/core/media/track.d.ts +8 -1
- package/lib/core/media/track.js +18 -0
- package/lib/core/media/type.d.ts +113 -0
- package/lib/core/media/type.js +31 -0
- package/lib/core/processor/channel-msg/data.d.ts +1 -0
- package/lib/core/processor/channel-msg/data.js +5 -0
- package/lib/core/processor/channel-msg/handler.d.ts +1 -3
- package/lib/core/processor/channel-msg/handler.js +20 -21
- package/lib/core/processor/channel-msg/message-parser.d.ts +6 -0
- package/lib/core/processor/channel-msg/message-parser.js +57 -0
- package/lib/core/processor/channel-msg/struct.d.ts +5 -0
- package/lib/core/processor/channel-msg/synchronizer.d.ts +7 -14
- package/lib/core/processor/channel-msg/synchronizer.js +33 -48
- package/lib/core/processor/peer-msg/handler.d.ts +16 -0
- package/lib/core/processor/peer-msg/handler.js +57 -0
- package/lib/core/processor/peer-msg/struct.d.ts +4 -0
- package/lib/core/processor/type.d.ts +200 -0
- package/lib/core/rc/index.js +6 -2
- package/lib/core/rtc/adapter/base.d.ts +6 -7
- package/lib/core/rtc/adapter/electron/device.d.ts +0 -1
- package/lib/core/rtc/adapter/electron/device.js +0 -5
- package/lib/core/rtc/adapter/electron/index.d.ts +6 -7
- package/lib/core/rtc/adapter/electron/index.js +22 -24
- package/lib/core/rtc/adapter/web/client.d.ts +11 -9
- package/lib/core/rtc/adapter/web/client.js +40 -38
- package/lib/core/rtc/adapter/web/device.d.ts +0 -1
- package/lib/core/rtc/adapter/web/device.js +0 -5
- package/lib/core/rtc/adapter/web/dispatcher.d.ts +61 -0
- package/lib/core/rtc/adapter/web/dispatcher.js +166 -0
- package/lib/core/rtc/adapter/web/index.d.ts +11 -7
- package/lib/core/rtc/adapter/web/index.js +25 -16
- package/lib/core/rtc/adapter/web/thread.d.ts +18 -11
- package/lib/core/rtc/adapter/web/thread.js +241 -133
- package/lib/core/rtc/channel.d.ts +2 -3
- package/lib/core/rtc/index.d.ts +5 -4
- package/lib/core/rtc/index.js +12 -12
- package/lib/core/rtc/type.d.ts +0 -4
- package/lib/core/services/api.d.ts +15 -0
- package/lib/core/services/api.js +36 -1
- package/lib/core/utils/events.d.ts +0 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +24 -17
- package/lib/scene/index.d.ts +1 -5
- package/lib/scene/index.js +88 -66
- package/lib/scene/state-sync.d.ts +21 -0
- package/lib/scene/state-sync.js +169 -0
- package/package.json +1 -1
|
@@ -15,8 +15,6 @@ require("core-js/modules/es.function.name.js");
|
|
|
15
15
|
require("core-js/modules/es.object.set-prototype-of.js");
|
|
16
16
|
require("core-js/modules/es.promise.js");
|
|
17
17
|
require("core-js/modules/es.array.reverse.js");
|
|
18
|
-
require("core-js/modules/es.weak-map.js");
|
|
19
|
-
require("core-js/modules/esnext.weak-map.delete-all.js");
|
|
20
18
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
21
19
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
22
20
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -62,7 +60,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
62
60
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
63
61
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
64
62
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
65
|
-
var _agoraRtcSdkNg =
|
|
63
|
+
var _agoraRtcSdkNg = _interopRequireDefault(require("agora-rtc-sdk-ng"));
|
|
66
64
|
var _events = require("../../../utils/events");
|
|
67
65
|
var _stats = require("./stats");
|
|
68
66
|
var _thread2 = require("./thread");
|
|
@@ -74,8 +72,6 @@ var _log = require("../../../decorator/log");
|
|
|
74
72
|
var _lodash = require("lodash");
|
|
75
73
|
var _decorator = require("../../../decorator");
|
|
76
74
|
var _dec, _class, _class3;
|
|
77
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
78
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
79
75
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; 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; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; 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); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { 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); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; 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; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
80
76
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
81
77
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -85,8 +81,7 @@ var AgoraRteWebClientBase = (_dec = _log.Log.attach({
|
|
|
85
81
|
}), _dec(_class = /*#__PURE__*/function (_AGEventEmitter) {
|
|
86
82
|
(0, _inherits2["default"])(AgoraRteWebClientBase, _AGEventEmitter);
|
|
87
83
|
var _super = _createSuper(AgoraRteWebClientBase);
|
|
88
|
-
function AgoraRteWebClientBase(channelName, configs, base, connectionType) {
|
|
89
|
-
var _ref;
|
|
84
|
+
function AgoraRteWebClientBase(channelName, configs, base, connectionType, audioRawDataDispatcher) {
|
|
90
85
|
var _this;
|
|
91
86
|
(0, _classCallCheck2["default"])(this, AgoraRteWebClientBase);
|
|
92
87
|
_this = _super.call(this);
|
|
@@ -94,9 +89,10 @@ var AgoraRteWebClientBase = (_dec = _log.Log.attach({
|
|
|
94
89
|
_this._client = void 0;
|
|
95
90
|
_this._base = void 0;
|
|
96
91
|
_this.configs = void 0;
|
|
97
|
-
_this._connectionState = _type.AGRtcState.Idle;
|
|
98
92
|
_this.channelName = void 0;
|
|
99
93
|
_this.connectionType = void 0;
|
|
94
|
+
_this._audioRawDataDispatcher = void 0;
|
|
95
|
+
_this._connectionState = _type.AGRtcState.Idle;
|
|
100
96
|
_this._networkStats = new _stats.RtcNetworkQualityWeb();
|
|
101
97
|
_this._recentLocalPacketStats = [];
|
|
102
98
|
_this._recentRemotePacketStats = [];
|
|
@@ -104,6 +100,7 @@ var AgoraRteWebClientBase = (_dec = _log.Log.attach({
|
|
|
104
100
|
_this.configs = configs;
|
|
105
101
|
_this._base = base;
|
|
106
102
|
_this.connectionType = connectionType;
|
|
103
|
+
_this._audioRawDataDispatcher = audioRawDataDispatcher;
|
|
107
104
|
_agoraRtcSdkNg["default"].setArea({
|
|
108
105
|
areaCode: [_this._rtcRegion()]
|
|
109
106
|
});
|
|
@@ -118,8 +115,10 @@ var AgoraRteWebClientBase = (_dec = _log.Log.attach({
|
|
|
118
115
|
codec: _this.configs.codec,
|
|
119
116
|
mode: _this.configs.mode
|
|
120
117
|
});
|
|
121
|
-
var defaultRemoteVideoStreamType =
|
|
122
|
-
|
|
118
|
+
var defaultRemoteVideoStreamType = _configs.AgoraRteEngineConfig.shared.rtcConfigs.defaultRemoteVideoStreamType;
|
|
119
|
+
if (typeof defaultRemoteVideoStreamType !== 'undefined') {
|
|
120
|
+
_this._client.setRemoteDefaultVideoStreamType(defaultRemoteVideoStreamType);
|
|
121
|
+
}
|
|
123
122
|
|
|
124
123
|
// set encryption if needed
|
|
125
124
|
var rtcConfigs = _configs.AgoraRteEngineConfig.shared.rtcConfigs;
|
|
@@ -341,10 +340,10 @@ exports.AgoraRteWebClientBase = AgoraRteWebClientBase;
|
|
|
341
340
|
var AgoraRteWebClientMain = (_class3 = /*#__PURE__*/function (_AgoraRteWebClientBas) {
|
|
342
341
|
(0, _inherits2["default"])(AgoraRteWebClientMain, _AgoraRteWebClientBas);
|
|
343
342
|
var _super2 = _createSuper(AgoraRteWebClientMain);
|
|
344
|
-
function AgoraRteWebClientMain(channelName, configs, base, connectionType) {
|
|
343
|
+
function AgoraRteWebClientMain(channelName, configs, base, connectionType, audioRawDataDispatcher) {
|
|
345
344
|
var _this2;
|
|
346
345
|
(0, _classCallCheck2["default"])(this, AgoraRteWebClientMain);
|
|
347
|
-
_this2 = _super2.call(this, channelName, configs, base, connectionType);
|
|
346
|
+
_this2 = _super2.call(this, channelName, configs, base, connectionType, audioRawDataDispatcher);
|
|
348
347
|
_this2._remoteRtcUsers = new Map();
|
|
349
348
|
_this2._muteRemoteVideo = new Map();
|
|
350
349
|
_this2._muteRemoteAudio = new Map();
|
|
@@ -353,7 +352,6 @@ var AgoraRteWebClientMain = (_class3 = /*#__PURE__*/function (_AgoraRteWebClient
|
|
|
353
352
|
_this2._subscribeVideoThreads = new Map();
|
|
354
353
|
_this2._subscribeAudioThreads = new Map();
|
|
355
354
|
_this2._publishThread = new _thread2.AgoraRtePublishThreadMain(_this2._client, configs);
|
|
356
|
-
|
|
357
355
|
//publish thread needs to wait till join channel
|
|
358
356
|
_this2._publishThread.runnable = false;
|
|
359
357
|
var throttledVolumeIndicator = (0, _lodash.throttle)(_this2._notifyStreamVolumes, 500);
|
|
@@ -366,7 +364,7 @@ var AgoraRteWebClientMain = (_class3 = /*#__PURE__*/function (_AgoraRteWebClient
|
|
|
366
364
|
muteMap: _this2._muteRemoteVideo,
|
|
367
365
|
mediaType: 'video',
|
|
368
366
|
canvasMap: _this2.base.remoteCanvas
|
|
369
|
-
});
|
|
367
|
+
}, audioRawDataDispatcher);
|
|
370
368
|
_this2._subscribeVideoThreads.set(streamUuid, thread);
|
|
371
369
|
thread.runnable = _this2.ready;
|
|
372
370
|
} else {
|
|
@@ -374,7 +372,7 @@ var AgoraRteWebClientMain = (_class3 = /*#__PURE__*/function (_AgoraRteWebClient
|
|
|
374
372
|
channelName: _this2.channelName,
|
|
375
373
|
muteMap: _this2._muteRemoteAudio,
|
|
376
374
|
mediaType: 'audio'
|
|
377
|
-
});
|
|
375
|
+
}, audioRawDataDispatcher);
|
|
378
376
|
_thread.on('audio-volume-indication', function (volume) {
|
|
379
377
|
_this2._audioVolumes.set(streamUuid, volume);
|
|
380
378
|
throttledVolumeIndicator();
|
|
@@ -387,34 +385,36 @@ var AgoraRteWebClientMain = (_class3 = /*#__PURE__*/function (_AgoraRteWebClient
|
|
|
387
385
|
_this2._client.on('user-unpublished', function (user) {
|
|
388
386
|
if (!user.hasAudio && !user.hasVideo) {
|
|
389
387
|
// if user has no video/audio, take him out
|
|
390
|
-
var
|
|
391
|
-
_this2._remoteRtcUsers["delete"](
|
|
392
|
-
var videoThread = _this2._subscribeVideoThreads.get(
|
|
393
|
-
var audioThread = _this2._subscribeAudioThreads.get(
|
|
388
|
+
var streamUuid = "".concat(user.uid);
|
|
389
|
+
_this2._remoteRtcUsers["delete"](streamUuid);
|
|
390
|
+
var videoThread = _this2._subscribeVideoThreads.get(streamUuid);
|
|
391
|
+
var audioThread = _this2._subscribeAudioThreads.get(streamUuid);
|
|
394
392
|
if (videoThread) {
|
|
395
393
|
videoThread.stop();
|
|
396
|
-
_this2._subscribeVideoThreads["delete"](
|
|
394
|
+
_this2._subscribeVideoThreads["delete"](streamUuid);
|
|
397
395
|
}
|
|
398
396
|
if (audioThread) {
|
|
397
|
+
audioRawDataDispatcher.dispatch('AudioTrackUnsubscribed', audioThread.streamUuid, channelName);
|
|
399
398
|
audioThread.stop();
|
|
400
|
-
_this2._audioVolumes["delete"](
|
|
401
|
-
_this2._subscribeAudioThreads["delete"](
|
|
399
|
+
_this2._audioVolumes["delete"](streamUuid);
|
|
400
|
+
_this2._subscribeAudioThreads["delete"](streamUuid);
|
|
402
401
|
}
|
|
403
402
|
}
|
|
404
403
|
});
|
|
405
404
|
_this2._client.on('user-left', function (user) {
|
|
406
|
-
var
|
|
407
|
-
_this2._remoteRtcUsers["delete"](
|
|
408
|
-
var videoThread = _this2._subscribeVideoThreads.get(
|
|
409
|
-
var audioThread = _this2._subscribeAudioThreads.get(
|
|
405
|
+
var streamUuid = "".concat(user.uid);
|
|
406
|
+
_this2._remoteRtcUsers["delete"](streamUuid);
|
|
407
|
+
var videoThread = _this2._subscribeVideoThreads.get(streamUuid);
|
|
408
|
+
var audioThread = _this2._subscribeAudioThreads.get(streamUuid);
|
|
410
409
|
if (videoThread) {
|
|
411
410
|
videoThread.stop();
|
|
412
|
-
_this2._subscribeVideoThreads["delete"](
|
|
411
|
+
_this2._subscribeVideoThreads["delete"](streamUuid);
|
|
413
412
|
}
|
|
414
413
|
if (audioThread) {
|
|
414
|
+
audioRawDataDispatcher.dispatch('AudioTrackUnsubscribed', streamUuid, channelName);
|
|
415
415
|
audioThread.stop();
|
|
416
|
-
_this2._audioVolumes["delete"](
|
|
417
|
-
_this2._subscribeAudioThreads["delete"](
|
|
416
|
+
_this2._audioVolumes["delete"](streamUuid);
|
|
417
|
+
_this2._subscribeAudioThreads["delete"](streamUuid);
|
|
418
418
|
}
|
|
419
419
|
});
|
|
420
420
|
return _this2;
|
|
@@ -562,8 +562,8 @@ var AgoraRteWebClientMain = (_class3 = /*#__PURE__*/function (_AgoraRteWebClient
|
|
|
562
562
|
_context3.next = 11;
|
|
563
563
|
return this._client.massSubscribe(users);
|
|
564
564
|
case 11:
|
|
565
|
-
subList = _context3.sent.map(function (
|
|
566
|
-
var user =
|
|
565
|
+
subList = _context3.sent.map(function (_ref) {
|
|
566
|
+
var user = _ref.user;
|
|
567
567
|
return "".concat(user.uid);
|
|
568
568
|
});
|
|
569
569
|
subList.forEach(function (streamUuid) {
|
|
@@ -611,6 +611,7 @@ var AgoraRteWebClientMain = (_class3 = /*#__PURE__*/function (_AgoraRteWebClient
|
|
|
611
611
|
key: "leave",
|
|
612
612
|
value: function () {
|
|
613
613
|
var _leave2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
614
|
+
var _this4 = this;
|
|
614
615
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
615
616
|
while (1) {
|
|
616
617
|
switch (_context4.prev = _context4.next) {
|
|
@@ -625,6 +626,7 @@ var AgoraRteWebClientMain = (_class3 = /*#__PURE__*/function (_AgoraRteWebClient
|
|
|
625
626
|
});
|
|
626
627
|
this._subscribeVideoThreads.clear();
|
|
627
628
|
this._subscribeAudioThreads.forEach(function (thread) {
|
|
629
|
+
_this4._audioRawDataDispatcher.dispatch('AudioTrackUnsubscribed', thread.streamUuid, _this4.channelName);
|
|
628
630
|
thread.stop();
|
|
629
631
|
});
|
|
630
632
|
this._subscribeAudioThreads.clear();
|
|
@@ -648,16 +650,16 @@ exports.AgoraRteWebClientMain = AgoraRteWebClientMain;
|
|
|
648
650
|
var AgoraRteWebClientSub = /*#__PURE__*/function (_AgoraRteWebClientBas2) {
|
|
649
651
|
(0, _inherits2["default"])(AgoraRteWebClientSub, _AgoraRteWebClientBas2);
|
|
650
652
|
var _super3 = _createSuper(AgoraRteWebClientSub);
|
|
651
|
-
function AgoraRteWebClientSub(channelName, configs, base, connectionType) {
|
|
652
|
-
var
|
|
653
|
+
function AgoraRteWebClientSub(channelName, configs, base, connectionType, audioRawDataDispatcher) {
|
|
654
|
+
var _this5;
|
|
653
655
|
(0, _classCallCheck2["default"])(this, AgoraRteWebClientSub);
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
656
|
+
_this5 = _super3.call(this, channelName, configs, base, connectionType, audioRawDataDispatcher);
|
|
657
|
+
_this5._publishThread = void 0;
|
|
658
|
+
_this5._publishThread = new _thread2.AgoraRtePublishThreadSub(_this5._client, configs);
|
|
657
659
|
|
|
658
660
|
//publish thread needs to wait till join channel
|
|
659
|
-
|
|
660
|
-
return
|
|
661
|
+
_this5._publishThread.runnable = false;
|
|
662
|
+
return _this5;
|
|
661
663
|
}
|
|
662
664
|
(0, _createClass2["default"])(AgoraRteWebClientSub, [{
|
|
663
665
|
key: "muteLocalVideo",
|
|
@@ -22,7 +22,6 @@ export declare class RtcAudioDeviceManagerWeb extends RtcAudioDeviceManagerBase
|
|
|
22
22
|
private _playbackDeviceIds;
|
|
23
23
|
constructor(adapter: RtcAdapterWeb, noDevicePermission?: boolean);
|
|
24
24
|
onLocalAudioPlaybackTestVolumeChanged(cb: LocalAudioPlaybackVolumeIndicatorEvent): number;
|
|
25
|
-
onAudioFrame(cb: (buffer: ArrayBuffer) => void): number;
|
|
26
25
|
onLocalAudioTrackStateChanged(cb: LocalAudioTrackStateEvent): number;
|
|
27
26
|
onLocalAudioVolume(cb: (volume: number) => void): number;
|
|
28
27
|
onLocalRecordingDeviceListChanged(cb: (addNewDevice: boolean, newDevices: AGRtcDeviceInfo[], allDevices: AGRtcDeviceInfo[]) => void): number;
|
|
@@ -214,11 +214,6 @@ var RtcAudioDeviceManagerWeb = /*#__PURE__*/function (_RtcAudioDeviceManage) {
|
|
|
214
214
|
value: function onLocalAudioPlaybackTestVolumeChanged(cb) {
|
|
215
215
|
return this.adapter.onLocalAudioPlaybackTestVolumeChanged(cb);
|
|
216
216
|
}
|
|
217
|
-
}, {
|
|
218
|
-
key: "onAudioFrame",
|
|
219
|
-
value: function onAudioFrame(cb) {
|
|
220
|
-
return this.adapter.onAudioFrame(cb);
|
|
221
|
-
}
|
|
222
217
|
}, {
|
|
223
218
|
key: "onLocalAudioTrackStateChanged",
|
|
224
219
|
value: function onLocalAudioTrackStateChanged(cb) {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ILocalAudioTrack, IRemoteAudioTrack } from 'agora-rtc-sdk-ng';
|
|
2
|
+
import { Logger } from '../../../logger';
|
|
3
|
+
import { AgoraRteAudioRawDataConfig, AgoraRteAudioRawDataObserver, AgoraRteAudioRawDataPosition, AgoraRteAudioRawData } from '../../../media/type';
|
|
4
|
+
declare type CallbackRawDataRecorded = (rawData: AgoraRteAudioRawData) => void;
|
|
5
|
+
declare type CallbackRawDataBeforeMixed = (rawData: AgoraRteAudioRawData, streamUuid: string, channelName: string) => void;
|
|
6
|
+
declare type CallbackObserverChanged = (position: AgoraRteAudioRawDataPosition) => void;
|
|
7
|
+
declare type CallbackMicrophoneTrackCreated = (track: ILocalAudioTrack) => void;
|
|
8
|
+
declare type CallbackAudioTrackSubscribed = (track: IRemoteAudioTrack, streamUuid: string, channelName: string) => void;
|
|
9
|
+
declare type CallbackMicrophoneTrackDestroyed = () => void;
|
|
10
|
+
declare type CallbackAudioTrackUnsubscribed = (streamUuid: string, channelName: string) => void;
|
|
11
|
+
declare type CallbackStart = () => void;
|
|
12
|
+
declare type CallbackStop = () => void;
|
|
13
|
+
export declare class AGAudioRawDataDispatcher {
|
|
14
|
+
logger: Logger;
|
|
15
|
+
private static DEFAULT_FRAME_SIZE;
|
|
16
|
+
private _microphoneTrackRawDataObservers;
|
|
17
|
+
private _audioTrackRawDataObservers;
|
|
18
|
+
private _eventBus;
|
|
19
|
+
private _configs;
|
|
20
|
+
private _state;
|
|
21
|
+
setConfig(config: AgoraRteAudioRawDataConfig, position: AgoraRteAudioRawDataPosition): void;
|
|
22
|
+
get isStarted(): boolean;
|
|
23
|
+
get microphoneTrackRawDataConfig(): AgoraRteAudioRawDataConfig;
|
|
24
|
+
get audioTrackRawDataConfig(): AgoraRteAudioRawDataConfig;
|
|
25
|
+
get hasMicrophoneRawDataObservers(): boolean;
|
|
26
|
+
get hasAudioTrackRawDataObservers(): boolean;
|
|
27
|
+
private _callbackAudioRawRecorded;
|
|
28
|
+
private _callbackAudioRawBeforeMixed;
|
|
29
|
+
start(): void;
|
|
30
|
+
stop(): void;
|
|
31
|
+
dispatch(event: 'AudioRawDataRecored', ...params: Parameters<CallbackRawDataRecorded>): void;
|
|
32
|
+
dispatch(event: 'AudioRawDataBeforeMixed', ...params: Parameters<CallbackRawDataBeforeMixed>): void;
|
|
33
|
+
dispatch(event: 'ObserverChanged', ...params: Parameters<CallbackObserverChanged>): void;
|
|
34
|
+
dispatch(event: 'MicrophoneTrackCreated', ...params: Parameters<CallbackMicrophoneTrackCreated>): void;
|
|
35
|
+
dispatch(event: 'AudioTrackSubscribed', ...params: Parameters<CallbackAudioTrackSubscribed>): void;
|
|
36
|
+
dispatch(event: 'MicrophoneTrackDestroyed', ...params: Parameters<CallbackMicrophoneTrackDestroyed>): void;
|
|
37
|
+
dispatch(event: 'AudioTrackUnsubscribed', ...params: Parameters<CallbackAudioTrackUnsubscribed>): void;
|
|
38
|
+
dispatch(event: 'Start', ...params: Parameters<CallbackStart>): void;
|
|
39
|
+
dispatch(event: 'Stop', ...params: Parameters<CallbackStop>): void;
|
|
40
|
+
register(event: 'AudioRawDataRecored', callback: CallbackRawDataRecorded): void;
|
|
41
|
+
register(event: 'AudioRawDataBeforeMixed', callback: CallbackRawDataBeforeMixed): void;
|
|
42
|
+
register(event: 'ObserverChanged', callback: CallbackObserverChanged): void;
|
|
43
|
+
register(event: 'MicrophoneTrackCreated', callback: CallbackMicrophoneTrackCreated): void;
|
|
44
|
+
register(event: 'AudioTrackSubscribed', callback: CallbackAudioTrackSubscribed): void;
|
|
45
|
+
register(event: 'MicrophoneTrackDestroyed', callback: CallbackMicrophoneTrackDestroyed): void;
|
|
46
|
+
register(event: 'AudioTrackUnsubscribed', callback: CallbackAudioTrackUnsubscribed): void;
|
|
47
|
+
register(event: 'Start', callback: CallbackStart): void;
|
|
48
|
+
register(event: 'Stop', callback: CallbackStop): void;
|
|
49
|
+
unregister(event: 'AudioRawDataRecored', callback: CallbackRawDataRecorded): void;
|
|
50
|
+
unregister(event: 'AudioRawDataBeforeMixed', callback: CallbackRawDataBeforeMixed): void;
|
|
51
|
+
unregister(event: 'ObserverChanged', callback: CallbackObserverChanged): void;
|
|
52
|
+
unregister(event: 'MicrophoneTrackCreated', callback: CallbackMicrophoneTrackCreated): void;
|
|
53
|
+
unregister(event: 'AudioTrackSubscribed', callback: CallbackAudioTrackSubscribed): void;
|
|
54
|
+
unregister(event: 'MicrophoneTrackDestroyed', callback: CallbackMicrophoneTrackDestroyed): void;
|
|
55
|
+
unregister(event: 'AudioTrackUnsubscribed', callback: CallbackAudioTrackUnsubscribed): void;
|
|
56
|
+
unregister(event: 'Start', callback: CallbackStart): void;
|
|
57
|
+
unregister(event: 'Stop', callback: CallbackStop): void;
|
|
58
|
+
addAudioRawDataObserver(observer: AgoraRteAudioRawDataObserver, position: AgoraRteAudioRawDataPosition): void;
|
|
59
|
+
removeAudioRawDataObserver(observer: AgoraRteAudioRawDataObserver, position: AgoraRteAudioRawDataPosition): void;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.AGAudioRawDataDispatcher = void 0;
|
|
9
|
+
require("core-js/modules/es.array.iterator.js");
|
|
10
|
+
require("core-js/modules/es.object.to-string.js");
|
|
11
|
+
require("core-js/modules/es.set.js");
|
|
12
|
+
require("core-js/modules/es.string.iterator.js");
|
|
13
|
+
require("core-js/modules/esnext.set.add-all.js");
|
|
14
|
+
require("core-js/modules/esnext.set.delete-all.js");
|
|
15
|
+
require("core-js/modules/esnext.set.difference.js");
|
|
16
|
+
require("core-js/modules/esnext.set.every.js");
|
|
17
|
+
require("core-js/modules/esnext.set.filter.js");
|
|
18
|
+
require("core-js/modules/esnext.set.find.js");
|
|
19
|
+
require("core-js/modules/esnext.set.intersection.js");
|
|
20
|
+
require("core-js/modules/esnext.set.is-disjoint-from.js");
|
|
21
|
+
require("core-js/modules/esnext.set.is-subset-of.js");
|
|
22
|
+
require("core-js/modules/esnext.set.is-superset-of.js");
|
|
23
|
+
require("core-js/modules/esnext.set.join.js");
|
|
24
|
+
require("core-js/modules/esnext.set.map.js");
|
|
25
|
+
require("core-js/modules/esnext.set.reduce.js");
|
|
26
|
+
require("core-js/modules/esnext.set.some.js");
|
|
27
|
+
require("core-js/modules/esnext.set.symmetric-difference.js");
|
|
28
|
+
require("core-js/modules/esnext.set.union.js");
|
|
29
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
30
|
+
require("core-js/modules/es.array.for-each.js");
|
|
31
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
32
|
+
require("core-js/modules/es.array.concat.js");
|
|
33
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
34
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
35
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
36
|
+
var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime/helpers/applyDecoratedDescriptor"));
|
|
37
|
+
var _events = require("../../../utils/events");
|
|
38
|
+
var _decorator = require("../../../decorator");
|
|
39
|
+
var _type = require("../../../media/type");
|
|
40
|
+
var _dec, _dec2, _dec3, _dec4, _class, _class2, _class3;
|
|
41
|
+
var AGAudioRawDataDispatcher = (_dec = _decorator.Log.attach({
|
|
42
|
+
proxyMethods: false
|
|
43
|
+
}), _dec2 = _decorator.Log.trace, _dec3 = _decorator.Log.trace, _dec4 = _decorator.Log.trace, _dec(_class = (_class2 = (_class3 = /*#__PURE__*/function () {
|
|
44
|
+
function AGAudioRawDataDispatcher() {
|
|
45
|
+
(0, _classCallCheck2["default"])(this, AGAudioRawDataDispatcher);
|
|
46
|
+
this.logger = void 0;
|
|
47
|
+
this._microphoneTrackRawDataObservers = new Set();
|
|
48
|
+
this._audioTrackRawDataObservers = new Set();
|
|
49
|
+
this._eventBus = new _events.AGEventEmitter();
|
|
50
|
+
this._configs = {};
|
|
51
|
+
this._state = 0;
|
|
52
|
+
}
|
|
53
|
+
(0, _createClass2["default"])(AGAudioRawDataDispatcher, [{
|
|
54
|
+
key: "setConfig",
|
|
55
|
+
value: function setConfig(config, position) {
|
|
56
|
+
this._configs[position] = config;
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
key: "isStarted",
|
|
60
|
+
get: function get() {
|
|
61
|
+
return this._state === 1;
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
key: "microphoneTrackRawDataConfig",
|
|
65
|
+
get: function get() {
|
|
66
|
+
var _this$_configs$AgoraR;
|
|
67
|
+
return (_this$_configs$AgoraR = this._configs[_type.AgoraRteAudioRawDataPosition.record]) !== null && _this$_configs$AgoraR !== void 0 ? _this$_configs$AgoraR : {
|
|
68
|
+
frameSize: AGAudioRawDataDispatcher.DEFAULT_FRAME_SIZE
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}, {
|
|
72
|
+
key: "audioTrackRawDataConfig",
|
|
73
|
+
get: function get() {
|
|
74
|
+
var _this$_configs$AgoraR2;
|
|
75
|
+
return (_this$_configs$AgoraR2 = this._configs[_type.AgoraRteAudioRawDataPosition.beforeMixed]) !== null && _this$_configs$AgoraR2 !== void 0 ? _this$_configs$AgoraR2 : {
|
|
76
|
+
frameSize: AGAudioRawDataDispatcher.DEFAULT_FRAME_SIZE
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
key: "hasMicrophoneRawDataObservers",
|
|
81
|
+
get: function get() {
|
|
82
|
+
return !!this._microphoneTrackRawDataObservers.size;
|
|
83
|
+
}
|
|
84
|
+
}, {
|
|
85
|
+
key: "hasAudioTrackRawDataObservers",
|
|
86
|
+
get: function get() {
|
|
87
|
+
return !!this._audioTrackRawDataObservers.size;
|
|
88
|
+
}
|
|
89
|
+
}, {
|
|
90
|
+
key: "_callbackAudioRawRecorded",
|
|
91
|
+
value: function _callbackAudioRawRecorded(rawData) {
|
|
92
|
+
this._microphoneTrackRawDataObservers.forEach(function (observer) {
|
|
93
|
+
observer(rawData);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
key: "_callbackAudioRawBeforeMixed",
|
|
98
|
+
value: function _callbackAudioRawBeforeMixed(rawData, channelName, streamUuid) {
|
|
99
|
+
this._audioTrackRawDataObservers.forEach(function (observer) {
|
|
100
|
+
observer(rawData, channelName, streamUuid);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
key: "start",
|
|
105
|
+
value: function start() {
|
|
106
|
+
this._state = 1;
|
|
107
|
+
this.register('AudioRawDataBeforeMixed', this._callbackAudioRawBeforeMixed);
|
|
108
|
+
this.register('AudioRawDataRecored', this._callbackAudioRawRecorded);
|
|
109
|
+
this.dispatch('Start');
|
|
110
|
+
}
|
|
111
|
+
}, {
|
|
112
|
+
key: "stop",
|
|
113
|
+
value: function stop() {
|
|
114
|
+
this._state = 0;
|
|
115
|
+
this.unregister('AudioRawDataBeforeMixed', this._callbackAudioRawBeforeMixed);
|
|
116
|
+
this.unregister('AudioRawDataRecored', this._callbackAudioRawRecorded);
|
|
117
|
+
this.dispatch('Stop');
|
|
118
|
+
}
|
|
119
|
+
}, {
|
|
120
|
+
key: "dispatch",
|
|
121
|
+
value: function dispatch(event) {
|
|
122
|
+
if (this.isStarted) {
|
|
123
|
+
var _this$_eventBus;
|
|
124
|
+
for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
125
|
+
params[_key - 1] = arguments[_key];
|
|
126
|
+
}
|
|
127
|
+
this.logger.debug("event: ".concat(event, ", params:"), params);
|
|
128
|
+
(_this$_eventBus = this._eventBus).emit.apply(_this$_eventBus, [event].concat(params));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}, {
|
|
132
|
+
key: "register",
|
|
133
|
+
value: function register(event, callback) {
|
|
134
|
+
this._eventBus.on(event, callback);
|
|
135
|
+
}
|
|
136
|
+
}, {
|
|
137
|
+
key: "unregister",
|
|
138
|
+
value: function unregister(event, callback) {
|
|
139
|
+
this._eventBus.off(event, callback);
|
|
140
|
+
}
|
|
141
|
+
}, {
|
|
142
|
+
key: "addAudioRawDataObserver",
|
|
143
|
+
value: function addAudioRawDataObserver(observer, position) {
|
|
144
|
+
if (position === _type.AgoraRteAudioRawDataPosition.record) {
|
|
145
|
+
this._microphoneTrackRawDataObservers.add(observer.onAudioRawDataRecored);
|
|
146
|
+
}
|
|
147
|
+
if (position === _type.AgoraRteAudioRawDataPosition.beforeMixed) {
|
|
148
|
+
this._audioTrackRawDataObservers.add(observer.onAudioRawDataBeforeMixed);
|
|
149
|
+
}
|
|
150
|
+
this.dispatch('ObserverChanged', position);
|
|
151
|
+
}
|
|
152
|
+
}, {
|
|
153
|
+
key: "removeAudioRawDataObserver",
|
|
154
|
+
value: function removeAudioRawDataObserver(observer, position) {
|
|
155
|
+
if (position === _type.AgoraRteAudioRawDataPosition.record) {
|
|
156
|
+
this._microphoneTrackRawDataObservers["delete"](observer.onAudioRawDataRecored);
|
|
157
|
+
}
|
|
158
|
+
if (position === _type.AgoraRteAudioRawDataPosition.beforeMixed) {
|
|
159
|
+
this._audioTrackRawDataObservers["delete"](observer.onAudioRawDataBeforeMixed);
|
|
160
|
+
}
|
|
161
|
+
this.dispatch('ObserverChanged', position);
|
|
162
|
+
}
|
|
163
|
+
}]);
|
|
164
|
+
return AGAudioRawDataDispatcher;
|
|
165
|
+
}(), _class3.DEFAULT_FRAME_SIZE = 1024, _class3), ((0, _applyDecoratedDescriptor2["default"])(_class2.prototype, "setConfig", [_dec2], Object.getOwnPropertyDescriptor(_class2.prototype, "setConfig"), _class2.prototype), (0, _applyDecoratedDescriptor2["default"])(_class2.prototype, "_callbackAudioRawRecorded", [_decorator.bound], Object.getOwnPropertyDescriptor(_class2.prototype, "_callbackAudioRawRecorded"), _class2.prototype), (0, _applyDecoratedDescriptor2["default"])(_class2.prototype, "_callbackAudioRawBeforeMixed", [_decorator.bound], Object.getOwnPropertyDescriptor(_class2.prototype, "_callbackAudioRawBeforeMixed"), _class2.prototype), (0, _applyDecoratedDescriptor2["default"])(_class2.prototype, "start", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "start"), _class2.prototype), (0, _applyDecoratedDescriptor2["default"])(_class2.prototype, "stop", [_dec4], Object.getOwnPropertyDescriptor(_class2.prototype, "stop"), _class2.prototype)), _class2)) || _class);
|
|
166
|
+
exports.AGAudioRawDataDispatcher = AGAudioRawDataDispatcher;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { LocalVideoTrackStateEvent, LocalAudioTrackStateEvent, LocalAudioPlaybackVolumeIndicatorEvent } from '../base';
|
|
2
2
|
import { RtcAdapterBase, RtcAudioDeviceManagerBase, RtcChannelAdapterBase, RtcVideoDeviceManagerBase } from '../base';
|
|
3
|
-
import { AudienceLatencyLevelType,
|
|
3
|
+
import { AudienceLatencyLevelType, SDK_CODEC, SDK_MODE } from 'agora-rtc-sdk-ng';
|
|
4
4
|
import { AgoraRteCameraThread, AgoraRteMicrophoneThread, AgoraRteScreenShareThread } from './thread';
|
|
5
5
|
import { AgoraRtcVideoCanvas } from '../../canvas';
|
|
6
6
|
import { AgoraRteVideoSourceType } from '../../../media/track';
|
|
7
7
|
import { AgoraRteWebClientMain, AgoraRteWebClientSub } from './client';
|
|
8
8
|
import { AGRtcConnectionType } from '../../channel';
|
|
9
|
-
import { AGScreenShareDevice,
|
|
9
|
+
import { AGScreenShareDevice, AGNetworkStats, AGRtcState, AGLowStreamParameter, AGBeautyEffect, AGRemoteVideoStreamType } from '../../type';
|
|
10
10
|
import { AgoraLatencyLevel } from '../../../../configs';
|
|
11
11
|
import { AGChannelProfile } from '../../../../type';
|
|
12
12
|
import { IBaseProcessor } from 'agora-rte-extension';
|
|
13
13
|
import { Logger } from '../../../logger';
|
|
14
|
+
import { AGAudioRawDataDispatcher } from './dispatcher';
|
|
15
|
+
import { AgoraRteAudioRawDataConfig, AgoraRteAudioRawDataObserver, AgoraRteAudioRawDataPosition } from '../../../media/type';
|
|
14
16
|
export interface RtcAdapterWebConfig {
|
|
15
17
|
codec: SDK_CODEC;
|
|
16
18
|
mode: SDK_MODE;
|
|
@@ -21,11 +23,12 @@ export declare class RtcAdapterWeb extends RtcAdapterBase {
|
|
|
21
23
|
private _channels;
|
|
22
24
|
private _vdm;
|
|
23
25
|
private _adm;
|
|
26
|
+
private _audioRawDataDispatcher;
|
|
27
|
+
private _audioPlayer;
|
|
24
28
|
readonly cameraThread: AgoraRteCameraThread;
|
|
25
29
|
readonly micThread: AgoraRteMicrophoneThread;
|
|
26
30
|
readonly screenThread: AgoraRteScreenShareThread;
|
|
27
31
|
readonly remoteCanvas: Map<string, AgoraRtcVideoCanvas>;
|
|
28
|
-
private _audioPlayer;
|
|
29
32
|
static defaultConfigs: RtcAdapterWebConfig;
|
|
30
33
|
private _configs?;
|
|
31
34
|
get configs(): {
|
|
@@ -62,11 +65,12 @@ export declare class RtcAdapterWeb extends RtcAdapterBase {
|
|
|
62
65
|
onLocalAudioTrackStateChanged(cb: LocalAudioTrackStateEvent): number;
|
|
63
66
|
onLocalScreenShareTrackStateChanged(cb: LocalVideoTrackStateEvent): number;
|
|
64
67
|
onLocalAudioVolume(cb: (volume: number) => void): number;
|
|
65
|
-
onAudioFrame(cb: (buffer: ArrayBuffer) => void): number;
|
|
66
68
|
setBeautyEffectOptions(enable: boolean, options: AGBeautyEffect): number;
|
|
67
69
|
setAudioFrameCallback(): number;
|
|
68
70
|
stopAudioFrameCallback(): number;
|
|
69
|
-
|
|
71
|
+
addAudioRawDataObserver(observer: AgoraRteAudioRawDataObserver, position: AgoraRteAudioRawDataPosition): number;
|
|
72
|
+
removeAudioRawDataObserver(observer: AgoraRteAudioRawDataObserver, position: AgoraRteAudioRawDataPosition): number;
|
|
73
|
+
setAudioRawDataConfig(config: AgoraRteAudioRawDataConfig, position: AgoraRteAudioRawDataPosition): number;
|
|
70
74
|
hasScreenSharePermission(): boolean;
|
|
71
75
|
takeSnapshot(_channel: string, _streamUuid: number, _filePath: string): Promise<never>;
|
|
72
76
|
getCurrentFrameData(channelName: string, streamUuid: string, isLocal: boolean): ImageData;
|
|
@@ -83,7 +87,7 @@ export declare class RtcChannelAdapterWeb extends RtcChannelAdapterBase {
|
|
|
83
87
|
readonly main: AgoraRteWebClientMain;
|
|
84
88
|
readonly sub: AgoraRteWebClientSub;
|
|
85
89
|
channelName: string;
|
|
86
|
-
constructor(channelName: string, configs: RtcAdapterWebConfig, base: RtcAdapterBase);
|
|
90
|
+
constructor(channelName: string, configs: RtcAdapterWebConfig, base: RtcAdapterBase, audioRawDataDispatcher: AGAudioRawDataDispatcher);
|
|
87
91
|
getSessionId(): any;
|
|
88
92
|
private client;
|
|
89
93
|
setLatencyLevel(level: AgoraLatencyLevel): void;
|
|
@@ -92,7 +96,7 @@ export declare class RtcChannelAdapterWeb extends RtcChannelAdapterBase {
|
|
|
92
96
|
leave(connectionType?: AGRtcConnectionType): Promise<void>;
|
|
93
97
|
enableDualStream(enable: boolean, connectionType: AGRtcConnectionType): Promise<void>;
|
|
94
98
|
setLowStreamParameter(streamParameter: AGLowStreamParameter, connectionType: AGRtcConnectionType): number;
|
|
95
|
-
setRemoteVideoStreamType(streamUuid: string, streamType:
|
|
99
|
+
setRemoteVideoStreamType(streamUuid: string, streamType: AGRemoteVideoStreamType, connectionType: AGRtcConnectionType): Promise<void>;
|
|
96
100
|
muteLocalVideo(mute: boolean, connectionType: AGRtcConnectionType): number;
|
|
97
101
|
muteLocalAudio(mute: boolean, connectionType: AGRtcConnectionType): number;
|
|
98
102
|
muteLocalScreenShare(mute: boolean, connectionType: AGRtcConnectionType): number;
|