agora-rte-sdk 3.7.1 → 3.7.3
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/constant.d.ts +2 -1
- package/lib/constant.js +1 -0
- package/lib/core/processor/message-handler.d.ts +4 -4
- package/lib/core/processor/message-handler.js +63 -44
- package/lib/core/processor/sequence-msg/data.d.ts +2 -2
- package/lib/core/processor/sequence-msg/data.js +49 -1
- package/lib/core/processor/sequence-msg/synchronizer.d.ts +1 -1
- package/lib/core/processor/sequence-msg/synchronizer.js +6 -4
- package/lib/core/processor/struct.d.ts +22 -15
- package/lib/core/processor/struct.js +97 -11
- package/lib/core/processor/type.d.ts +4 -4
- package/lib/core/scene/index.d.ts +1 -2
- package/lib/core/scene/index.js +94 -103
- package/lib/core/scene/local-user.js +18 -15
- package/lib/core/scene/type.d.ts +13 -18
- package/lib/core/scene/type.js +1 -46
- package/lib/core/services/api.d.ts +3 -1
- package/lib/core/services/api.js +10 -8
- package/lib/core/utilities/diff.d.ts +7 -0
- package/lib/core/utilities/diff.js +107 -0
- package/lib/core/utilities/logger.d.ts +0 -1
- package/lib/core/utilities/logger.js +5 -5
- package/lib/core/utilities/parameters.d.ts +1 -0
- package/lib/core/utilities/parameters.js +5 -1
- package/lib/index.d.ts +2 -2
- package/lib/plugin/rtc/electron/capture-enhancement.js +1 -1
- package/lib/plugin/rtc/electron/client.d.ts +3 -0
- package/lib/plugin/rtc/electron/client.js +145 -73
- package/lib/plugin/rtc/electron/index.js +2 -2
- package/lib/plugin/rtc/electron/publish-pool.js +1 -1
- package/lib/plugin/rtc/electron/publisher.js +0 -4
- package/lib/plugin/rtc/electron/source-manager.d.ts +7 -1
- package/lib/plugin/rtc/electron/source-manager.js +157 -76
- package/lib/plugin/rtc/web/audio-player.js +2 -1
- package/lib/plugin/rtc/web/channel.js +1 -1
- package/lib/plugin/rtc/web/client.js +14 -18
- package/lib/plugin/rtc/web/track-control/camera.js +10 -2
- package/lib/plugin/rtc/web/track-control/microphone.js +10 -2
- package/lib/plugin/rtc/web/track-control/screen.js +6 -2
- package/package.json +3 -3
package/lib/constant.d.ts
CHANGED
package/lib/constant.js
CHANGED
|
@@ -36,5 +36,6 @@ var AgoraRtcErrorCode = exports.AgoraRtcErrorCode = /*#__PURE__*/function (Agora
|
|
|
36
36
|
AgoraRtcErrorCode[AgoraRtcErrorCode["UNKNOWN_RENDER_TYPE"] = 22] = "UNKNOWN_RENDER_TYPE";
|
|
37
37
|
AgoraRtcErrorCode[AgoraRtcErrorCode["INVALID_ARGUMENT"] = 23] = "INVALID_ARGUMENT";
|
|
38
38
|
AgoraRtcErrorCode[AgoraRtcErrorCode["UNSUPPORT_SCENARIO_TYPE"] = 24] = "UNSUPPORT_SCENARIO_TYPE";
|
|
39
|
+
AgoraRtcErrorCode[AgoraRtcErrorCode["CANNOT_SET_SPEAKER_TO_AGORA_ALD"] = 25] = "CANNOT_SET_SPEAKER_TO_AGORA_ALD";
|
|
39
40
|
return AgoraRtcErrorCode;
|
|
40
41
|
}({});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AgoraObservable } from '../../imports';
|
|
2
2
|
import { AgoraRteSyncDataStore } from './sequence-msg/data';
|
|
3
3
|
import { AgoraRteSequenceMessage, AgoraRteMessageHandlerObserver, AgoraRteSequenceMessageInUser, AgoraRteSequenceMessageOutUser } from './type';
|
|
4
|
-
import {
|
|
4
|
+
import { AgoraRteSyncSnapshotData } from './struct';
|
|
5
5
|
import { AgoraRteServiceApi } from '../services/api';
|
|
6
6
|
import { AgoraRtmClient } from '../rtm';
|
|
7
7
|
import { AgoraRtmChannelClient } from '../rtm/channel';
|
|
8
|
-
import { AgoraRteUserInfo } from '../scene/type';
|
|
8
|
+
import { AgoraRteMediaStreamInfo, AgoraRteUserInfo } from '../scene/type';
|
|
9
9
|
export declare class AgoraRteMessageHandle {
|
|
10
10
|
protected readonly logger: import("agora-foundation/lib/logger/type").Logger;
|
|
11
11
|
protected readonly observable: AgoraObservable<Partial<{
|
|
@@ -26,8 +26,8 @@ export declare class AgoraRteMessageHandle {
|
|
|
26
26
|
onUserUpdated: (user: AgoraRteUserInfo, operator?: AgoraRteUserInfo, cause?: import("./type").AgoraRteOperatCause) => void;
|
|
27
27
|
onRemoteUsersRemoved: (removedUsers: AgoraRteSequenceMessageOutUser[], removedStreamsData: AgoraRteMediaStreamInfo[]) => void;
|
|
28
28
|
onLocalUserRemoved: (user: AgoraRteSequenceMessageOutUser) => void;
|
|
29
|
-
onLocalUserAdded: (user: AgoraRteSequenceMessageInUser) => void;
|
|
30
|
-
onUserSubscribe: (subscribeUsers: AgoraRteUserInfo[], operator: AgoraRteUserInfo, cause?: import("./type").AgoraRteOperatCause) => void;
|
|
29
|
+
onLocalUserAdded: (user: AgoraRteSequenceMessageInUser, addedStreamsData: AgoraRteMediaStreamInfo[], removedStreamsData: AgoraRteMediaStreamInfo[]) => void;
|
|
30
|
+
onUserSubscribe: (subscribeUsers: AgoraRteUserInfo[], addedStreamsData: AgoraRteMediaStreamInfo[], operator: AgoraRteUserInfo, cause?: import("./type").AgoraRteOperatCause) => void;
|
|
31
31
|
onUserUnsubscribe: (unsubscribeUsers: AgoraRteUserInfo[], removedStreamsData: AgoraRteMediaStreamInfo[], operator: AgoraRteUserInfo, cause?: import("./type").AgoraRteOperatCause) => void;
|
|
32
32
|
onUserCountUpdated: (total: number) => void;
|
|
33
33
|
onUserPropertyUpdated: (userUuid: string, userProperties: Record<string, unknown>, operator: AgoraRteUserInfo, cause?: import("./type").AgoraRteOperatCause) => void;
|
|
@@ -95,10 +95,10 @@ var _type = require("./type");
|
|
|
95
95
|
var _struct = require("./struct");
|
|
96
96
|
var _synchronizer = require("./sequence-msg/synchronizer");
|
|
97
97
|
var _messageParser = require("./sequence-msg/message-parser");
|
|
98
|
-
var _type2 = require("../
|
|
99
|
-
var _type3 = require("../rtm/type");
|
|
98
|
+
var _type2 = require("../rtm/type");
|
|
100
99
|
var _clone = require("../utilities/clone");
|
|
101
100
|
var _logger = require("../utilities/logger");
|
|
101
|
+
var _diff = require("../utilities/diff");
|
|
102
102
|
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; } } }; }
|
|
103
103
|
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; } }
|
|
104
104
|
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; }
|
|
@@ -110,10 +110,12 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
110
110
|
apiService = _ref.apiService,
|
|
111
111
|
rtmClient = _ref.rtmClient;
|
|
112
112
|
(0, _classCallCheck2["default"])(this, AgoraRteMessageHandle);
|
|
113
|
-
(0, _defineProperty2["default"])(this, "logger", (0, _logger.
|
|
113
|
+
(0, _defineProperty2["default"])(this, "logger", (0, _logger.createLogger)({
|
|
114
|
+
prefix: 'AgoraRteMessageHandle'
|
|
115
|
+
}));
|
|
114
116
|
(0, _defineProperty2["default"])(this, "observable", new _imports.AgoraObservable());
|
|
115
117
|
(0, _defineProperty2["default"])(this, "_timestampGap", 0);
|
|
116
|
-
(0, _defineProperty2["default"])(this, "_rtmConnectionState",
|
|
118
|
+
(0, _defineProperty2["default"])(this, "_rtmConnectionState", _type2.AgoraRtmConnectionState.DISCONNECTED);
|
|
117
119
|
this._onSeqMessage = this._onSeqMessage.bind(this);
|
|
118
120
|
this.handleSeqMessage = this.handleSeqMessage.bind(this);
|
|
119
121
|
this._handleUserSubscribe = this._handleUserSubscribe.bind(this);
|
|
@@ -136,6 +138,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
136
138
|
});
|
|
137
139
|
this._addMessageEventListeners();
|
|
138
140
|
this._addConnectionEventListeners();
|
|
141
|
+
this.logger.info('initialized, sceneId:', this.sceneId);
|
|
139
142
|
}
|
|
140
143
|
return (0, _createClass2["default"])(AgoraRteMessageHandle, [{
|
|
141
144
|
key: "setUserId",
|
|
@@ -172,9 +175,9 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
172
175
|
}, {
|
|
173
176
|
key: "_onConnectionStateUpdated",
|
|
174
177
|
value: function _onConnectionStateUpdated(state) {
|
|
175
|
-
if ((this._rtmConnectionState ===
|
|
178
|
+
if ((this._rtmConnectionState === _type2.AgoraRtmConnectionState.RECONNECTING || this._rtmConnectionState === _type2.AgoraRtmConnectionState.CONNECTING) && state === _type2.AgoraRtmConnectionState.CONNECTED) {
|
|
176
179
|
var syncCount = 100;
|
|
177
|
-
this.logger.info("
|
|
180
|
+
this.logger.info("RTM connection state updated to connected, start sync sequence for last ".concat(syncCount));
|
|
178
181
|
this._channelMessageSynchronizer.syncSequence(syncCount);
|
|
179
182
|
this._peerMessageSynchronizer.syncSequence(syncCount);
|
|
180
183
|
}
|
|
@@ -213,7 +216,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
213
216
|
var packet = seqMessageParser.parsePacket(message);
|
|
214
217
|
_this._handleSequenceMessagePacket(packet, _this._channelMessageSynchronizer);
|
|
215
218
|
} catch (e) {
|
|
216
|
-
_this.logger.error("
|
|
219
|
+
_this.logger.error("".concat(e.message, " original: ").concat(message));
|
|
217
220
|
}
|
|
218
221
|
}
|
|
219
222
|
}
|
|
@@ -222,7 +225,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
222
225
|
}, {
|
|
223
226
|
key: "handleSnapshot",
|
|
224
227
|
value: function handleSnapshot(snapshot) {
|
|
225
|
-
this.logger.info(
|
|
228
|
+
this.logger.info("snapshot loaded: ".concat(snapshot));
|
|
226
229
|
this._dataStore.setUsers(snapshot.users);
|
|
227
230
|
this._dataStore.setStreams(snapshot.streams);
|
|
228
231
|
this._dataStore.setRoomProperties(snapshot.roomProperties);
|
|
@@ -235,7 +238,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
235
238
|
var _this2 = this;
|
|
236
239
|
var tasks = packet.list;
|
|
237
240
|
if (packet.startSequence) {
|
|
238
|
-
this.logger.info("
|
|
241
|
+
this.logger.info("add ".concat(packet.total, " tasks to ").concat(messageSynchronizer.sequenceTypeLabel, " queue, start: ").concat(packet.startSequence, ", total: ").concat(packet.total));
|
|
239
242
|
messageSynchronizer.addTasks(tasks);
|
|
240
243
|
} else {
|
|
241
244
|
tasks.forEach(function (task) {
|
|
@@ -256,7 +259,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
256
259
|
this._handleSequenceMessagePacket(packet, this._peerMessageSynchronizer);
|
|
257
260
|
}
|
|
258
261
|
} catch (e) {
|
|
259
|
-
this.logger.error("
|
|
262
|
+
this.logger.error("".concat(e.message, " original: ").concat(message));
|
|
260
263
|
}
|
|
261
264
|
}
|
|
262
265
|
}
|
|
@@ -314,7 +317,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
314
317
|
this._handleCustomMessage(task);
|
|
315
318
|
break;
|
|
316
319
|
default:
|
|
317
|
-
this.logger.warn("
|
|
320
|
+
this.logger.warn("unknown message cmd: ".concat(cmd, ", data: ").concat(JSON.stringify(task)));
|
|
318
321
|
}
|
|
319
322
|
}
|
|
320
323
|
}, {
|
|
@@ -345,7 +348,8 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
345
348
|
var userUuid = fromUser.userUuid;
|
|
346
349
|
var user = _this3._dataStore.findUser(userUuid);
|
|
347
350
|
if (!user) {
|
|
348
|
-
|
|
351
|
+
_this3.logger.warn("user ".concat(userUuid, " not exists, update property failed"));
|
|
352
|
+
return;
|
|
349
353
|
}
|
|
350
354
|
var mergedProperties = _this3._mergeProperties((_user$userProperties = user.userProperties) !== null && _user$userProperties !== void 0 ? _user$userProperties : {}, changeProperties);
|
|
351
355
|
user.setUserProperties(mergedProperties);
|
|
@@ -356,7 +360,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
356
360
|
});
|
|
357
361
|
this.observable.notifyObservers('onUserPropertyListUpdated', changedProperties,
|
|
358
362
|
// FIXME: get real connector
|
|
359
|
-
|
|
363
|
+
_struct.AgoraRteUser.fromSeqData(_objectSpread({}, operator)), cause);
|
|
360
364
|
}
|
|
361
365
|
}, {
|
|
362
366
|
key: "_mergeProperties",
|
|
@@ -366,7 +370,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
366
370
|
var key = _Object$keys[_i];
|
|
367
371
|
var originalPaths = key.split('.');
|
|
368
372
|
if (originalPaths.length === 0) {
|
|
369
|
-
this.logger.error("
|
|
373
|
+
this.logger.error("invalid key when batch set room properties ".concat(key));
|
|
370
374
|
continue;
|
|
371
375
|
}
|
|
372
376
|
var paths = originalPaths.filter(function (path) {
|
|
@@ -417,11 +421,11 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
417
421
|
if (action === _type.AgoraRteSequenceMessagePropertiesAction.UPSERT) {
|
|
418
422
|
this.observable.notifyObservers('onRoomPropertyUpdated', changeProperties, changedKeys,
|
|
419
423
|
// FIXME: get real connector
|
|
420
|
-
|
|
424
|
+
_struct.AgoraRteUser.fromSeqData(_objectSpread({}, operator)), cause);
|
|
421
425
|
} else {
|
|
422
426
|
this.observable.notifyObservers('onRoomPropertyDeleted', changedKeys,
|
|
423
427
|
// FIXME: get real connector
|
|
424
|
-
|
|
428
|
+
_struct.AgoraRteUser.fromSeqData(_objectSpread({}, operator)), cause);
|
|
425
429
|
}
|
|
426
430
|
|
|
427
431
|
//
|
|
@@ -437,6 +441,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
437
441
|
cause = data.cause;
|
|
438
442
|
var subscribeUsersData = [];
|
|
439
443
|
var unsubscribeUsersData = [];
|
|
444
|
+
var addedStreamsData = [];
|
|
440
445
|
var removedStreamsData = [];
|
|
441
446
|
users.forEach(function (u) {
|
|
442
447
|
var user;
|
|
@@ -444,7 +449,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
444
449
|
user = _this4._dataStore.findUser(_this4.userId);
|
|
445
450
|
user.userRole = u.role;
|
|
446
451
|
} else {
|
|
447
|
-
user =
|
|
452
|
+
user = _struct.AgoraRteUser.fromSeqData(u);
|
|
448
453
|
}
|
|
449
454
|
if (u.subscribe === _type.AgoraRteSequenceMessageSubscribeUserState.SUBSCRIBE) {
|
|
450
455
|
_this4._dataStore.setUser(user.userId, user);
|
|
@@ -452,6 +457,9 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
452
457
|
streams = _u$streams === void 0 ? [] : _u$streams;
|
|
453
458
|
streams.forEach(function (streamData) {
|
|
454
459
|
var stream = _struct.AgoraRteMediaStream.fromData(streamData, user);
|
|
460
|
+
if (!_this4._dataStore.findStream(stream.streamId)) {
|
|
461
|
+
addedStreamsData.push(stream);
|
|
462
|
+
}
|
|
455
463
|
_this4._dataStore.setStream(stream.streamId, stream);
|
|
456
464
|
});
|
|
457
465
|
subscribeUsersData.push(user);
|
|
@@ -463,7 +471,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
463
471
|
_this4._dataStore.deleteStreams(streamUuids);
|
|
464
472
|
if (_this4.userId !== u.userUuid) {
|
|
465
473
|
_this4._dataStore.deleteUser(u.userUuid);
|
|
466
|
-
_this4.logger.info("
|
|
474
|
+
_this4.logger.info("unsubscribe remote user, delete user and streams from data store, userUuid: ".concat(u.userUuid, ", streams: ").concat(streamUuids.join(',')));
|
|
467
475
|
} else {
|
|
468
476
|
_this4.logger.info('unsubscribe local user');
|
|
469
477
|
}
|
|
@@ -474,14 +482,14 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
474
482
|
}
|
|
475
483
|
});
|
|
476
484
|
if (subscribeUsersData.length > 0) {
|
|
477
|
-
this.observable.notifyObservers('onUserSubscribe', subscribeUsersData,
|
|
485
|
+
this.observable.notifyObservers('onUserSubscribe', subscribeUsersData, addedStreamsData,
|
|
478
486
|
// FIXME: get real connector
|
|
479
|
-
|
|
487
|
+
_struct.AgoraRteUser.fromSeqData(_objectSpread({}, operator)), cause);
|
|
480
488
|
}
|
|
481
489
|
if (unsubscribeUsersData.length > 0) {
|
|
482
490
|
this.observable.notifyObservers('onUserUnsubscribe', unsubscribeUsersData, removedStreamsData,
|
|
483
491
|
// FIXME: get real connector
|
|
484
|
-
|
|
492
|
+
_struct.AgoraRteUser.fromSeqData(_objectSpread({}, operator)), cause);
|
|
485
493
|
}
|
|
486
494
|
}
|
|
487
495
|
}, {
|
|
@@ -551,7 +559,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
551
559
|
// 处理上线用户
|
|
552
560
|
remoteUsers.online.forEach(function (userData) {
|
|
553
561
|
try {
|
|
554
|
-
var user =
|
|
562
|
+
var user = _struct.AgoraRteUser.fromSeqData(userData);
|
|
555
563
|
_this6._dataStore.setUser(user.userId, user);
|
|
556
564
|
|
|
557
565
|
// 处理用户流
|
|
@@ -568,7 +576,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
568
576
|
});
|
|
569
577
|
addedUsers.push(userData);
|
|
570
578
|
} catch (error) {
|
|
571
|
-
_this6.logger.error("
|
|
579
|
+
_this6.logger.error("failed to process online remote user: ".concat(userData.userUuid), error);
|
|
572
580
|
}
|
|
573
581
|
});
|
|
574
582
|
|
|
@@ -585,9 +593,9 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
585
593
|
removedStreams.push.apply(removedStreams, (0, _toConsumableArray2["default"])(streams));
|
|
586
594
|
}
|
|
587
595
|
removedUsers.push(userData);
|
|
588
|
-
_this6.logger.info("
|
|
596
|
+
_this6.logger.info("removed remote user and streams, userUuid: ".concat(userData.userUuid, ", streams: ").concat(streamUuids.join(',')));
|
|
589
597
|
} catch (error) {
|
|
590
|
-
_this6.logger.error("
|
|
598
|
+
_this6.logger.error("Failed to process offline remote user: ".concat(userData.userUuid), error);
|
|
591
599
|
}
|
|
592
600
|
});
|
|
593
601
|
this._notifyRemoteUserChanges(addedUsers, removedUsers, removedStreams);
|
|
@@ -599,15 +607,26 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
599
607
|
}, {
|
|
600
608
|
key: "_processLocalUsers",
|
|
601
609
|
value: function _processLocalUsers(localUsers) {
|
|
610
|
+
var _this7 = this;
|
|
602
611
|
// 处理本地用户上线 - 查找当前用户的上线信息
|
|
603
612
|
var currentUserOnline = this._findCurrentUserInList(localUsers.online);
|
|
604
613
|
if (currentUserOnline) {
|
|
605
|
-
var
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
this.
|
|
614
|
+
var localStreams = this._dataStore.findUserStreams(this.userId);
|
|
615
|
+
var localUserInfo = this._dataStore.findUser(this.userId);
|
|
616
|
+
if (!localUserInfo) {
|
|
617
|
+
this.logger.error("local user info not found for userId: ".concat(this.userId));
|
|
618
|
+
return;
|
|
609
619
|
}
|
|
610
|
-
|
|
620
|
+
var _diffStreams = (0, _diff.diffStreams)(currentUserOnline.streams || [], localStreams, localUserInfo),
|
|
621
|
+
addedStreams = _diffStreams.addedStreams,
|
|
622
|
+
removedStreams = _diffStreams.removedStreams;
|
|
623
|
+
removedStreams.forEach(function (stream) {
|
|
624
|
+
_this7.dataStore.deleteStream(stream.streamId);
|
|
625
|
+
});
|
|
626
|
+
addedStreams.forEach(function (stream) {
|
|
627
|
+
_this7.dataStore.setStream(stream.streamId, stream);
|
|
628
|
+
});
|
|
629
|
+
this.observable.notifyObservers('onLocalUserAdded', currentUserOnline, addedStreams, removedStreams);
|
|
611
630
|
}
|
|
612
631
|
|
|
613
632
|
// 处理本地用户下线 - 查找当前用户的下线信息
|
|
@@ -623,12 +642,12 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
623
642
|
}, {
|
|
624
643
|
key: "_findCurrentUserInList",
|
|
625
644
|
value: function _findCurrentUserInList(userList) {
|
|
626
|
-
var
|
|
645
|
+
var _this8 = this;
|
|
627
646
|
if (!this.userId || userList.length === 0) {
|
|
628
647
|
return undefined;
|
|
629
648
|
}
|
|
630
649
|
return userList.find(function (user) {
|
|
631
|
-
return user.userUuid ===
|
|
650
|
+
return user.userUuid === _this8.userId;
|
|
632
651
|
});
|
|
633
652
|
}
|
|
634
653
|
|
|
@@ -657,12 +676,12 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
657
676
|
operator = data.operator;
|
|
658
677
|
var user = this._dataStore.findUser(userUuid);
|
|
659
678
|
if (!user) {
|
|
660
|
-
return this.logger.warn("
|
|
679
|
+
return this.logger.warn("user ".concat(userUuid, " not exists, update info failed"));
|
|
661
680
|
}
|
|
662
681
|
user.userName = userName;
|
|
663
682
|
this.observable.notifyObservers('onUserUpdated', user,
|
|
664
683
|
// FIXME: get real connector
|
|
665
|
-
|
|
684
|
+
_struct.AgoraRteUser.fromSeqData(_objectSpread({}, operator)));
|
|
666
685
|
}
|
|
667
686
|
}, {
|
|
668
687
|
key: "_handleUserProperty",
|
|
@@ -682,21 +701,21 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
682
701
|
var userUuid = fromUser.userUuid;
|
|
683
702
|
var user = this._dataStore.findUser(userUuid);
|
|
684
703
|
if (!user) {
|
|
685
|
-
return this.logger.warn("
|
|
704
|
+
return this.logger.warn("user ".concat(userUuid, " not exists, update property failed"));
|
|
686
705
|
}
|
|
687
706
|
var mergedProperties = this._mergeProperties((_user$userProperties2 = user.userProperties) !== null && _user$userProperties2 !== void 0 ? _user$userProperties2 : {}, changeProperties);
|
|
688
707
|
user.setUserProperties(mergedProperties);
|
|
689
708
|
if (action === _type.AgoraRteSequenceMessagePropertiesAction.UPSERT) {
|
|
690
709
|
this.observable.notifyObservers('onUserPropertyUpdated', userUuid, changeProperties,
|
|
691
710
|
// FIXME: get real connector
|
|
692
|
-
|
|
711
|
+
_struct.AgoraRteUser.fromSeqData(_objectSpread({}, operator)), cause);
|
|
693
712
|
} else {
|
|
694
713
|
var changedKeys = Array.from(new Set(Object.keys(changeProperties).map(function (k) {
|
|
695
714
|
return k.split('.')[0];
|
|
696
715
|
})));
|
|
697
716
|
this.observable.notifyObservers('onUserPropertyDeleted', userUuid, changedKeys,
|
|
698
717
|
// FIXME: get real connector
|
|
699
|
-
|
|
718
|
+
_struct.AgoraRteUser.fromSeqData(_objectSpread({}, operator)), cause);
|
|
700
719
|
}
|
|
701
720
|
}
|
|
702
721
|
}, {
|
|
@@ -723,17 +742,17 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
723
742
|
cause = data.cause;
|
|
724
743
|
var user = this._dataStore.findUser(data.fromUser.userUuid);
|
|
725
744
|
if (!user) {
|
|
726
|
-
this.logger.warn("
|
|
745
|
+
this.logger.warn("user not found when handle stream inout, userId: ".concat(data.fromUser.userUuid));
|
|
727
746
|
return;
|
|
728
747
|
}
|
|
729
748
|
var stream = _struct.AgoraRteMediaStream.fromData(data, user);
|
|
730
749
|
var eventType = this._processStreamEvent(action, stream);
|
|
731
|
-
this.observable.notifyObservers(eventType, [stream], operator &&
|
|
750
|
+
this.observable.notifyObservers(eventType, [stream], operator && _struct.AgoraRteUser.fromSeqData(_objectSpread({}, operator)), cause);
|
|
732
751
|
}
|
|
733
752
|
}, {
|
|
734
753
|
key: "_handleStreamsInOut",
|
|
735
754
|
value: function _handleStreamsInOut(task) {
|
|
736
|
-
var
|
|
755
|
+
var _this9 = this;
|
|
737
756
|
var data = task.data;
|
|
738
757
|
var streams = data.streams,
|
|
739
758
|
operator = data.operator,
|
|
@@ -742,13 +761,13 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
742
761
|
streams.forEach(function (streamData) {
|
|
743
762
|
var action = streamData.action,
|
|
744
763
|
fromUser = streamData.fromUser;
|
|
745
|
-
var user =
|
|
764
|
+
var user = _this9._dataStore.findUser(fromUser.userUuid);
|
|
746
765
|
if (!user) {
|
|
747
|
-
|
|
766
|
+
_this9.logger.warn("user not found when handle streams inout, userId: ".concat(fromUser.userUuid));
|
|
748
767
|
return;
|
|
749
768
|
}
|
|
750
769
|
var stream = _struct.AgoraRteMediaStream.fromData(streamData, user);
|
|
751
|
-
var eventType =
|
|
770
|
+
var eventType = _this9._processStreamEvent(action, stream);
|
|
752
771
|
if (!eventMap.has(eventType)) {
|
|
753
772
|
eventMap.set(eventType, [stream]);
|
|
754
773
|
} else {
|
|
@@ -756,7 +775,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
756
775
|
}
|
|
757
776
|
});
|
|
758
777
|
eventMap.forEach(function (value, key) {
|
|
759
|
-
|
|
778
|
+
_this9.observable.notifyObservers(key, value, operator && _struct.AgoraRteUser.fromSeqData(_objectSpread({}, operator)), cause);
|
|
760
779
|
});
|
|
761
780
|
}
|
|
762
781
|
}, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AgoraRteUser } from '
|
|
2
|
-
import { AgoraRteMediaStream } from '../struct';
|
|
1
|
+
import { AgoraRteMediaStream, AgoraRteUser } from '../struct';
|
|
3
2
|
import { Immutable } from '../../../imports';
|
|
4
3
|
export declare class AgoraRteSyncDataStore {
|
|
4
|
+
protected logger: import("agora-foundation/lib/logger/type").Logger;
|
|
5
5
|
private _userCount;
|
|
6
6
|
private _users;
|
|
7
7
|
private _streams;
|
|
@@ -1,7 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol.js");
|
|
4
|
+
require("core-js/modules/es.symbol.description.js");
|
|
5
|
+
require("core-js/modules/es.symbol.to-primitive.js");
|
|
6
|
+
require("core-js/modules/es.error.cause.js");
|
|
7
|
+
require("core-js/modules/es.error.to-string.js");
|
|
8
|
+
require("core-js/modules/es.array.is-array.js");
|
|
9
|
+
require("core-js/modules/es.array.push.js");
|
|
10
|
+
require("core-js/modules/es.date.to-primitive.js");
|
|
11
|
+
require("core-js/modules/es.function.bind.js");
|
|
12
|
+
require("core-js/modules/es.function.name.js");
|
|
13
|
+
require("core-js/modules/es.map.js");
|
|
14
|
+
require("core-js/modules/es.number.constructor.js");
|
|
15
|
+
require("core-js/modules/es.object.create.js");
|
|
3
16
|
require("core-js/modules/es.object.define-property.js");
|
|
17
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
18
|
+
require("core-js/modules/esnext.function.metadata.js");
|
|
19
|
+
require("core-js/modules/esnext.map.delete-all.js");
|
|
20
|
+
require("core-js/modules/esnext.map.emplace.js");
|
|
21
|
+
require("core-js/modules/esnext.map.every.js");
|
|
22
|
+
require("core-js/modules/esnext.map.filter.js");
|
|
23
|
+
require("core-js/modules/esnext.map.find.js");
|
|
24
|
+
require("core-js/modules/esnext.map.find-key.js");
|
|
25
|
+
require("core-js/modules/esnext.map.includes.js");
|
|
26
|
+
require("core-js/modules/esnext.map.key-of.js");
|
|
27
|
+
require("core-js/modules/esnext.map.map-keys.js");
|
|
28
|
+
require("core-js/modules/esnext.map.map-values.js");
|
|
29
|
+
require("core-js/modules/esnext.map.merge.js");
|
|
30
|
+
require("core-js/modules/esnext.map.reduce.js");
|
|
31
|
+
require("core-js/modules/esnext.map.some.js");
|
|
32
|
+
require("core-js/modules/esnext.map.update.js");
|
|
33
|
+
require("core-js/modules/esnext.symbol.metadata.js");
|
|
4
34
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
35
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
36
|
Object.defineProperty(exports, "__esModule", {
|
|
6
37
|
value: true
|
|
7
38
|
});
|
|
@@ -14,13 +45,25 @@ require("core-js/modules/es.string.iterator.js");
|
|
|
14
45
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
15
46
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
16
47
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
48
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
49
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
18
50
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
51
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
20
52
|
var _imports = require("../../../imports");
|
|
53
|
+
var _logger = require("../../utilities/logger");
|
|
54
|
+
var _AgoraRteSyncDataStore;
|
|
55
|
+
var _initProto;
|
|
56
|
+
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)]; } }; }
|
|
57
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
58
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
59
|
+
function _setFunctionName(e, t, n) { "symbol" == _typeof(t) && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
|
|
60
|
+
function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? _typeof(e) : "null")); return e; }
|
|
21
61
|
var AgoraRteSyncDataStore = exports.AgoraRteSyncDataStore = /*#__PURE__*/function () {
|
|
22
62
|
function AgoraRteSyncDataStore() {
|
|
23
63
|
(0, _classCallCheck2["default"])(this, AgoraRteSyncDataStore);
|
|
64
|
+
(0, _defineProperty2["default"])(this, "logger", (_initProto(this), (0, _logger.createLogger)({
|
|
65
|
+
prefix: 'AgoraRteSyncDataStore'
|
|
66
|
+
})));
|
|
24
67
|
(0, _defineProperty2["default"])(this, "_userCount", 0);
|
|
25
68
|
(0, _defineProperty2["default"])(this, "_users", _imports.Immutable.Map());
|
|
26
69
|
(0, _defineProperty2["default"])(this, "_streams", _imports.Immutable.Map());
|
|
@@ -109,4 +152,9 @@ var AgoraRteSyncDataStore = exports.AgoraRteSyncDataStore = /*#__PURE__*/functio
|
|
|
109
152
|
this._userCount = userCount;
|
|
110
153
|
}
|
|
111
154
|
}]);
|
|
112
|
-
}();
|
|
155
|
+
}();
|
|
156
|
+
_AgoraRteSyncDataStore = AgoraRteSyncDataStore;
|
|
157
|
+
var _applyDecs$e = _applyDecs(_AgoraRteSyncDataStore, [[_imports.trace, 2, "setUsers"], [_imports.trace, 2, "setUser"], [_imports.trace, 2, "deleteUser"], [_imports.trace, 2, "setStreams"], [_imports.trace, 2, "setStream"], [_imports.trace, 2, "deleteStream"], [_imports.trace, 2, "deleteStreams"]], []).e;
|
|
158
|
+
var _applyDecs$e2 = (0, _slicedToArray2["default"])(_applyDecs$e, 1);
|
|
159
|
+
_initProto = _applyDecs$e2[0];
|
|
160
|
+
_applyDecs$e;
|
|
@@ -4,7 +4,7 @@ import { AgoraRteServiceApi } from '../../services/api';
|
|
|
4
4
|
import { Logger, AgoraObservable } from '../../../imports';
|
|
5
5
|
export declare class AgoraRteSynchronizer {
|
|
6
6
|
protected logger: Logger;
|
|
7
|
-
protected
|
|
7
|
+
protected observable: AgoraObservable<AgoraRteSynchronizerObserver>;
|
|
8
8
|
private _apiService;
|
|
9
9
|
private _userId?;
|
|
10
10
|
private _sceneId;
|
|
@@ -32,7 +32,9 @@ var AgoraRteSynchronizer = exports.AgoraRteSynchronizer = /*#__PURE__*/function
|
|
|
32
32
|
sceneId = _ref.sceneId,
|
|
33
33
|
sequenceType = _ref.sequenceType;
|
|
34
34
|
(0, _classCallCheck2["default"])(this, AgoraRteSynchronizer);
|
|
35
|
-
(0, _defineProperty2["default"])(this, "logger", (0, _logger.
|
|
35
|
+
(0, _defineProperty2["default"])(this, "logger", (0, _logger.createLogger)({
|
|
36
|
+
prefix: 'AgoraRteSynchronizer'
|
|
37
|
+
}));
|
|
36
38
|
(0, _defineProperty2["default"])(this, "observable", new _imports.AgoraObservable());
|
|
37
39
|
(0, _defineProperty2["default"])(this, "_queueTasks", []);
|
|
38
40
|
(0, _defineProperty2["default"])(this, "_lastSeq", -1);
|
|
@@ -48,7 +50,7 @@ var AgoraRteSynchronizer = exports.AgoraRteSynchronizer = /*#__PURE__*/function
|
|
|
48
50
|
_this.logger.debug("[".concat(_this.sequenceTypeLabel, "] message handle queue clear"));
|
|
49
51
|
return;
|
|
50
52
|
} else {
|
|
51
|
-
_this.logger.debug("[".concat(_this.sequenceTypeLabel, "] process task
|
|
53
|
+
_this.logger.debug("[".concat(_this.sequenceTypeLabel, "] process task: ").concat((0, _imports.jsonstring)(task)));
|
|
52
54
|
_this._currentTask = task;
|
|
53
55
|
_this.processTask(_this._currentTask).then(function () {
|
|
54
56
|
_this._currentTask = undefined;
|
|
@@ -63,6 +65,7 @@ var AgoraRteSynchronizer = exports.AgoraRteSynchronizer = /*#__PURE__*/function
|
|
|
63
65
|
this._apiService = apiService;
|
|
64
66
|
this._sceneId = sceneId;
|
|
65
67
|
this._sequenceType = sequenceType;
|
|
68
|
+
this.logger.info("initialized, sceneId: ".concat(this._sceneId, ", sequenceType: ").concat(this.sequenceTypeLabel));
|
|
66
69
|
}
|
|
67
70
|
return (0, _createClass2["default"])(AgoraRteSynchronizer, [{
|
|
68
71
|
key: "sequenceTypeLabel",
|
|
@@ -111,7 +114,7 @@ var AgoraRteSynchronizer = exports.AgoraRteSynchronizer = /*#__PURE__*/function
|
|
|
111
114
|
value: function addTasks(tasks) {
|
|
112
115
|
var _this$_queueTasks;
|
|
113
116
|
(_this$_queueTasks = this._queueTasks).push.apply(_this$_queueTasks, (0, _toConsumableArray2["default"])(tasks));
|
|
114
|
-
this.logger.debug("[".concat(this.sequenceTypeLabel, "] addTasks"), this._queueTasks);
|
|
117
|
+
this.logger.debug("[".concat(this.sequenceTypeLabel, "] addTasks: ").concat((0, _imports.jsonstring)(this._queueTasks)));
|
|
115
118
|
this.sortTasks();
|
|
116
119
|
this.notifyTaskQueueUpdate();
|
|
117
120
|
}
|
|
@@ -142,7 +145,6 @@ var AgoraRteSynchronizer = exports.AgoraRteSynchronizer = /*#__PURE__*/function
|
|
|
142
145
|
}, {
|
|
143
146
|
key: "dequeueTask",
|
|
144
147
|
value: function dequeueTask() {
|
|
145
|
-
this.logger.debug("[".concat(this.sequenceTypeLabel, "] dequeueTask"), this._queueTasks);
|
|
146
148
|
if (this._queueTasks.length === 0) {
|
|
147
149
|
return null;
|
|
148
150
|
} else {
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
import { AgoraRteRoomData, AgoraRteRoomStateData, AgoraRteStreamData } from './type';
|
|
1
|
+
import { AgoraRteRoomData, AgoraRteRoomStateData, AgoraRteStreamData, AgoraRteUserData } from './type';
|
|
2
2
|
import { AgoraRteAudioSourceType, AgoraRteMediaSourceState, AgoraRteVideoSourceType } from '../../type';
|
|
3
|
-
import { AgoraRteMediaStreamType, AgoraRteRoomConnectorType,
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
import { AgoraRteMediaStreamInfo, AgoraRteMediaStreamType, AgoraRteRoomConnectorType, AgoraRteUserInfo } from '../scene/type';
|
|
4
|
+
export declare class AgoraRteUser implements AgoraRteUserInfo {
|
|
5
|
+
static fromSeqData(data: AgoraRteUserData): AgoraRteUser;
|
|
6
|
+
userId: string;
|
|
7
|
+
userName: string;
|
|
8
|
+
userRole: string;
|
|
9
|
+
userProperties: Record<string, unknown>;
|
|
10
|
+
connectorType: AgoraRteRoomConnectorType;
|
|
11
|
+
constructor(data: {
|
|
12
|
+
userId: string;
|
|
13
|
+
userName: string;
|
|
14
|
+
userRole: string;
|
|
15
|
+
userProperties?: Record<string, unknown>;
|
|
16
|
+
connectorType: AgoraRteRoomConnectorType;
|
|
17
|
+
});
|
|
18
|
+
setUserProperties(properties: Record<string, unknown>): void;
|
|
19
|
+
toInfo(): AgoraRteUserInfo;
|
|
20
|
+
toString(): string;
|
|
16
21
|
}
|
|
17
22
|
export declare class AgoraRteMediaStream implements AgoraRteMediaStreamInfo {
|
|
18
23
|
static fromData(data: AgoraRteStreamData, owner: AgoraRteUserInfo): AgoraRteMediaStream;
|
|
@@ -28,8 +33,8 @@ export declare class AgoraRteMediaStream implements AgoraRteMediaStreamInfo {
|
|
|
28
33
|
audioSourceId?: string;
|
|
29
34
|
connectorType: AgoraRteRoomConnectorType;
|
|
30
35
|
constructor(data: AgoraRteMediaStreamInfo);
|
|
31
|
-
toString(): string;
|
|
32
36
|
toInfo(): AgoraRteMediaStreamInfo;
|
|
37
|
+
toString(): string;
|
|
33
38
|
}
|
|
34
39
|
export declare class AgoraRteRoom {
|
|
35
40
|
static fromData(data: AgoraRteRoomData): AgoraRteRoom;
|
|
@@ -42,6 +47,7 @@ export declare class AgoraRteRoomState {
|
|
|
42
47
|
static fromData(data: AgoraRteRoomStateData): AgoraRteRoomState;
|
|
43
48
|
total: number;
|
|
44
49
|
constructor(data: AgoraRteRoomStateData);
|
|
50
|
+
toString(): string;
|
|
45
51
|
}
|
|
46
52
|
export declare class AgoraRteSyncSnapshotData {
|
|
47
53
|
static fromData(data: AgoraRteSyncSnapshotInitData): AgoraRteSyncSnapshotData;
|
|
@@ -52,6 +58,7 @@ export declare class AgoraRteSyncSnapshotData {
|
|
|
52
58
|
room: AgoraRteRoom;
|
|
53
59
|
roomState: AgoraRteRoomState;
|
|
54
60
|
constructor(data: AgoraRteSyncSnapshotInitData);
|
|
61
|
+
toString(): string;
|
|
55
62
|
}
|
|
56
63
|
export type AgoraRteSyncSnapshotInitData = {
|
|
57
64
|
users: {
|