agora-rte-sdk 3.8.1-alpha → 3.8.1
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/rtc/canvas.d.ts +1 -0
- package/lib/core/scene/index.d.ts +1 -1
- package/lib/core/scene/index.js +7 -3
- package/lib/plugin/rtc/electron/canvas-tag-pool.d.ts +1 -0
- package/lib/plugin/rtc/electron/canvas-tag-pool.js +27 -3
- package/lib/plugin/rtc/electron/client.js +1 -1
- package/lib/plugin/rtc/electron/source-state-control/camera-state-control.js +2 -2
- package/package.json +4 -3
package/lib/core/rtc/canvas.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export declare abstract class AgoraRtcCanvasTagPool {
|
|
|
32
32
|
abstract getTagWithCanvasId(canvasAddress: AgoraRteRenderView): AgoraRtcCanvasTag | undefined;
|
|
33
33
|
abstract addTagWithCanvasId(canvasAddress: AgoraRteRenderView, sourceId: string, canvas: AgoraRtcVideoCanvas, isLocal: boolean, connection?: AgoraRtcConnection): void;
|
|
34
34
|
abstract ifNeedStopRenderCanvas(canvasAddress: AgoraRteRenderView): void;
|
|
35
|
+
abstract ifNeedStopLocalRenderCanvas(canvasAddress: AgoraRteRenderView): void;
|
|
35
36
|
abstract stopRenderOnAllCanvasWithSourceId(sourceId: string): void;
|
|
36
37
|
/**
|
|
37
38
|
* 获取画布标签池
|
|
@@ -125,7 +125,7 @@ export declare class AgoraRteScene {
|
|
|
125
125
|
fetchUserList(params: AgoraRteUserPageParams): Promise<AgoraRteUserPageResponse>;
|
|
126
126
|
addLocalStreamLabels(streamId: string, labels: Map<string, any>): void;
|
|
127
127
|
removeLocalStreamLabel(streamId: string): void;
|
|
128
|
-
getLocalStreamSourceTypeFromStreamLabel(streamId: string): AgoraRtcVideoSourceType.CAMERA | AgoraRtcVideoSourceType.SCREEN;
|
|
128
|
+
getLocalStreamSourceTypeFromStreamLabel(streamId: string): AgoraRtcVideoSourceType.CAMERA | AgoraRtcVideoSourceType.SCREEN | undefined;
|
|
129
129
|
/**
|
|
130
130
|
* Get all streams in scene, return as object
|
|
131
131
|
* @returns {Record<string, AgoraRteMediaStreamInfo[]>} all streams in scene
|
package/lib/core/scene/index.js
CHANGED
|
@@ -597,7 +597,10 @@ var AgoraRteScene = exports.AgoraRteScene = /*#__PURE__*/function () {
|
|
|
597
597
|
if ((label === null || label === void 0 ? void 0 : label.get('localSourceType')) === 'screen') {
|
|
598
598
|
return _type4.AgoraRteVideoSourceType.SCREEN;
|
|
599
599
|
}
|
|
600
|
-
|
|
600
|
+
if ((label === null || label === void 0 ? void 0 : label.get('localSourceType')) === 'camera') {
|
|
601
|
+
return _type4.AgoraRteVideoSourceType.CAMERA;
|
|
602
|
+
}
|
|
603
|
+
return undefined;
|
|
601
604
|
}
|
|
602
605
|
|
|
603
606
|
/**
|
|
@@ -1138,7 +1141,7 @@ var AgoraRteScene = exports.AgoraRteScene = /*#__PURE__*/function () {
|
|
|
1138
1141
|
var _this7 = this;
|
|
1139
1142
|
streams.forEach(/*#__PURE__*/function () {
|
|
1140
1143
|
var _ref9 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee12(stream) {
|
|
1141
|
-
var streamToken, shouldPublishAudio, shouldPublishVideo, sourceType, _this7$_rtcMainChanne, _this7$rtcMainChannel, _this7$_rtcMainChanne2, _this7$rtcMainChannel2, observer;
|
|
1144
|
+
var streamToken, shouldPublishAudio, shouldPublishVideo, localLabelSourceType, sourceType, _this7$_rtcMainChanne, _this7$rtcMainChannel, _this7$_rtcMainChanne2, _this7$rtcMainChannel2, observer;
|
|
1142
1145
|
return _regenerator["default"].wrap(function (_context12) {
|
|
1143
1146
|
while (1) switch (_context12.prev = _context12.next) {
|
|
1144
1147
|
case 0:
|
|
@@ -1146,7 +1149,8 @@ var AgoraRteScene = exports.AgoraRteScene = /*#__PURE__*/function () {
|
|
|
1146
1149
|
streamToken = _this7.localUser.getStreamTokenByStreamId(stream.streamId);
|
|
1147
1150
|
shouldPublishAudio = stream.streamType === _type.AgoraRteMediaStreamType.BOTH || stream.streamType === _type.AgoraRteMediaStreamType.AUDIO;
|
|
1148
1151
|
shouldPublishVideo = stream.streamType === _type.AgoraRteMediaStreamType.BOTH || stream.streamType === _type.AgoraRteMediaStreamType.VIDEO;
|
|
1149
|
-
|
|
1152
|
+
localLabelSourceType = _this7.getLocalStreamSourceTypeFromStreamLabel(stream.streamId);
|
|
1153
|
+
sourceType = localLabelSourceType !== null && localLabelSourceType !== void 0 ? localLabelSourceType : stream.videoSourceType;
|
|
1150
1154
|
if (shouldPublishVideo) {
|
|
1151
1155
|
(_this7$_rtcMainChanne = _this7._rtcMainChannelClient) === null || _this7$_rtcMainChanne === void 0 || _this7$_rtcMainChanne.publisher.publishLocalVideoStream(streamToken, stream.streamId, stream.videoSourceId, sourceType);
|
|
1152
1156
|
} else {
|
|
@@ -39,6 +39,7 @@ export declare class AgoraRtcCanvasTagPoolImpl extends AgoraRtcCanvasTagPool {
|
|
|
39
39
|
* @param rtcEngine - RTC引擎实例
|
|
40
40
|
*/
|
|
41
41
|
ifNeedStopRenderCanvas(canvasAddress: AgoraRteRenderView): void;
|
|
42
|
+
ifNeedStopLocalRenderCanvas(canvasAddress: AgoraRteRenderView): void;
|
|
42
43
|
/**
|
|
43
44
|
* 停止所有指定源ID的画布渲染
|
|
44
45
|
* @param sourceId - 源ID
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
require("core-js/modules/es.symbol.js");
|
|
4
4
|
require("core-js/modules/es.symbol.description.js");
|
|
5
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
6
|
require("core-js/modules/es.array.is-array.js");
|
|
9
7
|
require("core-js/modules/es.array.push.js");
|
|
10
8
|
require("core-js/modules/es.date.to-primitive.js");
|
|
@@ -24,6 +22,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
24
22
|
value: true
|
|
25
23
|
});
|
|
26
24
|
exports.AgoraRtcCanvasTagPoolImpl = void 0;
|
|
25
|
+
require("core-js/modules/es.error.cause.js");
|
|
26
|
+
require("core-js/modules/es.error.to-string.js");
|
|
27
27
|
require("core-js/modules/es.array.filter.js");
|
|
28
28
|
require("core-js/modules/es.array.for-each.js");
|
|
29
29
|
require("core-js/modules/es.array.from.js");
|
|
@@ -146,6 +146,30 @@ var AgoraRtcCanvasTagPoolImpl = exports.AgoraRtcCanvasTagPoolImpl = /*#__PURE__*
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
// 新增了这个方法,用于停止本地渲染,
|
|
150
|
+
// 有部分客户在停止摄像头预览时,会传入远程画布地址
|
|
151
|
+
// 导致远端也停止渲染,所以需要新增这个方法来停止本地渲染。
|
|
152
|
+
}, {
|
|
153
|
+
key: "ifNeedStopLocalRenderCanvas",
|
|
154
|
+
value: function ifNeedStopLocalRenderCanvas(canvasAddress) {
|
|
155
|
+
var canvasTag = this._canvasTagPool.get(canvasAddress);
|
|
156
|
+
if (!canvasTag) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (!canvasTag.isLocal) {
|
|
160
|
+
this.logger.error('Remote canvas should not be stopped');
|
|
161
|
+
throw new Error('Remote canvas should not be stopped');
|
|
162
|
+
}
|
|
163
|
+
try {
|
|
164
|
+
if (!canvasTag.connection) {
|
|
165
|
+
this._stopLocalRender(canvasTag);
|
|
166
|
+
this._cleanupCanvas(canvasAddress);
|
|
167
|
+
}
|
|
168
|
+
} catch (error) {
|
|
169
|
+
this.logger.error('Error stopping render canvas:', error);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
149
173
|
/**
|
|
150
174
|
* 停止所有指定源ID的画布渲染
|
|
151
175
|
* @param sourceId - 源ID
|
|
@@ -360,7 +384,7 @@ var AgoraRtcCanvasTagPoolImpl = exports.AgoraRtcCanvasTagPoolImpl = /*#__PURE__*
|
|
|
360
384
|
}]);
|
|
361
385
|
}(_canvas.AgoraRtcCanvasTagPool);
|
|
362
386
|
_AgoraRtcCanvasTagPoolImpl = AgoraRtcCanvasTagPoolImpl;
|
|
363
|
-
var _applyDecs$e = _applyDecs(_AgoraRtcCanvasTagPoolImpl, [[_imports.trace, 2, "release"], [_imports.trace, 2, "addTagWithCanvasId"], [_imports.trace, 2, "ifNeedStopRenderCanvas"], [_imports.trace, 2, "stopRenderOnAllCanvasWithSourceId"], [_imports.trace, 2, "_isLastLocalCanvas"]], [], 0, void 0, _canvas.AgoraRtcCanvasTagPool).e;
|
|
387
|
+
var _applyDecs$e = _applyDecs(_AgoraRtcCanvasTagPoolImpl, [[_imports.trace, 2, "release"], [_imports.trace, 2, "addTagWithCanvasId"], [_imports.trace, 2, "ifNeedStopRenderCanvas"], [_imports.trace, 2, "ifNeedStopLocalRenderCanvas"], [_imports.trace, 2, "stopRenderOnAllCanvasWithSourceId"], [_imports.trace, 2, "_isLastLocalCanvas"]], [], 0, void 0, _canvas.AgoraRtcCanvasTagPool).e;
|
|
364
388
|
var _applyDecs$e2 = (0, _slicedToArray2["default"])(_applyDecs$e, 1);
|
|
365
389
|
_initProto = _applyDecs$e2[0];
|
|
366
390
|
_applyDecs$e;
|
|
@@ -382,7 +382,7 @@ var AgoraRtcClientImpl = exports.AgoraRtcClientImpl = /*#__PURE__*/function (_Ag
|
|
|
382
382
|
}, {
|
|
383
383
|
key: "stopRenderCameraPreview",
|
|
384
384
|
value: function stopRenderCameraPreview(deviceId, view) {
|
|
385
|
-
this.canvasTagPool.
|
|
385
|
+
this.canvasTagPool.ifNeedStopLocalRenderCanvas(view);
|
|
386
386
|
this.canvasHelper.unbind(view);
|
|
387
387
|
return 0;
|
|
388
388
|
}
|
|
@@ -84,7 +84,7 @@ var CameraStateControlImpl = exports.CameraStateControlImpl = /*#__PURE__*/funct
|
|
|
84
84
|
//@internal
|
|
85
85
|
(0, _defineProperty2["default"])(_this, "_cameraSourceIndexMapping", (_initProto(_this), new Map()));
|
|
86
86
|
//@internal
|
|
87
|
-
(0, _defineProperty2["default"])(_this, "_availableCameraSourceIndex", initAvailableCameraSourceIndex);
|
|
87
|
+
(0, _defineProperty2["default"])(_this, "_availableCameraSourceIndex", [].concat(initAvailableCameraSourceIndex));
|
|
88
88
|
return _this;
|
|
89
89
|
}
|
|
90
90
|
(0, _inherits2["default"])(CameraStateControlImpl, _SourceStateControlIm);
|
|
@@ -97,7 +97,7 @@ var CameraStateControlImpl = exports.CameraStateControlImpl = /*#__PURE__*/funct
|
|
|
97
97
|
key: "release",
|
|
98
98
|
value: function release() {
|
|
99
99
|
this._cameraSourceIndexMapping.clear();
|
|
100
|
-
this._availableCameraSourceIndex = initAvailableCameraSourceIndex;
|
|
100
|
+
this._availableCameraSourceIndex = [].concat(initAvailableCameraSourceIndex);
|
|
101
101
|
_superPropGet(CameraStateControlImpl, "release", this, 3)([]);
|
|
102
102
|
}
|
|
103
103
|
}, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agora-rte-sdk",
|
|
3
|
-
"version": "3.8.1
|
|
3
|
+
"version": "3.8.1",
|
|
4
4
|
"description": "SDK for building interactive scenarios",
|
|
5
5
|
"author": "agora.io",
|
|
6
6
|
"license": "ISC",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"lib"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
+
"prepare": "husky",
|
|
13
14
|
"build": "agora-tc-transpile",
|
|
14
15
|
"test-browser": "agora-tc-test-karma-browser",
|
|
15
16
|
"test-electron": "agora-tc-test-karma-electron"
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
"@types/sinon": "^17.0.2",
|
|
28
29
|
"@types/ua-parser-js": "^0.7.35",
|
|
29
30
|
"agora-token": "^2.0.3",
|
|
30
|
-
"agora-toolchain": "3.8.1
|
|
31
|
+
"agora-toolchain": "3.8.1",
|
|
31
32
|
"core-js": "^3.33.3",
|
|
32
33
|
"electron": "22.3.27",
|
|
33
34
|
"husky": "^9.0.11",
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
"agora-extension-ai-denoiser": "^1.0.0",
|
|
43
44
|
"agora-extension-beauty-effect": "^1.0.1-beta",
|
|
44
45
|
"agora-extension-virtual-background": "^2.1.0",
|
|
45
|
-
"agora-foundation": "3.8.1
|
|
46
|
+
"agora-foundation": "3.8.1",
|
|
46
47
|
"agora-rtc-sdk-ng": "4.23.3",
|
|
47
48
|
"agora-rtm": "2.2.2-3",
|
|
48
49
|
"await-to-js": "^3.0.0",
|