agora-rte-sdk 3.9.1 → 3.10.0-beta
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/monitor/index.d.ts +5 -0
- package/lib/core/processor/message-handler.d.ts +3 -1
- package/lib/core/processor/message-handler.js +46 -21
- package/lib/core/processor/sequence-msg/data.d.ts +7 -0
- package/lib/core/processor/sequence-msg/data.js +34 -3
- package/lib/core/processor/struct.d.ts +2 -1
- package/lib/core/processor/struct.js +10 -6
- package/lib/core/processor/type.d.ts +16 -1
- package/lib/core/processor/type.js +1 -0
- package/lib/core/rtc/channel.d.ts +2 -2
- package/lib/core/rtc/client.d.ts +5 -0
- package/lib/core/rtc/publisher.d.ts +7 -3
- package/lib/core/rtc/publisher.js +33 -1
- package/lib/core/rtc/subscriber.d.ts +8 -4
- package/lib/core/rtc/subscriber.js +26 -6
- package/lib/core/rtc/type.d.ts +4 -0
- package/lib/core/rtc/type.js +7 -1
- package/lib/core/scene/helpers/stream-publish-handlers.d.ts +3 -1
- package/lib/core/scene/helpers/stream-publish-handlers.js +8 -5
- package/lib/core/scene/index.d.ts +4 -0
- package/lib/core/scene/index.js +74 -21
- package/lib/core/scene/local-user.d.ts +2 -3
- package/lib/core/scene/local-user.js +2 -2
- package/lib/core/scene/stream-player.d.ts +28 -7
- package/lib/core/scene/stream-player.js +73 -21
- package/lib/core/scene/type.d.ts +15 -5
- package/lib/core/scene/type.js +4 -0
- package/lib/core/services/api.d.ts +8 -0
- package/lib/core/services/api.js +86 -56
- package/lib/plugin/monitor/index.js +17 -2
- package/lib/plugin/rtc/electron/canvas-tag-pool.d.ts +1 -1
- package/lib/plugin/rtc/electron/canvas-tag-pool.js +4 -2
- package/lib/plugin/rtc/electron/channel.d.ts +2 -2
- package/lib/plugin/rtc/electron/channel.js +3 -3
- package/lib/plugin/rtc/electron/client.d.ts +5 -0
- package/lib/plugin/rtc/electron/client.js +22 -6
- package/lib/plugin/rtc/electron/publisher.d.ts +4 -2
- package/lib/plugin/rtc/electron/publisher.js +71 -68
- package/lib/plugin/rtc/electron/source-manager.js +7 -0
- package/lib/plugin/rtc/electron/subscriber.js +7 -2
- package/lib/plugin/rtc/electron/type.d.ts +0 -1
- package/lib/plugin/rtc/electron/utils.d.ts +4 -4
- package/lib/plugin/rtc/electron/utils.js +10 -8
- package/lib/plugin/rtc/web/assembler.d.ts +2 -1
- package/lib/plugin/rtc/web/assembler.js +59 -37
- package/lib/plugin/rtc/web/channel.d.ts +2 -2
- package/lib/plugin/rtc/web/channel.js +8 -7
- package/lib/plugin/rtc/web/client.d.ts +5 -0
- package/lib/plugin/rtc/web/client.js +12 -1
- package/lib/plugin/rtc/web/device.js +17 -1
- package/lib/plugin/rtc/web/effect-enabler.js +10 -2
- package/lib/plugin/rtc/web/publisher.d.ts +6 -3
- package/lib/plugin/rtc/web/publisher.js +57 -5
- package/lib/plugin/rtc/web/track-control/microphone.d.ts +4 -2
- package/lib/plugin/rtc/web/track-control/microphone.js +16 -2
- package/lib/plugin/rtc/web/type.d.ts +2 -1
- package/lib/type.d.ts +1 -1
- package/lib/type.js +6 -0
- package/lib-es/core/processor/message-handler.js +26 -1
- package/lib-es/core/processor/sequence-msg/data.js +34 -3
- package/lib-es/core/processor/struct.js +5 -1
- package/lib-es/core/processor/type.js +1 -0
- package/lib-es/core/rtc/publisher.js +34 -2
- package/lib-es/core/rtc/subscriber.js +26 -6
- package/lib-es/core/rtc/type.js +6 -0
- package/lib-es/core/scene/helpers/stream-publish-handlers.js +7 -5
- package/lib-es/core/scene/index.js +77 -24
- package/lib-es/core/scene/local-user.js +2 -2
- package/lib-es/core/scene/stream-player.js +75 -23
- package/lib-es/core/scene/type.js +6 -0
- package/lib-es/core/services/api.js +86 -56
- package/lib-es/plugin/monitor/index.js +17 -2
- package/lib-es/plugin/rtc/electron/canvas-tag-pool.js +4 -2
- package/lib-es/plugin/rtc/electron/channel.js +3 -3
- package/lib-es/plugin/rtc/electron/client.js +22 -6
- package/lib-es/plugin/rtc/electron/publisher.js +72 -69
- package/lib-es/plugin/rtc/electron/source-manager.js +7 -0
- package/lib-es/plugin/rtc/electron/subscriber.js +7 -2
- package/lib-es/plugin/rtc/electron/utils.js +11 -9
- package/lib-es/plugin/rtc/web/assembler.js +59 -37
- package/lib-es/plugin/rtc/web/channel.js +9 -8
- package/lib-es/plugin/rtc/web/client.js +12 -1
- package/lib-es/plugin/rtc/web/device.js +17 -1
- package/lib-es/plugin/rtc/web/effect-enabler.js +10 -2
- package/lib-es/plugin/rtc/web/publisher.js +58 -6
- package/lib-es/plugin/rtc/web/track-control/microphone.js +17 -3
- package/lib-es/type.js +1 -1
- package/package.json +4 -4
|
@@ -15,6 +15,11 @@ export interface AgoraRteMonitor {
|
|
|
15
15
|
* @returns A promise that resolves when the log files have been uploaded.
|
|
16
16
|
*/
|
|
17
17
|
uploadLog(meta: object, logBasePath?: string): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Queries the device score.
|
|
20
|
+
* @returns The device score.
|
|
21
|
+
*/
|
|
22
|
+
queryDeviceScore(): number;
|
|
18
23
|
/**
|
|
19
24
|
* Releases all resources used by the AgoraRteMonitor.
|
|
20
25
|
*/
|
|
@@ -39,7 +39,8 @@ export declare class AgoraRteMessageHandle {
|
|
|
39
39
|
onRemoteStreamUpdated: (streams: AgoraRteMediaStreamInfo[], operator: AgoraRteUserInfo, cause?: import("./type").AgoraRteOperatCause) => void;
|
|
40
40
|
onRemoteStreamRemoved: (streams: AgoraRteMediaStreamInfo[], operator: AgoraRteUserInfo, cause?: import("./type").AgoraRteOperatCause) => void;
|
|
41
41
|
onTimeStampGapUpdate: (gap: number) => void;
|
|
42
|
-
onCustomChannelMessageRecieved: (message: import("
|
|
42
|
+
onCustomChannelMessageRecieved: (message: import("../../type").AgoraRteMessage) => void;
|
|
43
|
+
onPublishStreamLayerChanged(sceneId: string, events: import("./type").AgoraRteMessageHandlerStreamLayerEvent[]): void;
|
|
43
44
|
}>>;
|
|
44
45
|
private _dataStore;
|
|
45
46
|
private _timestampGap;
|
|
@@ -105,6 +106,7 @@ export declare class AgoraRteMessageHandle {
|
|
|
105
106
|
private _processStreamEvent;
|
|
106
107
|
private _handleStreamInOut;
|
|
107
108
|
private _handleStreamsInOut;
|
|
109
|
+
private _handleStreamLayerEvent;
|
|
108
110
|
private _handleCustomMessage;
|
|
109
111
|
private _syncTsGapWithServerAndLocal;
|
|
110
112
|
syncSnapshot(snapshot: AgoraRteSyncSnapshotData, channelSequence: number, peerSequence: number): void;
|
|
@@ -91,6 +91,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
91
91
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
92
92
|
var _imports = require("../../imports");
|
|
93
93
|
var _type = require("../rtm/type");
|
|
94
|
+
var _type2 = require("../../type");
|
|
94
95
|
var _clone = require("../utilities/clone");
|
|
95
96
|
var _diff = require("../utilities/diff");
|
|
96
97
|
var _logger = require("../utilities/logger");
|
|
@@ -98,7 +99,7 @@ var _data = require("./sequence-msg/data");
|
|
|
98
99
|
var _messageParser = require("./sequence-msg/message-parser");
|
|
99
100
|
var _struct = require("./struct");
|
|
100
101
|
var _synchronizer = require("./synchronizer");
|
|
101
|
-
var
|
|
102
|
+
var _type3 = require("./type");
|
|
102
103
|
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
104
|
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
105
|
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; }
|
|
@@ -131,13 +132,13 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
131
132
|
this._channelMessageSynchronizer = new _synchronizer.AgoraRteSynchronizerManager({
|
|
132
133
|
apiService: apiService,
|
|
133
134
|
sceneId: sceneId,
|
|
134
|
-
sequenceType:
|
|
135
|
+
sequenceType: _type3.AgoraRteSequenceType.CHANNEL_SEQUENCE,
|
|
135
136
|
userId: userId
|
|
136
137
|
});
|
|
137
138
|
this._peerMessageSynchronizer = new _synchronizer.AgoraRteSynchronizerManager({
|
|
138
139
|
apiService: apiService,
|
|
139
140
|
sceneId: sceneId,
|
|
140
|
-
sequenceType:
|
|
141
|
+
sequenceType: _type3.AgoraRteSequenceType.PEER_SEQUENCE,
|
|
141
142
|
userId: userId
|
|
142
143
|
});
|
|
143
144
|
|
|
@@ -290,6 +291,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
290
291
|
this._dataStore.setStreams(snapshot.streams);
|
|
291
292
|
this._dataStore.setRoomProperties(snapshot.roomProperties);
|
|
292
293
|
this._dataStore.setUserCount(snapshot.roomState.total);
|
|
294
|
+
this._dataStore.setStreamLayerConfigs(snapshot.streamLayerConfigs);
|
|
293
295
|
this.observable.notifyObservers('onSnapshotUpdated', snapshot);
|
|
294
296
|
}
|
|
295
297
|
}, {
|
|
@@ -302,7 +304,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
302
304
|
messageSynchronizer.addTasks(tasks);
|
|
303
305
|
} else {
|
|
304
306
|
tasks.forEach(function (task) {
|
|
305
|
-
if (task.cmd ===
|
|
307
|
+
if (task.cmd === _type3.AgoraRteServerMessageCmd.MESSAGE_EXTENSION) {
|
|
306
308
|
_this2._handleCustomMessage(task);
|
|
307
309
|
}
|
|
308
310
|
});
|
|
@@ -344,36 +346,39 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
344
346
|
key: "_handleSimpleMessage",
|
|
345
347
|
value: function _handleSimpleMessage(task, cmd) {
|
|
346
348
|
switch (cmd) {
|
|
347
|
-
case
|
|
349
|
+
case _type3.AgoraRteServerMessageCmd.ROOM_PROPERTY:
|
|
348
350
|
// room property change struct aligns with properties so use the same handling func
|
|
349
351
|
this._handleRoomProperties(task);
|
|
350
352
|
break;
|
|
351
|
-
case
|
|
353
|
+
case _type3.AgoraRteServerMessageCmd.ROOM_PROPERTIES:
|
|
352
354
|
this._handleRoomProperties(task);
|
|
353
355
|
break;
|
|
354
|
-
case
|
|
356
|
+
case _type3.AgoraRteServerMessageCmd.USER_IN_OUT:
|
|
355
357
|
this._handleUserInOut(task);
|
|
356
358
|
break;
|
|
357
|
-
case
|
|
359
|
+
case _type3.AgoraRteServerMessageCmd.USER_INFO:
|
|
358
360
|
this._handleUserInfo(task);
|
|
359
361
|
break;
|
|
360
|
-
case
|
|
362
|
+
case _type3.AgoraRteServerMessageCmd.USER_PROPERTY:
|
|
361
363
|
this._handleUserProperty(task);
|
|
362
364
|
break;
|
|
363
|
-
case
|
|
364
|
-
case
|
|
365
|
+
case _type3.AgoraRteServerMessageCmd.USER_PROPERTIES:
|
|
366
|
+
case _type3.AgoraRteServerMessageCmd.USER_PRIVATE_PROPERTIES:
|
|
365
367
|
this._handleUserProperties(task);
|
|
366
368
|
break;
|
|
367
|
-
case
|
|
369
|
+
case _type3.AgoraRteServerMessageCmd.USER_SUBSCRIBE:
|
|
368
370
|
this._handleUserSubscribe(task);
|
|
369
371
|
break;
|
|
370
|
-
case
|
|
372
|
+
case _type3.AgoraRteServerMessageCmd.STREAM_IN_OUT:
|
|
371
373
|
this._handleStreamInOut(task);
|
|
372
374
|
break;
|
|
373
|
-
case
|
|
375
|
+
case _type3.AgoraRteServerMessageCmd.STREAMS_IN_OUT:
|
|
374
376
|
this._handleStreamsInOut(task);
|
|
375
377
|
break;
|
|
376
|
-
case
|
|
378
|
+
case _type3.AgoraRteServerMessageCmd.STREAM_LAYER:
|
|
379
|
+
this._handleStreamLayerEvent(task);
|
|
380
|
+
break;
|
|
381
|
+
case _type3.AgoraRteServerMessageCmd.MESSAGE_EXTENSION:
|
|
377
382
|
this._handleCustomMessage(task);
|
|
378
383
|
break;
|
|
379
384
|
default:
|
|
@@ -384,7 +389,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
384
389
|
key: "_handleBatchMessage",
|
|
385
390
|
value: function _handleBatchMessage(task, cmd) {
|
|
386
391
|
switch (cmd) {
|
|
387
|
-
case
|
|
392
|
+
case _type3.AgoraRteServerMessageCmd.USER_PROPERTIES:
|
|
388
393
|
this._handleUserPropertyList(task);
|
|
389
394
|
break;
|
|
390
395
|
}
|
|
@@ -478,7 +483,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
478
483
|
var changedKeys = Array.from(new Set(Object.keys(changeProperties).map(function (k) {
|
|
479
484
|
return k.split('.')[0];
|
|
480
485
|
})));
|
|
481
|
-
if (action ===
|
|
486
|
+
if (action === _type3.AgoraRteSequenceMessagePropertiesAction.UPSERT) {
|
|
482
487
|
this.observable.notifyObservers('onRoomPropertyUpdated', changeProperties, changedKeys,
|
|
483
488
|
// FIXME: get real connector
|
|
484
489
|
_struct.AgoraRteUser.fromSeqData(_objectSpread({}, operator)), cause);
|
|
@@ -511,7 +516,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
511
516
|
} else {
|
|
512
517
|
user = _struct.AgoraRteUser.fromSeqData(u);
|
|
513
518
|
}
|
|
514
|
-
if (u.subscribe ===
|
|
519
|
+
if (u.subscribe === _type3.AgoraRteSequenceMessageSubscribeUserState.SUBSCRIBE) {
|
|
515
520
|
_this4._dataStore.setUser(user.userId, user);
|
|
516
521
|
var _u$streams = u.streams,
|
|
517
522
|
streams = _u$streams === void 0 ? [] : _u$streams;
|
|
@@ -523,7 +528,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
523
528
|
_this4._dataStore.setStream(stream.streamId, stream);
|
|
524
529
|
});
|
|
525
530
|
subscribeUsersData.push(user);
|
|
526
|
-
} else if (u.subscribe ===
|
|
531
|
+
} else if (u.subscribe === _type3.AgoraRteSequenceMessageSubscribeUserState.UNSUBSCRIBE) {
|
|
527
532
|
var _streams = _this4._dataStore.findUserStreams(u.userUuid);
|
|
528
533
|
var streamUuids = _streams.map(function (stream) {
|
|
529
534
|
return stream.streamId;
|
|
@@ -766,7 +771,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
766
771
|
}
|
|
767
772
|
var mergedProperties = this._mergeProperties((_user$userProperties2 = user.userProperties) !== null && _user$userProperties2 !== void 0 ? _user$userProperties2 : {}, changeProperties);
|
|
768
773
|
user.setUserProperties(mergedProperties);
|
|
769
|
-
if (action ===
|
|
774
|
+
if (action === _type3.AgoraRteSequenceMessagePropertiesAction.UPSERT) {
|
|
770
775
|
this.observable.notifyObservers('onUserPropertyUpdated', userUuid, changeProperties,
|
|
771
776
|
// FIXME: get real connector
|
|
772
777
|
_struct.AgoraRteUser.fromSeqData(_objectSpread({}, operator)), cause);
|
|
@@ -839,6 +844,26 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
839
844
|
_this9.observable.notifyObservers(key, value, operator && _struct.AgoraRteUser.fromSeqData(_objectSpread({}, operator)), cause);
|
|
840
845
|
});
|
|
841
846
|
}
|
|
847
|
+
}, {
|
|
848
|
+
key: "_handleStreamLayerEvent",
|
|
849
|
+
value: function _handleStreamLayerEvent(tast) {
|
|
850
|
+
var data = tast.data;
|
|
851
|
+
var streamUuid = data.streamUuid,
|
|
852
|
+
streamLayer = data.streamLayer,
|
|
853
|
+
cause = data.cause;
|
|
854
|
+
var newMask;
|
|
855
|
+
if (streamLayer === 0) {
|
|
856
|
+
newMask = _type2.AgoraRteStreamLayer.LOW;
|
|
857
|
+
} else {
|
|
858
|
+
newMask = streamLayer;
|
|
859
|
+
}
|
|
860
|
+
this._dataStore.setStreamLayerConfig(streamUuid, newMask);
|
|
861
|
+
this.observable.notifyObservers('onPublishStreamLayerChanged', this.sceneId, [{
|
|
862
|
+
streamId: streamUuid,
|
|
863
|
+
streamLayersBitMask: newMask,
|
|
864
|
+
cause: cause
|
|
865
|
+
}]);
|
|
866
|
+
}
|
|
842
867
|
}, {
|
|
843
868
|
key: "_handleCustomMessage",
|
|
844
869
|
value: function _handleCustomMessage(task) {
|
|
@@ -858,7 +883,7 @@ var AgoraRteMessageHandle = exports.AgoraRteMessageHandle = /*#__PURE__*/functio
|
|
|
858
883
|
key: "_syncTsGapWithServerAndLocal",
|
|
859
884
|
value: function _syncTsGapWithServerAndLocal(task) {
|
|
860
885
|
var gap = task.ts - Date.now();
|
|
861
|
-
if (this._timestampGap !== gap
|
|
886
|
+
if (this._timestampGap !== gap) {
|
|
862
887
|
// 🕛 时间间隔大于800ms就更新
|
|
863
888
|
this._timestampGap = gap;
|
|
864
889
|
// emit upper
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { AgoraRteMediaStream, AgoraRteUser } from '../struct';
|
|
2
2
|
import { Immutable } from '../../../imports';
|
|
3
|
+
import { AgoraRteReturnCode } from '../../../constant';
|
|
4
|
+
import { AgoraRteStreamLayer } from '../../../type';
|
|
3
5
|
export declare class AgoraRteSyncDataStore {
|
|
4
6
|
protected logger: import("agora-foundation/lib/logger/type").Logger;
|
|
5
7
|
private _userCount;
|
|
6
8
|
private _users;
|
|
7
9
|
private _streams;
|
|
10
|
+
private _streamLayerConfigs;
|
|
8
11
|
private _roomProperties;
|
|
9
12
|
get users(): Immutable.Map<string, AgoraRteUser>;
|
|
10
13
|
setUsers(users: Record<string, AgoraRteUser>): number;
|
|
@@ -20,6 +23,10 @@ export declare class AgoraRteSyncDataStore {
|
|
|
20
23
|
deleteStream(key: string): number;
|
|
21
24
|
deleteStreams(keys: string[]): number;
|
|
22
25
|
findStream(streamUuid: string): AgoraRteMediaStream | undefined;
|
|
26
|
+
setStreamLayerConfigs(streamLayerConfigs: Record<string, AgoraRteStreamLayer>): AgoraRteReturnCode;
|
|
27
|
+
setStreamLayerConfig(key: string, streamLayerConfig: AgoraRteStreamLayer): AgoraRteReturnCode;
|
|
28
|
+
deleteStreamLayerConfig(key: string): AgoraRteReturnCode;
|
|
29
|
+
getPublishStreamLayersByStreamId(key: string): number;
|
|
23
30
|
get userCount(): number;
|
|
24
31
|
setUserCount(userCount: number): void;
|
|
25
32
|
getRoomPropertiesDeepCloneByKeyPath(keyPath: string): unknown;
|
|
@@ -53,14 +53,15 @@ var _imports = require("../../../imports");
|
|
|
53
53
|
var _logger = require("../../utilities/logger");
|
|
54
54
|
var _constant = require("../../../constant");
|
|
55
55
|
var _propertyExtract = require("../../utilities/property-extract");
|
|
56
|
+
var _type = require("../../../type");
|
|
56
57
|
var _AgoraRteSyncDataStore;
|
|
57
|
-
var _initProto, _setUsersDecs, _setUserDecs, _deleteUserDecs, _setStreamsDecs, _setStreamDecs, _deleteStreamDecs, _deleteStreamsDecs, _ref;
|
|
58
|
+
var _initProto, _setUsersDecs, _setUserDecs, _deleteUserDecs, _setStreamsDecs, _setStreamDecs, _deleteStreamDecs, _deleteStreamsDecs, _setStreamLayerConfigsDecs, _setStreamLayerConfigDecs, _deleteStreamLayerConfigDecs, _getPublishStreamLayersByStreamIdDecs, _ref;
|
|
58
59
|
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)]; } }; }
|
|
59
60
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
60
61
|
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); }
|
|
61
62
|
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; }
|
|
62
63
|
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; }
|
|
63
|
-
_ref = (_setUsersDecs = (0, _imports.trace)(['users']), _setUserDecs = (0, _imports.trace)(['key', 'user']), _deleteUserDecs = (0, _imports.trace)(['key']), _setStreamsDecs = (0, _imports.trace)(['streams']), _setStreamDecs = (0, _imports.trace)(['key', 'stream']), _deleteStreamDecs = (0, _imports.trace)(['key']), _deleteStreamsDecs = (0, _imports.trace)(['keys']), "logger");
|
|
64
|
+
_ref = (_setUsersDecs = (0, _imports.trace)(['users']), _setUserDecs = (0, _imports.trace)(['key', 'user']), _deleteUserDecs = (0, _imports.trace)(['key']), _setStreamsDecs = (0, _imports.trace)(['streams']), _setStreamDecs = (0, _imports.trace)(['key', 'stream']), _deleteStreamDecs = (0, _imports.trace)(['key']), _deleteStreamsDecs = (0, _imports.trace)(['keys']), _setStreamLayerConfigsDecs = (0, _imports.trace)(['streamLayerConfigs']), _setStreamLayerConfigDecs = (0, _imports.trace)(['key', 'streamLayerConfig']), _deleteStreamLayerConfigDecs = (0, _imports.trace)(['key']), _getPublishStreamLayersByStreamIdDecs = (0, _imports.trace)(['key']), "logger");
|
|
64
65
|
var AgoraRteSyncDataStore = exports.AgoraRteSyncDataStore = /*#__PURE__*/function () {
|
|
65
66
|
function AgoraRteSyncDataStore() {
|
|
66
67
|
(0, _classCallCheck2["default"])(this, AgoraRteSyncDataStore);
|
|
@@ -70,6 +71,7 @@ var AgoraRteSyncDataStore = exports.AgoraRteSyncDataStore = /*#__PURE__*/functio
|
|
|
70
71
|
(0, _defineProperty2["default"])(this, "_userCount", 0);
|
|
71
72
|
(0, _defineProperty2["default"])(this, "_users", _imports.Immutable.Map());
|
|
72
73
|
(0, _defineProperty2["default"])(this, "_streams", _imports.Immutable.Map());
|
|
74
|
+
(0, _defineProperty2["default"])(this, "_streamLayerConfigs", _imports.Immutable.Map());
|
|
73
75
|
(0, _defineProperty2["default"])(this, "_roomProperties", {});
|
|
74
76
|
}
|
|
75
77
|
return (0, _createClass2["default"])(AgoraRteSyncDataStore, [{
|
|
@@ -151,6 +153,35 @@ var AgoraRteSyncDataStore = exports.AgoraRteSyncDataStore = /*#__PURE__*/functio
|
|
|
151
153
|
value: function findStream(streamUuid) {
|
|
152
154
|
return this._streams.get(streamUuid);
|
|
153
155
|
}
|
|
156
|
+
}, {
|
|
157
|
+
key: "setStreamLayerConfigs",
|
|
158
|
+
value: function setStreamLayerConfigs(streamLayerConfigs) {
|
|
159
|
+
this._streamLayerConfigs = _imports.Immutable.Map(streamLayerConfigs);
|
|
160
|
+
return _constant.AgoraRteReturnCode.SUCCESS;
|
|
161
|
+
}
|
|
162
|
+
}, {
|
|
163
|
+
key: "setStreamLayerConfig",
|
|
164
|
+
value: function setStreamLayerConfig(key, streamLayerConfig) {
|
|
165
|
+
this._streamLayerConfigs = this._streamLayerConfigs.set(key, streamLayerConfig);
|
|
166
|
+
return _constant.AgoraRteReturnCode.SUCCESS;
|
|
167
|
+
}
|
|
168
|
+
}, {
|
|
169
|
+
key: "deleteStreamLayerConfig",
|
|
170
|
+
value: function deleteStreamLayerConfig(key) {
|
|
171
|
+
this._streamLayerConfigs = this._streamLayerConfigs["delete"](key);
|
|
172
|
+
return _constant.AgoraRteReturnCode.SUCCESS;
|
|
173
|
+
}
|
|
174
|
+
}, {
|
|
175
|
+
key: "getPublishStreamLayersByStreamId",
|
|
176
|
+
value: function getPublishStreamLayersByStreamId(key) {
|
|
177
|
+
var streamLayer = this._streamLayerConfigs.get(key);
|
|
178
|
+
if (streamLayer !== undefined) {
|
|
179
|
+
return streamLayer;
|
|
180
|
+
}
|
|
181
|
+
this.logger.info("stream layer config not found for stream ".concat(key, ", return low layer as default"));
|
|
182
|
+
this.setStreamLayerConfig(key, _type.AgoraRteStreamLayer.LOW);
|
|
183
|
+
return _type.AgoraRteStreamLayer.LOW;
|
|
184
|
+
}
|
|
154
185
|
}, {
|
|
155
186
|
key: "userCount",
|
|
156
187
|
get: function get() {
|
|
@@ -177,7 +208,7 @@ var AgoraRteSyncDataStore = exports.AgoraRteSyncDataStore = /*#__PURE__*/functio
|
|
|
177
208
|
}]);
|
|
178
209
|
}();
|
|
179
210
|
_AgoraRteSyncDataStore = AgoraRteSyncDataStore;
|
|
180
|
-
var _applyDecs$e = _applyDecs(_AgoraRteSyncDataStore, [[_setUsersDecs, 2, "setUsers"], [_setUserDecs, 2, "setUser"], [_deleteUserDecs, 2, "deleteUser"], [_setStreamsDecs, 2, "setStreams"], [_setStreamDecs, 2, "setStream"], [_deleteStreamDecs, 2, "deleteStream"], [_deleteStreamsDecs, 2, "deleteStreams"]], []).e;
|
|
211
|
+
var _applyDecs$e = _applyDecs(_AgoraRteSyncDataStore, [[_setUsersDecs, 2, "setUsers"], [_setUserDecs, 2, "setUser"], [_deleteUserDecs, 2, "deleteUser"], [_setStreamsDecs, 2, "setStreams"], [_setStreamDecs, 2, "setStream"], [_deleteStreamDecs, 2, "deleteStream"], [_deleteStreamsDecs, 2, "deleteStreams"], [_setStreamLayerConfigsDecs, 2, "setStreamLayerConfigs"], [_setStreamLayerConfigDecs, 2, "setStreamLayerConfig"], [_deleteStreamLayerConfigDecs, 2, "deleteStreamLayerConfig"], [_getPublishStreamLayersByStreamIdDecs, 2, "getPublishStreamLayersByStreamId"]], []).e;
|
|
181
212
|
var _applyDecs$e2 = (0, _slicedToArray2["default"])(_applyDecs$e, 1);
|
|
182
213
|
_initProto = _applyDecs$e2[0];
|
|
183
214
|
_applyDecs$e;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AgoraRteRoomData, AgoraRteRoomStateData, AgoraRteStreamData, AgoraRteUserData } from './type';
|
|
2
|
-
import { AgoraRteAudioSourceType, AgoraRteMediaSourceState, AgoraRteVideoSourceType } from '../../type';
|
|
2
|
+
import { AgoraRteAudioSourceType, AgoraRteMediaSourceState, AgoraRteStreamLayer, AgoraRteVideoSourceType } from '../../type';
|
|
3
3
|
import { AgoraRteMediaStreamInfo, AgoraRteMediaStreamType, AgoraRteRoomConnectorType, AgoraRteUserInfo } from '../scene/type';
|
|
4
4
|
export declare class AgoraRteUser implements AgoraRteUserInfo {
|
|
5
5
|
static fromSeqData(data: AgoraRteUserData): AgoraRteUser;
|
|
@@ -57,6 +57,7 @@ export declare class AgoraRteSyncSnapshotData {
|
|
|
57
57
|
roomProperties: Record<string, unknown>;
|
|
58
58
|
room: AgoraRteRoom;
|
|
59
59
|
roomState: AgoraRteRoomState;
|
|
60
|
+
streamLayerConfigs: Record<string, AgoraRteStreamLayer>;
|
|
60
61
|
constructor(data: AgoraRteSyncSnapshotInitData);
|
|
61
62
|
toString(): string;
|
|
62
63
|
}
|
|
@@ -23,7 +23,8 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
23
23
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
24
24
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
25
25
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
26
|
-
var _type = require("
|
|
26
|
+
var _type = require("../../type");
|
|
27
|
+
var _type2 = require("../scene/type");
|
|
27
28
|
var _streamType = require("../scene/helpers/stream-type");
|
|
28
29
|
var _imports = require("../../imports");
|
|
29
30
|
var AgoraRteUser = exports.AgoraRteUser = /*#__PURE__*/function () {
|
|
@@ -60,9 +61,9 @@ var AgoraRteUser = exports.AgoraRteUser = /*#__PURE__*/function () {
|
|
|
60
61
|
key: "fromSeqData",
|
|
61
62
|
value: function fromSeqData(data) {
|
|
62
63
|
var _data$connectorType;
|
|
63
|
-
var connectorType = (_data$connectorType = data.connectorType) !== null && _data$connectorType !== void 0 ? _data$connectorType :
|
|
64
|
-
var isValidConnectorType = connectorType in
|
|
65
|
-
connectorType = isValidConnectorType ? connectorType :
|
|
64
|
+
var connectorType = (_data$connectorType = data.connectorType) !== null && _data$connectorType !== void 0 ? _data$connectorType : _type2.AgoraRteRoomConnectorType.NONE;
|
|
65
|
+
var isValidConnectorType = connectorType in _type2.AgoraRteRoomConnectorType;
|
|
66
|
+
connectorType = isValidConnectorType ? connectorType : _type2.AgoraRteRoomConnectorType.NONE;
|
|
66
67
|
return new AgoraRteUser({
|
|
67
68
|
userId: data.userUuid,
|
|
68
69
|
userName: data.userName,
|
|
@@ -130,7 +131,7 @@ var AgoraRteMediaStream = exports.AgoraRteMediaStream = /*#__PURE__*/function ()
|
|
|
130
131
|
videoSourceId: data.videoSourceUuid,
|
|
131
132
|
audioSourceId: data.audioSourceUuid,
|
|
132
133
|
streamType: (0, _streamType.convertPublishStateToStreamType)(data.audioState, data.videoState),
|
|
133
|
-
connectorType: (_data$connectorType2 = data.connectorType) !== null && _data$connectorType2 !== void 0 ? _data$connectorType2 :
|
|
134
|
+
connectorType: (_data$connectorType2 = data.connectorType) !== null && _data$connectorType2 !== void 0 ? _data$connectorType2 : _type2.AgoraRteRoomConnectorType.NONE
|
|
134
135
|
});
|
|
135
136
|
}
|
|
136
137
|
}]);
|
|
@@ -175,6 +176,7 @@ var AgoraRteSyncSnapshotData = exports.AgoraRteSyncSnapshotData = /*#__PURE__*/f
|
|
|
175
176
|
(0, _defineProperty2["default"])(this, "users", {});
|
|
176
177
|
(0, _defineProperty2["default"])(this, "streams", {});
|
|
177
178
|
(0, _defineProperty2["default"])(this, "roomProperties", {});
|
|
179
|
+
(0, _defineProperty2["default"])(this, "streamLayerConfigs", {});
|
|
178
180
|
var sequence = data.sequence,
|
|
179
181
|
users = data.users,
|
|
180
182
|
roomProperties = data.roomProperties,
|
|
@@ -187,6 +189,7 @@ var AgoraRteSyncSnapshotData = exports.AgoraRteSyncSnapshotData = /*#__PURE__*/f
|
|
|
187
189
|
streams = _u$streams === void 0 ? [] : _u$streams;
|
|
188
190
|
streams.forEach(function (s) {
|
|
189
191
|
_this.streams[s.streamUuid] = AgoraRteMediaStream.fromData(s, user);
|
|
192
|
+
_this.streamLayerConfigs[s.streamUuid] = s.streamLayer || _type.AgoraRteStreamLayer.LOW;
|
|
190
193
|
});
|
|
191
194
|
_this.users[u.userUuid] = user;
|
|
192
195
|
});
|
|
@@ -215,7 +218,8 @@ var AgoraRteSyncSnapshotData = exports.AgoraRteSyncSnapshotData = /*#__PURE__*/f
|
|
|
215
218
|
})),
|
|
216
219
|
roomProperties: this.roomProperties,
|
|
217
220
|
room: this.room,
|
|
218
|
-
roomState: this.roomState.toString()
|
|
221
|
+
roomState: this.roomState.toString(),
|
|
222
|
+
streamLayerConfigs: this.streamLayerConfigs
|
|
219
223
|
});
|
|
220
224
|
}
|
|
221
225
|
}], [{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgoraRteAudioSourceType, AgoraRteMediaPublishState, AgoraRteMediaSourceState, AgoraRteMessage, AgoraRteVideoSourceType } from '../../type';
|
|
1
|
+
import { AgoraRteAudioSourceType, AgoraRteMediaPublishState, AgoraRteMediaSourceState, AgoraRteMessage, AgoraRteStreamLayer, AgoraRteVideoSourceType } from '../../type';
|
|
2
2
|
import { AgoraRteMediaStreamInfo, AgoraRteMediaStreamType, AgoraRteRoomConnectorType, AgoraRteUserInfo } from '../scene/type';
|
|
3
3
|
import { AgoraRteSyncSnapshotData } from './struct';
|
|
4
4
|
export type MessageExt = {
|
|
@@ -26,6 +26,7 @@ export interface AgoraRteStreamData {
|
|
|
26
26
|
connectorType: AgoraRteRoomConnectorType;
|
|
27
27
|
audioSourceUuid?: string;
|
|
28
28
|
videoSourceUuid?: string;
|
|
29
|
+
streamLayer?: AgoraRteStreamLayer;
|
|
29
30
|
playUrl?: string;
|
|
30
31
|
flvPlayUrl?: string;
|
|
31
32
|
rtmpPlayUrl?: string;
|
|
@@ -89,6 +90,7 @@ export declare enum AgoraRteServerMessageCmd {
|
|
|
89
90
|
USER_PRIVATE_PROPERTIES = 26,
|
|
90
91
|
STREAM_IN_OUT = 40,
|
|
91
92
|
STREAMS_IN_OUT = 41,
|
|
93
|
+
STREAM_LAYER = 43,
|
|
92
94
|
MESSAGE_EXTENSION = 99,
|
|
93
95
|
MOCK_RTM = 101
|
|
94
96
|
}
|
|
@@ -149,6 +151,7 @@ export type AgoraRteMessageHandlerObserver = Partial<{
|
|
|
149
151
|
onRemoteStreamRemoved: (streams: AgoraRteMediaStreamInfo[], operator: AgoraRteUserInfo, cause?: AgoraRteOperatCause) => void;
|
|
150
152
|
onTimeStampGapUpdate: (gap: number) => void;
|
|
151
153
|
onCustomChannelMessageRecieved: (message: AgoraRteMessage) => void;
|
|
154
|
+
onPublishStreamLayerChanged(sceneId: string, events: AgoraRteMessageHandlerStreamLayerEvent[]): void;
|
|
152
155
|
}>;
|
|
153
156
|
export interface AgoraRteSequenceMessageStreamInfo {
|
|
154
157
|
streamUuid: string;
|
|
@@ -262,3 +265,15 @@ export type AgoraRteSequenceMessageCustomMessage = {
|
|
|
262
265
|
};
|
|
263
266
|
payload: unknown;
|
|
264
267
|
};
|
|
268
|
+
export type AgoraRteSequenceMessageStreamLayer = {
|
|
269
|
+
streamUuid: string;
|
|
270
|
+
streamLayer: number;
|
|
271
|
+
addStreamLayer: number;
|
|
272
|
+
removeStreamLayer: number;
|
|
273
|
+
cause: Record<string, unknown>;
|
|
274
|
+
};
|
|
275
|
+
export type AgoraRteMessageHandlerStreamLayerEvent = {
|
|
276
|
+
streamId: string;
|
|
277
|
+
streamLayersBitMask: number;
|
|
278
|
+
cause: Record<string, unknown>;
|
|
279
|
+
};
|
|
@@ -16,6 +16,7 @@ var AgoraRteServerMessageCmd = exports.AgoraRteServerMessageCmd = /*#__PURE__*/f
|
|
|
16
16
|
AgoraRteServerMessageCmd[AgoraRteServerMessageCmd["USER_PRIVATE_PROPERTIES"] = 26] = "USER_PRIVATE_PROPERTIES";
|
|
17
17
|
AgoraRteServerMessageCmd[AgoraRteServerMessageCmd["STREAM_IN_OUT"] = 40] = "STREAM_IN_OUT";
|
|
18
18
|
AgoraRteServerMessageCmd[AgoraRteServerMessageCmd["STREAMS_IN_OUT"] = 41] = "STREAMS_IN_OUT";
|
|
19
|
+
AgoraRteServerMessageCmd[AgoraRteServerMessageCmd["STREAM_LAYER"] = 43] = "STREAM_LAYER";
|
|
19
20
|
AgoraRteServerMessageCmd[AgoraRteServerMessageCmd["MESSAGE_EXTENSION"] = 99] = "MESSAGE_EXTENSION";
|
|
20
21
|
AgoraRteServerMessageCmd[AgoraRteServerMessageCmd["MOCK_RTM"] = 101] = "MOCK_RTM";
|
|
21
22
|
return AgoraRteServerMessageCmd;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AgoraObservable, AgoraRteRenderView } from '../../imports';
|
|
2
|
-
import { AgoraRtcVideoSnapshot, AgoraRtcEncryptionConfig,
|
|
2
|
+
import { AgoraRtcVideoSnapshot, AgoraRtcEncryptionConfig, AgoraRtcChannelClientObserver, AgoraRtcVideoEncoderConfiguration, AgoraRtcRenderMode, AgoraRtcStreamLayer } from './type';
|
|
3
3
|
import { AgoraRtcCanvasHelper } from './canvas';
|
|
4
4
|
import { AgoraRtcChannelPublisher } from './publisher';
|
|
5
5
|
import { AgoraRtcChannelSubscriber } from './subscriber';
|
|
@@ -54,7 +54,7 @@ export declare abstract class AgoraRtcChannelClient {
|
|
|
54
54
|
* @param streamId The ID of the stream.
|
|
55
55
|
* @returns The result of the operation.
|
|
56
56
|
*/
|
|
57
|
-
abstract setVideoEncoderConfig(config: AgoraRtcVideoEncoderConfiguration,
|
|
57
|
+
abstract setVideoEncoderConfig(config: AgoraRtcVideoEncoderConfiguration, streamLayer: AgoraRtcStreamLayer, streamId: string): number;
|
|
58
58
|
/**
|
|
59
59
|
* Sets the dual stream mode for a local stream.
|
|
60
60
|
* @param streamId The ID of the stream.
|
package/lib/core/rtc/client.d.ts
CHANGED
|
@@ -43,6 +43,11 @@ export declare abstract class AgoraRtcClient {
|
|
|
43
43
|
* @param enable
|
|
44
44
|
*/
|
|
45
45
|
abstract observeSystemSelectedSpeakerChanged(enable: boolean): number;
|
|
46
|
+
/**
|
|
47
|
+
* queryDeviceScore
|
|
48
|
+
* @returns device score
|
|
49
|
+
*/
|
|
50
|
+
abstract queryDeviceScore(): number;
|
|
46
51
|
/**
|
|
47
52
|
* Observe the system selected microphone
|
|
48
53
|
* @param enable
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AgoraObservable } from '../../imports';
|
|
2
2
|
import { AgoraRtcStreamPublishPool } from './publish-pool';
|
|
3
3
|
import { AgoraRtcSourceManager } from './source-manager';
|
|
4
|
-
import { AgoraRtcAudioSourceType, AgoraRtcChannelPublisherObserver, AgoraRtcLatencyLevelType, AgoraRtcMediaSourceState, AgoraRtcScreenScenarioType, AgoraRtcVideoEncoderConfiguration, AgoraRtcVideoSourceType
|
|
4
|
+
import { AgoraRtcAudioSourceType, AgoraRtcChannelPublisherObserver, AgoraRtcLatencyLevelType, AgoraRtcMediaSourceState, AgoraRtcScreenScenarioType, AgoraRtcStreamLayer, AgoraRtcVideoEncoderConfiguration, AgoraRtcVideoSourceType } from './type';
|
|
5
5
|
export declare abstract class AgoraRtcChannelPublisher {
|
|
6
6
|
protected abstract publishPool: AgoraRtcStreamPublishPool;
|
|
7
7
|
protected abstract sourceManager: AgoraRtcSourceManager;
|
|
@@ -10,6 +10,7 @@ export declare abstract class AgoraRtcChannelPublisher {
|
|
|
10
10
|
protected videoEncoderConfigs: Map<string, AgoraRtcVideoEncoderConfiguration>;
|
|
11
11
|
protected screenScenario: AgoraRtcScreenScenarioType;
|
|
12
12
|
protected latencyLevel: AgoraRtcLatencyLevelType;
|
|
13
|
+
protected streamLayerBitMaskMap: Map<string, number>;
|
|
13
14
|
protected abstract _getCameraState(sourceId: string): AgoraRtcMediaSourceState;
|
|
14
15
|
protected abstract _getScreenCaptureState(sourceId: string): AgoraRtcMediaSourceState;
|
|
15
16
|
protected abstract _getMicrophoneState(sourceId: string): AgoraRtcMediaSourceState;
|
|
@@ -22,7 +23,7 @@ export declare abstract class AgoraRtcChannelPublisher {
|
|
|
22
23
|
* @param type The type of the stream.
|
|
23
24
|
* @returns The result of the operation.
|
|
24
25
|
*/
|
|
25
|
-
publishLocalVideoStream(token: string | undefined, streamId: string, sourceId: string, type: AgoraRtcVideoSourceType): number;
|
|
26
|
+
publishLocalVideoStream(token: string | undefined, streamId: string, sourceId: string, type: AgoraRtcVideoSourceType, streamLayerBitMask: number): number;
|
|
26
27
|
/**
|
|
27
28
|
* Unpublishes a local video stream.
|
|
28
29
|
* @param streamId The ID of the stream.
|
|
@@ -30,6 +31,7 @@ export declare abstract class AgoraRtcChannelPublisher {
|
|
|
30
31
|
* @returns The result of the operation.
|
|
31
32
|
*/
|
|
32
33
|
unpublishLocalVideoStream(streamId: string, type: AgoraRtcVideoSourceType): number;
|
|
34
|
+
adjustVideoProfileByStreamLayer(streamId: string): void;
|
|
33
35
|
/**
|
|
34
36
|
* Publishes a local audio stream.
|
|
35
37
|
* @param token The token for authentication.
|
|
@@ -61,7 +63,9 @@ export declare abstract class AgoraRtcChannelPublisher {
|
|
|
61
63
|
* @param streamId
|
|
62
64
|
* @returns number
|
|
63
65
|
*/
|
|
64
|
-
abstract setVideoEncoderConfig(config: AgoraRtcVideoEncoderConfiguration,
|
|
66
|
+
abstract setVideoEncoderConfig(config: AgoraRtcVideoEncoderConfiguration, streamLayer: AgoraRtcStreamLayer, streamId: string): number;
|
|
67
|
+
protected abstract _internalSetVideoEncoderConfig(config: AgoraRtcVideoEncoderConfiguration, streamLayer: AgoraRtcStreamLayer, streamId: string): number;
|
|
68
|
+
abstract getVideoEncoderConfig(streamLayer: AgoraRtcStreamLayer, streamId: string): AgoraRtcVideoEncoderConfiguration;
|
|
65
69
|
/**
|
|
66
70
|
* set dual stream mode
|
|
67
71
|
* @param streamId The ID of the stream.
|
|
@@ -66,6 +66,7 @@ var AgoraRtcChannelPublisher = exports.AgoraRtcChannelPublisher = /*#__PURE__*/f
|
|
|
66
66
|
(0, _defineProperty2["default"])(this, "videoEncoderConfigs", new Map());
|
|
67
67
|
(0, _defineProperty2["default"])(this, "screenScenario", _type.AgoraRtcScreenScenarioType.CLEARITY);
|
|
68
68
|
(0, _defineProperty2["default"])(this, "latencyLevel", _type.AgoraRtcLatencyLevelType.LOW);
|
|
69
|
+
(0, _defineProperty2["default"])(this, "streamLayerBitMaskMap", new Map());
|
|
69
70
|
}
|
|
70
71
|
return (0, _createClass2["default"])(AgoraRtcChannelPublisher, [{
|
|
71
72
|
key: "publishLocalVideoStream",
|
|
@@ -78,7 +79,7 @@ var AgoraRtcChannelPublisher = exports.AgoraRtcChannelPublisher = /*#__PURE__*/f
|
|
|
78
79
|
* @param type The type of the stream.
|
|
79
80
|
* @returns The result of the operation.
|
|
80
81
|
*/
|
|
81
|
-
function publishLocalVideoStream(token, streamId, sourceId, type) {
|
|
82
|
+
function publishLocalVideoStream(token, streamId, sourceId, type, streamLayerBitMask) {
|
|
82
83
|
var state = _type.AgoraRtcMediaSourceState.CLOSE;
|
|
83
84
|
if (type === _type.AgoraRtcVideoSourceType.SCREEN) {
|
|
84
85
|
state = this._getScreenCaptureState(sourceId);
|
|
@@ -88,6 +89,8 @@ var AgoraRtcChannelPublisher = exports.AgoraRtcChannelPublisher = /*#__PURE__*/f
|
|
|
88
89
|
if (state == _type.AgoraRtcMediaSourceState.ERROR) {
|
|
89
90
|
return _constant.AgoraRtcErrorCode.CANNOT_PUBLISH_LOCAL_VIDEO_STREAM;
|
|
90
91
|
}
|
|
92
|
+
this.streamLayerBitMaskMap.set(streamId, streamLayerBitMask);
|
|
93
|
+
this.adjustVideoProfileByStreamLayer(streamId);
|
|
91
94
|
return this.publishPool.publishVideo(token, streamId, sourceId, type, state);
|
|
92
95
|
}
|
|
93
96
|
|
|
@@ -100,8 +103,37 @@ var AgoraRtcChannelPublisher = exports.AgoraRtcChannelPublisher = /*#__PURE__*/f
|
|
|
100
103
|
}, {
|
|
101
104
|
key: "unpublishLocalVideoStream",
|
|
102
105
|
value: function unpublishLocalVideoStream(streamId, type) {
|
|
106
|
+
this.streamLayerBitMaskMap["delete"](streamId);
|
|
103
107
|
return this.publishPool.unpublishVideo(streamId, type);
|
|
104
108
|
}
|
|
109
|
+
}, {
|
|
110
|
+
key: "adjustVideoProfileByStreamLayer",
|
|
111
|
+
value: function adjustVideoProfileByStreamLayer(streamId) {
|
|
112
|
+
var bitmask = this.streamLayerBitMaskMap.get(streamId);
|
|
113
|
+
if (bitmask === undefined) {
|
|
114
|
+
this.logger.error("no stream layer bit mask found for streamId: ".concat(streamId));
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// 仅开启小流
|
|
119
|
+
if (bitmask === _type.AgoraRtcStreamLayer.LOW) {
|
|
120
|
+
// 用大流承载小流 profile,并禁用低流
|
|
121
|
+
this._internalSetVideoEncoderConfig(this.getVideoEncoderConfig(_type.AgoraRtcStreamLayer.LOW, streamId), _type.AgoraRtcStreamLayer.HIGH, streamId);
|
|
122
|
+
this.setDualStreamMode(streamId, false);
|
|
123
|
+
}
|
|
124
|
+
// 大小流同时开启
|
|
125
|
+
else if ((bitmask & _type.AgoraRtcStreamLayer.HIGH) !== 0 && (bitmask & _type.AgoraRtcStreamLayer.LOW) !== 0) {
|
|
126
|
+
this._internalSetVideoEncoderConfig(this.getVideoEncoderConfig(_type.AgoraRtcStreamLayer.HIGH, streamId), _type.AgoraRtcStreamLayer.HIGH, streamId);
|
|
127
|
+
this._internalSetVideoEncoderConfig(this.getVideoEncoderConfig(_type.AgoraRtcStreamLayer.LOW, streamId), _type.AgoraRtcStreamLayer.LOW, streamId);
|
|
128
|
+
this.setDualStreamMode(streamId, true);
|
|
129
|
+
}
|
|
130
|
+
// 仅开启大流或未开启小流(回退到仅大流)
|
|
131
|
+
else {
|
|
132
|
+
// 使用高 profile 设置大流,禁用低流
|
|
133
|
+
this._internalSetVideoEncoderConfig(this.getVideoEncoderConfig(_type.AgoraRtcStreamLayer.HIGH, streamId), _type.AgoraRtcStreamLayer.HIGH, streamId);
|
|
134
|
+
this.setDualStreamMode(streamId, false);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
105
137
|
/**
|
|
106
138
|
* Publishes a local audio stream.
|
|
107
139
|
* @param token The token for authentication.
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import { AgoraRtcVideoStreamType } from './type';
|
|
1
|
+
import { AgoraRtcVideoStreamType, AgoraRtcStreamLayer } from './type';
|
|
2
2
|
export declare abstract class AgoraRtcChannelSubscriber {
|
|
3
3
|
protected logger: import("agora-foundation/lib/logger/type").Logger;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* 记录每个视频流最近一次订阅的层(high/low 等),用于断线重连时恢复订阅
|
|
6
|
+
* 多次订阅将覆盖 value,unsubscribe 时直接删除对应 key,避免旧层被恢复
|
|
7
|
+
*/
|
|
8
|
+
protected _videoMapping: Map<string, AgoraRtcStreamLayer>;
|
|
5
9
|
protected _audioMapping: Map<string, boolean>;
|
|
6
10
|
protected _isPause: boolean;
|
|
7
11
|
/**
|
|
8
12
|
* Subscribes to a remote video stream.
|
|
9
13
|
* @param streamId The ID of the stream.
|
|
10
|
-
* @param
|
|
14
|
+
* @param streamLayer The layer to subscribe (low/high, later calls overwrite earlier records).
|
|
11
15
|
* @returns The result of the operation.
|
|
12
16
|
*/
|
|
13
|
-
subscribeRemoteVideoStream(streamId: string,
|
|
17
|
+
subscribeRemoteVideoStream(streamId: string, streamLayer: AgoraRtcStreamLayer): number;
|
|
14
18
|
/**
|
|
15
19
|
* Unsubscribes from a remote video stream.
|
|
16
20
|
* @param streamId The ID of the stream.
|