agora-rte-sdk 3.8.0-alpha → 3.8.1-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/scene/index.d.ts +6 -2
- package/lib/core/scene/index.js +30 -6
- package/lib/plugin/rtc/electron/client.js +1 -1
- package/lib/plugin/rtc/electron/source-manager.js +1 -1
- package/lib/plugin/rtc/electron/utils.d.ts +1 -1
- package/lib/plugin/rtc/electron/utils.js +25 -1
- package/lib/plugin/rtc/web/client.js +1 -1
- package/package.json +3 -4
|
@@ -5,13 +5,13 @@ import { AgoraRteStreamPlayer } from './stream-player';
|
|
|
5
5
|
import { AgoraRteLocalUser } from './local-user';
|
|
6
6
|
import { AgoraRteServiceApi } from '../services/api';
|
|
7
7
|
import { AgoraObservable, AgoraRteError } from '../../imports';
|
|
8
|
-
import { AgoraRtcMediaSourceState, AgoraRtcScreenCaptureType } from '../rtc/type';
|
|
8
|
+
import { AgoraRtcMediaSourceState, AgoraRtcScreenCaptureType, AgoraRtcVideoSourceType } from '../rtc/type';
|
|
9
9
|
export declare class AgoraRteScene {
|
|
10
10
|
protected logger: import("agora-foundation/lib/logger/type").Logger;
|
|
11
11
|
protected readonly observable: AgoraObservable<Partial<{
|
|
12
12
|
onJoinSceneSuccess(sceneId: string, localUser: AgoraRteLocalUser, streamPlayer: AgoraRteStreamPlayer): void;
|
|
13
13
|
onJoinSceneFailure(sceneId: string, error: AgoraRteError): void;
|
|
14
|
-
onSceneMessageReceived(sceneId: string, message: import("
|
|
14
|
+
onSceneMessageReceived(sceneId: string, message: import("../../type").AgoraRteMessage): void;
|
|
15
15
|
onScenePropertiesUpdated(sceneId: string, event: import("./type").AgoraRteScenePropertiesUpdatedEvent): void;
|
|
16
16
|
onScenePropertiesDeleted(sceneId: string, event: import("./type").AgoraRteScenePropertiesDeletedEvent): void;
|
|
17
17
|
onUserPropertiesUpdated(sceneId: string, event: AgoraRteUserPropertiesUpdatedEvent): void;
|
|
@@ -45,6 +45,7 @@ export declare class AgoraRteScene {
|
|
|
45
45
|
private _stateSynchronizer?;
|
|
46
46
|
private _messageSynchronizer?;
|
|
47
47
|
private _messageHandlerObservers?;
|
|
48
|
+
private _screenStreamLabelMap;
|
|
48
49
|
private _streamPlayer?;
|
|
49
50
|
private _timestampGap;
|
|
50
51
|
private _totalUserCount;
|
|
@@ -122,6 +123,9 @@ export declare class AgoraRteScene {
|
|
|
122
123
|
*
|
|
123
124
|
*/
|
|
124
125
|
fetchUserList(params: AgoraRteUserPageParams): Promise<AgoraRteUserPageResponse>;
|
|
126
|
+
addLocalStreamLabels(streamId: string, labels: Map<string, any>): void;
|
|
127
|
+
removeLocalStreamLabel(streamId: string): void;
|
|
128
|
+
getLocalStreamSourceTypeFromStreamLabel(streamId: string): AgoraRtcVideoSourceType.CAMERA | AgoraRtcVideoSourceType.SCREEN;
|
|
125
129
|
/**
|
|
126
130
|
* Get all streams in scene, return as object
|
|
127
131
|
* @returns {Record<string, AgoraRteMediaStreamInfo[]>} all streams in scene
|
package/lib/core/scene/index.js
CHANGED
|
@@ -88,6 +88,7 @@ var _error2 = require("../utilities/error");
|
|
|
88
88
|
var _type2 = require("../rtc/type");
|
|
89
89
|
var _client = require("../services/client");
|
|
90
90
|
var _type3 = require("../rtm/type");
|
|
91
|
+
var _type4 = require("../../type");
|
|
91
92
|
var _AgoraRteScene;
|
|
92
93
|
var _initProto;
|
|
93
94
|
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; } } }; }
|
|
@@ -115,6 +116,8 @@ var AgoraRteScene = exports.AgoraRteScene = /*#__PURE__*/function () {
|
|
|
115
116
|
prefix: 'AgoraRteScene'
|
|
116
117
|
})));
|
|
117
118
|
(0, _defineProperty2["default"])(this, "observable", new _imports.AgoraObservable());
|
|
119
|
+
// key is streamId, value is label
|
|
120
|
+
(0, _defineProperty2["default"])(this, "_screenStreamLabelMap", new Map());
|
|
118
121
|
(0, _defineProperty2["default"])(this, "_timestampGap", 0);
|
|
119
122
|
(0, _defineProperty2["default"])(this, "_totalUserCount", 0);
|
|
120
123
|
(0, _defineProperty2["default"])(this, "_joinSuccess", false);
|
|
@@ -576,12 +579,31 @@ var AgoraRteScene = exports.AgoraRteScene = /*#__PURE__*/function () {
|
|
|
576
579
|
return _fetchUserList.apply(this, arguments);
|
|
577
580
|
}
|
|
578
581
|
return fetchUserList;
|
|
579
|
-
}()
|
|
582
|
+
}())
|
|
583
|
+
}, {
|
|
584
|
+
key: "addLocalStreamLabels",
|
|
585
|
+
value: function addLocalStreamLabels(streamId, labels) {
|
|
586
|
+
this._screenStreamLabelMap.set(streamId, labels);
|
|
587
|
+
}
|
|
588
|
+
}, {
|
|
589
|
+
key: "removeLocalStreamLabel",
|
|
590
|
+
value: function removeLocalStreamLabel(streamId) {
|
|
591
|
+
this._screenStreamLabelMap["delete"](streamId);
|
|
592
|
+
}
|
|
593
|
+
}, {
|
|
594
|
+
key: "getLocalStreamSourceTypeFromStreamLabel",
|
|
595
|
+
value: function getLocalStreamSourceTypeFromStreamLabel(streamId) {
|
|
596
|
+
var label = this._screenStreamLabelMap.get(streamId);
|
|
597
|
+
if ((label === null || label === void 0 ? void 0 : label.get('localSourceType')) === 'screen') {
|
|
598
|
+
return _type4.AgoraRteVideoSourceType.SCREEN;
|
|
599
|
+
}
|
|
600
|
+
return _type4.AgoraRteVideoSourceType.CAMERA;
|
|
601
|
+
}
|
|
602
|
+
|
|
580
603
|
/**
|
|
581
604
|
* Get all streams in scene, return as object
|
|
582
605
|
* @returns {Record<string, AgoraRteMediaStreamInfo[]>} all streams in scene
|
|
583
606
|
*/
|
|
584
|
-
)
|
|
585
607
|
}, {
|
|
586
608
|
key: "getStreams",
|
|
587
609
|
value: function getStreams() {
|
|
@@ -1116,7 +1138,7 @@ var AgoraRteScene = exports.AgoraRteScene = /*#__PURE__*/function () {
|
|
|
1116
1138
|
var _this7 = this;
|
|
1117
1139
|
streams.forEach(/*#__PURE__*/function () {
|
|
1118
1140
|
var _ref9 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee12(stream) {
|
|
1119
|
-
var streamToken, shouldPublishAudio, shouldPublishVideo, _this7$_rtcMainChanne, _this7$rtcMainChannel, _this7$_rtcMainChanne2, _this7$rtcMainChannel2, observer;
|
|
1141
|
+
var streamToken, shouldPublishAudio, shouldPublishVideo, sourceType, _this7$_rtcMainChanne, _this7$rtcMainChannel, _this7$_rtcMainChanne2, _this7$rtcMainChannel2, observer;
|
|
1120
1142
|
return _regenerator["default"].wrap(function (_context12) {
|
|
1121
1143
|
while (1) switch (_context12.prev = _context12.next) {
|
|
1122
1144
|
case 0:
|
|
@@ -1124,10 +1146,11 @@ var AgoraRteScene = exports.AgoraRteScene = /*#__PURE__*/function () {
|
|
|
1124
1146
|
streamToken = _this7.localUser.getStreamTokenByStreamId(stream.streamId);
|
|
1125
1147
|
shouldPublishAudio = stream.streamType === _type.AgoraRteMediaStreamType.BOTH || stream.streamType === _type.AgoraRteMediaStreamType.AUDIO;
|
|
1126
1148
|
shouldPublishVideo = stream.streamType === _type.AgoraRteMediaStreamType.BOTH || stream.streamType === _type.AgoraRteMediaStreamType.VIDEO;
|
|
1149
|
+
sourceType = _this7.getLocalStreamSourceTypeFromStreamLabel(stream.streamId);
|
|
1127
1150
|
if (shouldPublishVideo) {
|
|
1128
|
-
(_this7$_rtcMainChanne = _this7._rtcMainChannelClient) === null || _this7$_rtcMainChanne === void 0 || _this7$_rtcMainChanne.publisher.publishLocalVideoStream(streamToken, stream.streamId, stream.videoSourceId,
|
|
1151
|
+
(_this7$_rtcMainChanne = _this7._rtcMainChannelClient) === null || _this7$_rtcMainChanne === void 0 || _this7$_rtcMainChanne.publisher.publishLocalVideoStream(streamToken, stream.streamId, stream.videoSourceId, sourceType);
|
|
1129
1152
|
} else {
|
|
1130
|
-
(_this7$rtcMainChannel = _this7.rtcMainChannelClient) === null || _this7$rtcMainChannel === void 0 || _this7$rtcMainChannel.publisher.unpublishLocalVideoStream(stream.streamId,
|
|
1153
|
+
(_this7$rtcMainChannel = _this7.rtcMainChannelClient) === null || _this7$rtcMainChannel === void 0 || _this7$rtcMainChannel.publisher.unpublishLocalVideoStream(stream.streamId, sourceType);
|
|
1131
1154
|
}
|
|
1132
1155
|
if (shouldPublishAudio) {
|
|
1133
1156
|
(_this7$_rtcMainChanne2 = _this7._rtcMainChannelClient) === null || _this7$_rtcMainChanne2 === void 0 || _this7$_rtcMainChanne2.publisher.publishLocalAudioStream(streamToken, stream.streamId, stream.audioSourceId, stream.audioSourceType);
|
|
@@ -1145,7 +1168,7 @@ var AgoraRteScene = exports.AgoraRteScene = /*#__PURE__*/function () {
|
|
|
1145
1168
|
}
|
|
1146
1169
|
if (shouldPublishVideo) {
|
|
1147
1170
|
var _this7$_rtcMainChanne4;
|
|
1148
|
-
(_this7$_rtcMainChanne4 = _this7._rtcMainChannelClient) === null || _this7$_rtcMainChanne4 === void 0 || _this7$_rtcMainChanne4.publisher.publishLocalVideoStream(token, stream.streamId, stream.videoSourceId,
|
|
1171
|
+
(_this7$_rtcMainChanne4 = _this7._rtcMainChannelClient) === null || _this7$_rtcMainChanne4 === void 0 || _this7$_rtcMainChanne4.publisher.publishLocalVideoStream(token, stream.streamId, stream.videoSourceId, sourceType);
|
|
1149
1172
|
}
|
|
1150
1173
|
_this7.localUser.removeObserver(observer);
|
|
1151
1174
|
}
|
|
@@ -1737,6 +1760,7 @@ var AgoraRteScene = exports.AgoraRteScene = /*#__PURE__*/function () {
|
|
|
1737
1760
|
value: function _cleanup() {
|
|
1738
1761
|
var _this$_stateSynchroni3;
|
|
1739
1762
|
(_this$_stateSynchroni3 = this._stateSynchronizer) === null || _this$_stateSynchroni3 === void 0 || _this$_stateSynchroni3.stop();
|
|
1763
|
+
this._screenStreamLabelMap.clear();
|
|
1740
1764
|
this._stopDeviceStateSync();
|
|
1741
1765
|
this._localUser = undefined;
|
|
1742
1766
|
this._streamPlayer = undefined;
|
|
@@ -1164,7 +1164,7 @@ var AgoraRtcClientImpl = exports.AgoraRtcClientImpl = /*#__PURE__*/function (_Ag
|
|
|
1164
1164
|
newDevice = audioPlaybackDevices.find(function (device) {
|
|
1165
1165
|
return _this4._isValidDevice(device) && device.deviceId === deviceId;
|
|
1166
1166
|
});
|
|
1167
|
-
deviceInfoString = "".concat(newDevice === null || newDevice === void 0 ? void 0 : newDevice.deviceName, "
|
|
1167
|
+
deviceInfoString = "deviceName\uFF1A".concat(newDevice === null || newDevice === void 0 ? void 0 : newDevice.deviceName, " deviceId: ").concat(newDevice === null || newDevice === void 0 ? void 0 : newDevice.deviceId, ", vendorId: ").concat(newDevice === null || newDevice === void 0 ? void 0 : newDevice.vendorId, ", productId: ").concat(newDevice === null || newDevice === void 0 ? void 0 : newDevice.productId);
|
|
1168
1168
|
this.logger.info("[RtcClient] PlaybackDevices deviceInfoString: ".concat(deviceInfoString));
|
|
1169
1169
|
if (!(newDevice && newDevice.deviceId && newDevice.deviceName)) {
|
|
1170
1170
|
_context5.next = 2;
|
|
@@ -1082,7 +1082,7 @@ var AgoraRtcSourceManagerImpl = exports.AgoraRtcSourceManagerImpl = /*#__PURE__*
|
|
|
1082
1082
|
productId: device.productId
|
|
1083
1083
|
};
|
|
1084
1084
|
newMicList.set(device.deviceId, deviceInfo);
|
|
1085
|
-
var deviceInfoString = "".concat(deviceInfo.deviceName, "
|
|
1085
|
+
var deviceInfoString = "deviceName\uFF1A".concat(deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.deviceName, " deviceId: ").concat(deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.deviceId, ", vendorId: ").concat(deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.vendorId, ", productId: ").concat(deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.productId);
|
|
1086
1086
|
_this1.logger.info("[RtcClient] RecordingDevices deviceInfoString: ".concat(deviceInfoString));
|
|
1087
1087
|
}
|
|
1088
1088
|
});
|
|
@@ -31,7 +31,7 @@ export declare const convertCameraSourceTypeToPublishConfig: (sourceType: VideoS
|
|
|
31
31
|
/**
|
|
32
32
|
* 摄像头视频源类型列表
|
|
33
33
|
*/
|
|
34
|
-
export declare const cameraVideoSourceTypes: readonly [
|
|
34
|
+
export declare const cameraVideoSourceTypes: readonly [0, 1, 11, 12];
|
|
35
35
|
/**
|
|
36
36
|
* 比较两个设备信息 Map,返回新增和移除的设备列表
|
|
37
37
|
* @param oldMap - 旧设备信息 Map
|
|
@@ -347,7 +347,30 @@ var startVideoRender = exports.startVideoRender = function startVideoRender(_ref
|
|
|
347
347
|
}
|
|
348
348
|
return rtcEngine.setRemoteRenderModeEx(Number(sourceId), renderModeType, mirrorModeType, connection);
|
|
349
349
|
} else {
|
|
350
|
-
|
|
350
|
+
// 使用此API会更新所有本地视图,谨慎使用
|
|
351
|
+
// return rtcEngine.setLocalRenderMode(
|
|
352
|
+
// renderModeType,
|
|
353
|
+
// 2 satisfies VideoMirrorModeType.VideoMirrorModeDisabled,
|
|
354
|
+
// );
|
|
355
|
+
|
|
356
|
+
var vst;
|
|
357
|
+
if (sourceType === _type.AgoraRtcRenderSourceType.LOCAL_SCREEN) {
|
|
358
|
+
vst = 2;
|
|
359
|
+
} else {
|
|
360
|
+
var sourceIndex = sourceManager.getCameraSourceIndex(sourceId);
|
|
361
|
+
if (sourceIndex === -1) {
|
|
362
|
+
logger.warn("Invalid source index for sourceId: ".concat(sourceId));
|
|
363
|
+
return _constant.AgoraRtcErrorCode.SOURCE_INDEX_IS_NOT_VALID;
|
|
364
|
+
}
|
|
365
|
+
vst = convertSourceIndexToSourceType(sourceIndex);
|
|
366
|
+
}
|
|
367
|
+
return rtcEngine.setupLocalVideo({
|
|
368
|
+
view: placementRef,
|
|
369
|
+
setupMode: 0,
|
|
370
|
+
sourceType: vst,
|
|
371
|
+
renderMode: renderModeType,
|
|
372
|
+
mirrorMode: mirrorModeType
|
|
373
|
+
});
|
|
351
374
|
}
|
|
352
375
|
}
|
|
353
376
|
case _type.AgoraRtcRenderResultType.ADD:
|
|
@@ -365,6 +388,7 @@ var startVideoRender = exports.startVideoRender = function startVideoRender(_ref
|
|
|
365
388
|
return _constant.AgoraRtcErrorCode.PLACEMENT_IS_NOT_RENDERED;
|
|
366
389
|
}
|
|
367
390
|
canvasTagPool.ifNeedStopRenderCanvas(view);
|
|
391
|
+
// 创建新的 placementRef 之前的 placementRef不需要先删除吗?
|
|
368
392
|
placementRef = createVideoRendererPlacement(view);
|
|
369
393
|
canvas = createCanvasAndAddTag(view, sourceId, placementRef, renderMode, isMirror, sourceType, canvasTagPool, connection);
|
|
370
394
|
return addRenderer();
|
|
@@ -105,7 +105,7 @@ var AgoraRtcWebAdapterImp = exports.AgoraRtcWebAdapterImp = /*#__PURE__*/functio
|
|
|
105
105
|
(0, _classCallCheck2["default"])(this, AgoraRtcWebAdapterImp);
|
|
106
106
|
_this = _callSuper(this, AgoraRtcWebAdapterImp);
|
|
107
107
|
(0, _defineProperty2["default"])(_this, "logger", (_initProto(_this), (0, _logger.createLogger)({
|
|
108
|
-
prefix: '
|
|
108
|
+
prefix: 'AgoraRtcWebAdapterImpl'
|
|
109
109
|
})));
|
|
110
110
|
// @internal
|
|
111
111
|
(0, _defineProperty2["default"])(_this, "_cameraViewCanvasMap", new Map());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agora-rte-sdk",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.1-alpha",
|
|
4
4
|
"description": "SDK for building interactive scenarios",
|
|
5
5
|
"author": "agora.io",
|
|
6
6
|
"license": "ISC",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"lib"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"prepare": "husky",
|
|
14
13
|
"build": "agora-tc-transpile",
|
|
15
14
|
"test-browser": "agora-tc-test-karma-browser",
|
|
16
15
|
"test-electron": "agora-tc-test-karma-electron"
|
|
@@ -28,7 +27,7 @@
|
|
|
28
27
|
"@types/sinon": "^17.0.2",
|
|
29
28
|
"@types/ua-parser-js": "^0.7.35",
|
|
30
29
|
"agora-token": "^2.0.3",
|
|
31
|
-
"agora-toolchain": "3.8.
|
|
30
|
+
"agora-toolchain": "3.8.1-alpha",
|
|
32
31
|
"core-js": "^3.33.3",
|
|
33
32
|
"electron": "22.3.27",
|
|
34
33
|
"husky": "^9.0.11",
|
|
@@ -43,7 +42,7 @@
|
|
|
43
42
|
"agora-extension-ai-denoiser": "^1.0.0",
|
|
44
43
|
"agora-extension-beauty-effect": "^1.0.1-beta",
|
|
45
44
|
"agora-extension-virtual-background": "^2.1.0",
|
|
46
|
-
"agora-foundation": "3.8.
|
|
45
|
+
"agora-foundation": "3.8.1-alpha",
|
|
47
46
|
"agora-rtc-sdk-ng": "4.23.3",
|
|
48
47
|
"agora-rtm": "2.2.2-3",
|
|
49
48
|
"await-to-js": "^3.0.0",
|