fcr-core 3.7.8 → 3.8.0-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/chat-connection/index.d.ts +1 -1
- package/lib/engine/index.js +6 -5
- package/lib/imports.d.ts +7 -2
- package/lib/imports.js +25 -4
- package/lib/index.d.ts +2 -2
- package/lib/index.js +12 -0
- package/lib/media-control/desktop.js +4 -4
- package/lib/media-control/mobile.js +20 -20
- package/lib/media-control/type.d.ts +8 -0
- package/lib/plugins/chatroom.js +19 -3
- package/lib/room-control/ability-control/type.d.ts +4 -1
- package/lib/room-control/ability-control/type.js +3 -0
- package/lib/room-control/helpers/constants.d.ts +4 -0
- package/lib/room-control/helpers/constants.js +5 -1
- package/lib/room-control/index.js +16 -5
- package/lib/room-control/interpreter-control/index.js +2 -4
- package/lib/room-control/mainroom-control/index.js +66 -1
- package/lib/room-control/privilege-control/index.js +43 -3
- package/lib/room-control/privilege-control/type.d.ts +57 -10
- package/lib/room-control/privilege-control/type.js +17 -0
- package/lib/room-control/room-control-factory.js +1 -1
- package/lib/room-control/room-session/index.js +23 -13
- package/lib/room-control/room-session/type.d.ts +2 -2
- package/lib/room-control/sharing-control/index.d.ts +5 -5
- package/lib/room-control/sharing-control/index.js +43 -13
- package/lib/room-control/sharing-control/type.d.ts +9 -5
- package/lib/room-control/sharing-control/type.js +6 -1
- package/lib/room-control/stream-control/index.d.ts +8 -1
- package/lib/room-control/stream-control/index.js +139 -36
- package/lib/room-control/stream-control/type.d.ts +6 -0
- package/lib/room-control/stt-control/de-compress-gzip.d.ts +1 -0
- package/lib/room-control/stt-control/de-compress-gzip.js +49 -0
- package/lib/room-control/stt-control/index.d.ts +1 -0
- package/lib/room-control/stt-control/index.js +353 -0
- package/lib/room-control/stt-control/type.d.ts +142 -0
- package/lib/room-control/stt-control/type.js +16 -0
- package/lib/room-control/type.d.ts +15 -0
- package/lib/room-control/type.js +13 -1
- package/lib/room-control/whiteboard-control/enum.d.ts +15 -0
- package/lib/room-control/whiteboard-control/{types.js → enum.js} +12 -1
- package/lib/room-control/whiteboard-control/type.d.ts +38 -0
- package/lib/room-control/whiteboard-control/type.js +15 -0
- package/lib/room-control/whiteboard-control/utils.d.ts +3 -0
- package/lib/room-control/whiteboard-control/utils.js +23 -0
- package/lib/room-control/whiteboard-control-v1/board-subwindow.d.ts +6 -0
- package/lib/room-control/whiteboard-control-v1/board-subwindow.js +26 -0
- package/lib/room-control/whiteboard-control-v1/board-window.d.ts +58 -0
- package/lib/room-control/whiteboard-control-v1/board-window.js +571 -0
- package/lib/room-control/{whiteboard-control/enums.d.ts → whiteboard-control-v1/enum.d.ts} +3 -17
- package/lib/room-control/{whiteboard-control/enums.js → whiteboard-control-v1/enum.js} +3 -20
- package/lib/room-control/whiteboard-control-v1/factory.d.ts +9 -0
- package/lib/room-control/whiteboard-control-v1/factory.js +22 -0
- package/lib/room-control/whiteboard-control-v1/index.d.ts +1 -0
- package/lib/room-control/whiteboard-control-v1/index.js +440 -0
- package/lib/room-control/whiteboard-control-v1/mount-manager.d.ts +4 -0
- package/lib/room-control/whiteboard-control-v1/mount-manager.js +15 -0
- package/lib/room-control/whiteboard-control-v1/type.d.ts +300 -0
- package/lib/room-control/whiteboard-control-v1/type.js +13 -0
- package/lib/room-control/whiteboard-control-v1/utils.d.ts +53 -0
- package/lib/room-control/whiteboard-control-v1/utils.js +290 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.d.ts +17 -31
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +39 -233
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.d.ts +10 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +48 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/type.d.ts +11 -19
- package/lib/room-control/whiteboard-control-v2/annotation-control/type.js +1 -3
- package/lib/room-control/whiteboard-control-v2/base/index.d.ts +42 -0
- package/lib/room-control/whiteboard-control-v2/base/index.js +317 -0
- package/lib/room-control/whiteboard-control-v2/{main-window.d.ts → base/main-window.d.ts} +6 -4
- package/lib/room-control/whiteboard-control-v2/{main-window.js → base/main-window.js} +31 -18
- package/lib/room-control/whiteboard-control-v2/constant.d.ts +6 -0
- package/lib/room-control/whiteboard-control-v2/constant.js +15 -0
- package/lib/room-control/whiteboard-control-v2/enum.d.ts +26 -0
- package/lib/room-control/whiteboard-control-v2/enum.js +34 -0
- package/lib/room-control/{whiteboard-control/types.d.ts → whiteboard-control-v2/type.d.ts} +51 -165
- package/lib/room-control/whiteboard-control-v2/type.js +5 -0
- package/lib/room-control/whiteboard-control-v2/utils.d.ts +5 -4
- package/lib/room-control/whiteboard-control-v2/utils.js +22 -21
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.d.ts +34 -33
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +124 -191
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.d.ts +11 -0
- package/lib/room-control/whiteboard-control-v2/{annotation-control/index.js → whiteboard-control/factory.js} +35 -44
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.d.ts +18 -30
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.js +1 -9
- package/lib/room-router/index.js +4 -0
- package/lib/schema.d.ts +23 -9
- package/lib/schema.js +10 -4
- package/lib/service/api.d.ts +75 -19
- package/lib/service/api.js +193 -24
- package/lib/type.d.ts +15 -2
- package/lib/type.js +13 -0
- package/lib/utilities/error-helpers.d.ts +2 -1
- package/lib/utilities/error-helpers.js +1 -0
- package/lib/utilities/error.d.ts +1 -0
- package/lib/utilities/error.js +1 -0
- package/lib/utilities/logger.d.ts +2 -2
- package/lib/utilities/shared-storage.d.ts +3 -1
- package/lib/utilities/shared-storage.js +9 -1
- package/package.json +11 -5
- package/lib/room-control/whiteboard-control-v2/annotation-control/index.d.ts +0 -19
- package/lib/room-control/whiteboard-control-v2/annotation-control/privilege-control.d.ts +0 -36
- package/lib/room-control/whiteboard-control-v2/annotation-control/privilege-control.js +0 -262
- package/lib/room-control/whiteboard-control-v2/index.d.ts +0 -38
- package/lib/room-control/whiteboard-control-v2/index.js +0 -286
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.d.ts +0 -17
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.js +0 -32
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/privilege-control.d.ts +0 -36
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/privilege-control.js +0 -252
|
@@ -8,8 +8,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", {
|
|
9
9
|
value: true
|
|
10
10
|
});
|
|
11
|
-
exports.FcrStreamControlImpl = void 0;
|
|
11
|
+
exports.FcrSubscribedStreamsControl = exports.FcrStreamControlImpl = void 0;
|
|
12
12
|
require("core-js/modules/es.array.push.js");
|
|
13
|
+
require("core-js/modules/es.json.stringify.js");
|
|
13
14
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
14
15
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
15
16
|
require("core-js/modules/esnext.iterator.find.js");
|
|
@@ -66,7 +67,7 @@ class FcrStreamControlImpl {
|
|
|
66
67
|
//@internal
|
|
67
68
|
(0, _defineProperty2.default)(this, "_streamList", []);
|
|
68
69
|
//@internal
|
|
69
|
-
(0, _defineProperty2.default)(this, "
|
|
70
|
+
(0, _defineProperty2.default)(this, "_subscribedStreamsControl", new FcrSubscribedStreamsControl());
|
|
70
71
|
//@internal
|
|
71
72
|
(0, _defineProperty2.default)(this, "_sceneObserver", {
|
|
72
73
|
onStreamsAdded: (sceneId, events) => {
|
|
@@ -229,8 +230,8 @@ class FcrStreamControlImpl {
|
|
|
229
230
|
return this._convertStreamInfo(streamInfo);
|
|
230
231
|
}
|
|
231
232
|
}
|
|
232
|
-
addLocalStreams(streams) {
|
|
233
|
-
|
|
233
|
+
async addLocalStreams(streams) {
|
|
234
|
+
const streamCreateResult = await (0, _error.handleRequestError)(() => this._api.createStreamBatch(this._scene.sceneId, streams.map(config => {
|
|
234
235
|
var _config$generateToken;
|
|
235
236
|
return _objectSpread({
|
|
236
237
|
streamName: config.streamName,
|
|
@@ -244,6 +245,37 @@ class FcrStreamControlImpl {
|
|
|
244
245
|
audioSourceUuid: config.audioSourceId
|
|
245
246
|
}, (0, _imports.convertStreamTypeToPublishState)(config.streamType));
|
|
246
247
|
})), _error.FcrErrorModuleCode.ROOM_STREAM, 'add local streams failed');
|
|
248
|
+
|
|
249
|
+
// 处理需要 token 的流
|
|
250
|
+
this._handleStreamTokensPreparation(streams, streamCreateResult.data);
|
|
251
|
+
return streamCreateResult;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* 处理流的 token 准备工作
|
|
256
|
+
* @param streams 流配置列表
|
|
257
|
+
*/
|
|
258
|
+
_handleStreamTokensPreparation(streams, streamCreateResultData) {
|
|
259
|
+
// 提前过滤出需要 token
|
|
260
|
+
const streamConfigMap = new Map();
|
|
261
|
+
streams.forEach(config => {
|
|
262
|
+
const needsToken = config.generateToken || config.videoSourceType === _imports.AgoraRteVideoSourceType.SCREEN;
|
|
263
|
+
if (needsToken) {
|
|
264
|
+
streamConfigMap.set(config.ownerId, config);
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
// 如果没有需要 token 的流,直接返回
|
|
269
|
+
if (streamConfigMap.size === 0) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// 遍历返回的流数据,准备发布流
|
|
274
|
+
streamCreateResultData.forEach(stream => {
|
|
275
|
+
if (stream.rtcToken && streamConfigMap.has(stream.userUuid)) {
|
|
276
|
+
this._scene.localUser.prepareToPublishStream(stream.streamUuid, stream.rtcToken);
|
|
277
|
+
}
|
|
278
|
+
});
|
|
247
279
|
}
|
|
248
280
|
bindLocalStreams(streams) {
|
|
249
281
|
return this._scene.localUser.bindLocalStreams(streams);
|
|
@@ -285,49 +317,54 @@ class FcrStreamControlImpl {
|
|
|
285
317
|
}), _error.FcrErrorModuleCode.ROOM_STREAM, 'update publish privilege of streams failed');
|
|
286
318
|
}
|
|
287
319
|
}
|
|
288
|
-
removeStreams(streams) {
|
|
289
|
-
|
|
320
|
+
async removeStreams(streams) {
|
|
321
|
+
const res = await (0, _error.handleRequestError)(() => this._api.deleteStreamBatch(this._scene.sceneId, streams.map(streamUuid => ({
|
|
290
322
|
streamUuid
|
|
291
323
|
}))), _error.FcrErrorModuleCode.ROOM_STREAM, 'remove streams failed');
|
|
324
|
+
streams.forEach(streamUuid => {
|
|
325
|
+
this._scene.localUser.removePreparePublishStream(streamUuid);
|
|
326
|
+
});
|
|
327
|
+
return res;
|
|
292
328
|
}
|
|
293
329
|
setVideoEncoderConfig(streamId, config, streamType) {
|
|
294
330
|
return this._scene.localUser.setVideoEncoderConfig(config, streamType, streamId);
|
|
295
331
|
}
|
|
332
|
+
setDualStreamMode(streamId, enable) {
|
|
333
|
+
return this._scene.localUser.setDualStreamMode(streamId, enable);
|
|
334
|
+
}
|
|
296
335
|
setScreenScenario(type) {
|
|
297
336
|
return this._scene.localUser.setScreenScenario(type);
|
|
298
337
|
}
|
|
299
338
|
startRenderRemoteVideoStream(streamId, type, config, element) {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
// 当 startRender 相同的 streamId 时且 canvasId 不同时,计数加一
|
|
303
|
-
// 引用计数大于0时,不再调用 subscribeRemoteVideoStream;
|
|
304
|
-
|
|
305
|
-
const elements = this._remoteSubscribedStreamRenderMap.get(streamId) || [];
|
|
306
|
-
const renderCount = elements.length;
|
|
307
|
-
const isDifferentCanvas = !(elements !== null && elements !== void 0 && elements.includes(element));
|
|
308
|
-
if (renderCount === 0 || isDifferentCanvas) {
|
|
309
|
-
var _this$_remoteSubscrib;
|
|
310
|
-
this._remoteSubscribedStreamRenderMap.set(streamId, [...elements, element]);
|
|
311
|
-
this.logger.info("[FcrStreamControl][subscribe-remote-video-stream] start subscribe streamId: ".concat(streamId, ", before subscribe renderCount: ").concat(renderCount, ", after subscribe renderCount: ").concat((_this$_remoteSubscrib = this._remoteSubscribedStreamRenderMap.get(streamId)) === null || _this$_remoteSubscrib === void 0 ? void 0 : _this$_remoteSubscrib.length));
|
|
312
|
-
}
|
|
339
|
+
const startTime = Date.now();
|
|
340
|
+
const parameters = "streamId: ".concat(streamId, ", config: ").concat(JSON.stringify(config), ", type: ").concat(type, ", element: ").concat(element);
|
|
313
341
|
this._scene.streamPlayer.subscribeRemoteVideoStream(streamId, type);
|
|
314
|
-
|
|
342
|
+
try {
|
|
343
|
+
this._scene.streamPlayer.startRenderRemoteVideoStream(streamId, config.renderMode, config.isMirror, element);
|
|
344
|
+
const viewId = this._subscribedStreamsControl.getViewId(element);
|
|
345
|
+
this._subscribedStreamsControl.bind(viewId, streamId);
|
|
346
|
+
} catch (error) {
|
|
347
|
+
this.logger.error("[FcrStreamControl][start-render-remote-video-stream] render failed, streamId: ".concat(streamId, ", error: ").concat(error, ", parameters: ").concat(parameters, ", duration: ").concat(Date.now() - startTime, "ms"));
|
|
348
|
+
throw error;
|
|
349
|
+
}
|
|
315
350
|
}
|
|
316
351
|
stopRenderRemoteVideoStream(streamId, element) {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
this.
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
352
|
+
const startTime = Date.now();
|
|
353
|
+
const parameters = "streamId: ".concat(streamId, ", element: ").concat(element);
|
|
354
|
+
try {
|
|
355
|
+
this._scene.streamPlayer.stopRenderRemoteVideoStream(streamId, element);
|
|
356
|
+
const viewId = this._subscribedStreamsControl.getViewId(element);
|
|
357
|
+
this._subscribedStreamsControl.unbind(viewId, streamId);
|
|
358
|
+
const shouldUnsubscribe = this._subscribedStreamsControl.isEmpty(streamId);
|
|
359
|
+
if (shouldUnsubscribe) {
|
|
360
|
+
this._scene.streamPlayer.unsubscribeRemoteVideoStream(streamId);
|
|
361
|
+
} else {
|
|
362
|
+
this.logger.info("[FcrStreamControl][unsubscribe-remote-video-stream] still has other views, do not unsubscribe, streamId: ".concat(streamId, ", parameters: ").concat(parameters, ", duration: ").concat(Date.now() - startTime, "ms"));
|
|
363
|
+
}
|
|
364
|
+
} catch (error) {
|
|
365
|
+
this.logger.error("[FcrStreamControl][stop-render-remote-video-stream] stop render failed, streamId: ".concat(streamId, ", error: ").concat(error, ", parameters: ").concat(parameters, ", duration: ").concat(Date.now() - startTime, "ms"));
|
|
366
|
+
throw error;
|
|
329
367
|
}
|
|
330
|
-
this._scene.streamPlayer.stopRenderRemoteVideoStream(streamId, element);
|
|
331
368
|
}
|
|
332
369
|
startPlayRemoteAudioStream(streamId) {
|
|
333
370
|
this._scene.streamPlayer.startPlayRemoteAudioStream(streamId);
|
|
@@ -370,7 +407,7 @@ class FcrStreamControlImpl {
|
|
|
370
407
|
}
|
|
371
408
|
} = res;
|
|
372
409
|
this._screenStreamId = streamId;
|
|
373
|
-
this._scene.localUser.
|
|
410
|
+
this._scene.localUser.prepareToPublishStream(streamId, token);
|
|
374
411
|
return streamId;
|
|
375
412
|
}
|
|
376
413
|
async removeScreenStream() {
|
|
@@ -381,7 +418,7 @@ class FcrStreamControlImpl {
|
|
|
381
418
|
});
|
|
382
419
|
}, _error.FcrErrorModuleCode.ROOM_STREAM, 'remove screen stream failed');
|
|
383
420
|
if (this._screenStreamId) {
|
|
384
|
-
this._scene.localUser.
|
|
421
|
+
this._scene.localUser.removePreparePublishStream(this._screenStreamId);
|
|
385
422
|
}
|
|
386
423
|
return res;
|
|
387
424
|
}
|
|
@@ -437,4 +474,70 @@ class FcrStreamControlImpl {
|
|
|
437
474
|
}
|
|
438
475
|
exports.FcrStreamControlImpl = FcrStreamControlImpl;
|
|
439
476
|
_FcrStreamControlImpl = FcrStreamControlImpl;
|
|
440
|
-
[_initProto] = _applyDecs(_FcrStreamControlImpl, [[_imports.bound, 2, "getStreams"], [_imports.bound, 2, "getStreamList"], [_imports.bound, 2, "getStreamsByUserId"], [_imports.bound, 2, "getStreamByStreamId"], [_addLocalStreamsDecs, 2, "addLocalStreams"], [_bindLocalStreamsDecs, 2, "bindLocalStreams"], [_updatePublishPrivilegeOfStreamsDecs, 2, "updatePublishPrivilegeOfStreams"], [_removeStreamsDecs, 2, "removeStreams"], [_setVideoEncoderConfigDecs, 2, "setVideoEncoderConfig"], [_setScreenScenarioDecs, 2, "setScreenScenario"], [_startRenderRemoteVideoStreamDecs, 2, "startRenderRemoteVideoStream"], [_stopRenderRemoteVideoStreamDecs, 2, "stopRenderRemoteVideoStream"], [_startPlayRemoteAudioStreamDecs, 2, "startPlayRemoteAudioStream"], [_stopPlayRemoteAudioStreamDecs, 2, "stopPlayRemoteAudioStream"], [_takeSnapshotDecs, 2, "takeSnapshot"], [_addLocalScreenStreamDecs, 2, "addLocalScreenStream"], [[_imports.bound, _imports.trace], 2, "removeScreenStream"], [_adjustRemoteAudioStreamVolumeDecs, 2, "adjustRemoteAudioStreamVolume"], [_mergeAudioStreamDecs, 2, "mergeAudioStream"], [_splitAudioStreamDecs, 2, "splitAudioStream"]], []).e;
|
|
477
|
+
[_initProto] = _applyDecs(_FcrStreamControlImpl, [[_imports.bound, 2, "getStreams"], [_imports.bound, 2, "getStreamList"], [_imports.bound, 2, "getStreamsByUserId"], [_imports.bound, 2, "getStreamByStreamId"], [_addLocalStreamsDecs, 2, "addLocalStreams"], [_bindLocalStreamsDecs, 2, "bindLocalStreams"], [_updatePublishPrivilegeOfStreamsDecs, 2, "updatePublishPrivilegeOfStreams"], [_removeStreamsDecs, 2, "removeStreams"], [_setVideoEncoderConfigDecs, 2, "setVideoEncoderConfig"], [[_imports.bound, _imports.trace], 2, "setDualStreamMode"], [_setScreenScenarioDecs, 2, "setScreenScenario"], [_startRenderRemoteVideoStreamDecs, 2, "startRenderRemoteVideoStream"], [_stopRenderRemoteVideoStreamDecs, 2, "stopRenderRemoteVideoStream"], [_startPlayRemoteAudioStreamDecs, 2, "startPlayRemoteAudioStream"], [_stopPlayRemoteAudioStreamDecs, 2, "stopPlayRemoteAudioStream"], [_takeSnapshotDecs, 2, "takeSnapshot"], [_addLocalScreenStreamDecs, 2, "addLocalScreenStream"], [[_imports.bound, _imports.trace], 2, "removeScreenStream"], [_adjustRemoteAudioStreamVolumeDecs, 2, "adjustRemoteAudioStreamVolume"], [_mergeAudioStreamDecs, 2, "mergeAudioStream"], [_splitAudioStreamDecs, 2, "splitAudioStream"]], []).e;
|
|
478
|
+
class FcrSubscribedStreamsControl {
|
|
479
|
+
constructor() {
|
|
480
|
+
(0, _defineProperty2.default)(this, "logger", (0, _logger.createLogger)({
|
|
481
|
+
prefix: 'StreamSubscriptionManager'
|
|
482
|
+
}));
|
|
483
|
+
//@internal
|
|
484
|
+
/**
|
|
485
|
+
* Map of remote subscribed streams to their bound view IDs
|
|
486
|
+
* key: streamId - The ID of the remote video stream
|
|
487
|
+
* value: string[] - Array of viewIds bound to this stream
|
|
488
|
+
*/
|
|
489
|
+
(0, _defineProperty2.default)(this, "_remoteSubscribedStreamRenderMap", new Map());
|
|
490
|
+
}
|
|
491
|
+
getViewId(element) {
|
|
492
|
+
// Adapt for harmony: AgoraRteRenderView is string in harmony, HTMLElement in web
|
|
493
|
+
if (typeof element === 'string') {
|
|
494
|
+
return element;
|
|
495
|
+
} else {
|
|
496
|
+
// @ts-ignore
|
|
497
|
+
const viewId = element.getAttribute('data-render-id');
|
|
498
|
+
if (!viewId) {
|
|
499
|
+
const uniqueId = (0, _imports.v4)();
|
|
500
|
+
// @ts-ignore
|
|
501
|
+
element.setAttribute('data-render-id', uniqueId);
|
|
502
|
+
return uniqueId;
|
|
503
|
+
}
|
|
504
|
+
return viewId;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
isEmpty(streamId) {
|
|
508
|
+
const viewIds = this._remoteSubscribedStreamRenderMap.get(streamId);
|
|
509
|
+
return !viewIds || viewIds.length === 0;
|
|
510
|
+
}
|
|
511
|
+
bind(viewId, streamId) {
|
|
512
|
+
if (!streamId || !viewId) {
|
|
513
|
+
this.logger.warn("[FcrStreamControl][bind-view-to-stream] invalid parameters, streamId: ".concat(streamId, ", viewId: ").concat(viewId));
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
const viewIds = this._remoteSubscribedStreamRenderMap.get(streamId) || [];
|
|
517
|
+
const isAlreadyBound = viewIds.includes(viewId);
|
|
518
|
+
if (!isAlreadyBound) {
|
|
519
|
+
viewIds.push(viewId);
|
|
520
|
+
this._remoteSubscribedStreamRenderMap.set(streamId, viewIds);
|
|
521
|
+
} else {
|
|
522
|
+
this.logger.warn("[FcrStreamControl][bind-view-to-stream] viewId already bound, streamId: ".concat(streamId, ", viewId: ").concat(viewId));
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
unbind(viewId, streamId) {
|
|
526
|
+
if (!streamId || !viewId) {
|
|
527
|
+
this.logger.warn("[FcrStreamControl][unbind-view-from-stream] invalid parameters, streamId: ".concat(streamId, ", viewId: ").concat(viewId));
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
const viewIds = this._remoteSubscribedStreamRenderMap.get(streamId);
|
|
531
|
+
if (!viewIds || !viewIds.includes(viewId)) {
|
|
532
|
+
this.logger.warn("[FcrStreamControl][unbind-view-from-stream] viewId not found, streamId: ".concat(streamId, ", viewId: ").concat(viewId));
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
const rest = viewIds.filter(id => id !== viewId);
|
|
536
|
+
if (rest.length === 0) {
|
|
537
|
+
this._remoteSubscribedStreamRenderMap.delete(streamId);
|
|
538
|
+
} else {
|
|
539
|
+
this._remoteSubscribedStreamRenderMap.set(streamId, rest);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
exports.FcrSubscribedStreamsControl = FcrSubscribedStreamsControl;
|
|
@@ -59,6 +59,12 @@ export interface FcrStreamControl {
|
|
|
59
59
|
* @param streamType
|
|
60
60
|
*/
|
|
61
61
|
setVideoEncoderConfig(streamId: string, config: FcrVideoEncoderConfig, streamType: FcrVideoStreamType): void;
|
|
62
|
+
/**
|
|
63
|
+
* Sets the dual stream mode for a local stream.
|
|
64
|
+
* @param streamId
|
|
65
|
+
* @param enable
|
|
66
|
+
*/
|
|
67
|
+
setDualStreamMode(streamId: string, enableDualStreamMode: boolean): void;
|
|
62
68
|
/**
|
|
63
69
|
* Starts rendering the remote video stream.
|
|
64
70
|
* @param streamId
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function deCompressGzipToJson(compressedData: Uint8Array<ArrayBufferLike>): Promise<any>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.deCompressGzipToJson = deCompressGzipToJson;
|
|
7
|
+
require("core-js/modules/es.error.cause.js");
|
|
8
|
+
require("core-js/modules/es.array-buffer.constructor.js");
|
|
9
|
+
require("core-js/modules/es.array-buffer.slice.js");
|
|
10
|
+
require("core-js/modules/es.typed-array.uint8-array.js");
|
|
11
|
+
require("core-js/modules/es.typed-array.at.js");
|
|
12
|
+
require("core-js/modules/es.typed-array.fill.js");
|
|
13
|
+
require("core-js/modules/es.typed-array.find-last.js");
|
|
14
|
+
require("core-js/modules/es.typed-array.find-last-index.js");
|
|
15
|
+
require("core-js/modules/es.typed-array.set.js");
|
|
16
|
+
require("core-js/modules/es.typed-array.sort.js");
|
|
17
|
+
require("core-js/modules/es.typed-array.to-reversed.js");
|
|
18
|
+
require("core-js/modules/es.typed-array.to-sorted.js");
|
|
19
|
+
require("core-js/modules/es.typed-array.with.js");
|
|
20
|
+
require("core-js/modules/esnext.array-buffer.detached.js");
|
|
21
|
+
require("core-js/modules/esnext.array-buffer.transfer.js");
|
|
22
|
+
require("core-js/modules/esnext.array-buffer.transfer-to-fixed-length.js");
|
|
23
|
+
require("core-js/modules/esnext.json.parse.js");
|
|
24
|
+
require("core-js/modules/esnext.typed-array.filter-reject.js");
|
|
25
|
+
require("core-js/modules/esnext.typed-array.group-by.js");
|
|
26
|
+
require("core-js/modules/esnext.typed-array.to-spliced.js");
|
|
27
|
+
require("core-js/modules/esnext.typed-array.unique-by.js");
|
|
28
|
+
async function deCompressGzipToJson(compressedData) {
|
|
29
|
+
try {
|
|
30
|
+
// 检查浏览器是否支持 Compression Streams API
|
|
31
|
+
if (typeof DecompressionStream === 'undefined') {
|
|
32
|
+
throw new Error('DecompressionStream is not supported in this browser');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 创建解压缩流
|
|
36
|
+
const decompressionStream = new DecompressionStream('gzip');
|
|
37
|
+
const decompressedStream = new Blob([new Uint8Array(compressedData)]).stream().pipeThrough(decompressionStream);
|
|
38
|
+
|
|
39
|
+
// 获取解压缩后的文本
|
|
40
|
+
const response = new Response(decompressedStream);
|
|
41
|
+
const text = await response.text();
|
|
42
|
+
|
|
43
|
+
// 解析为 JSON 对象
|
|
44
|
+
return JSON.parse(text);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.error('Gzip decompression to JSON failed:', error);
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|