fcr-core 3.10.2 → 3.10.6
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/index.d.ts +1 -1
- package/lib/media-control/mobile.js +5 -6
- package/lib/media-control/type.d.ts +3 -3
- package/lib/room-control/room-connector-control/index.js +0 -2
- package/lib/room-control/room-connector-control/type.d.ts +1 -1
- package/lib/room-control/stream-control/index.js +45 -6
- package/lib/room-control/stream-control/type.d.ts +11 -1
- package/lib/schema.d.ts +15 -15
- package/lib/type.d.ts +1 -1
- package/lib-es/media-control/mobile.js +5 -6
- package/lib-es/room-control/room-connector-control/index.js +0 -2
- package/lib-es/room-control/stream-control/index.js +47 -8
- package/package.json +4 -4
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { FcrDesktopMediaControl, FcrDesktopMediaObserver, FcrMobileMediaControl, FcrMobileMediaObserver, FcrMonitorControl, FcrMonitorObserver, FcrBaseRoomControl, FcrRoomObserver, FcrUserControl, FcrUserObserver, FcrStreamControl, FcrStreamObserver, FcrPrivilegeControl, FcrPermission, FcrBoardMainWindow, FcrBoardMainWindowObserver, FcrColor, } from './type';
|
|
1
|
+
export type { FcrDesktopMediaControl, FcrDesktopMediaObserver, FcrMobileMediaControl, FcrMobileMediaObserver, FcrMonitorControl, FcrMonitorObserver, FcrBaseRoomControl, FcrRoomObserver, FcrUserControl, FcrUserObserver, FcrStreamControl, FcrStreamObserver, FcrPrivilegeControl, FcrPermission, FcrBoardMainWindow, FcrBoardMainWindowObserver, FcrColor, FcrBatchResult, FcrStreamUpdateResultDetail, } from './type';
|
|
2
2
|
export { FcrStreamLatencyLevel, FcrPermissionAction, FcrPrivilegeUserRole, FcrUserRole, FcrStreamState, FcrRegion, FcrStreamType, FcrUserUpdatedReason, FcrRoomConnectorType, FcrVideoSourceType, FcrAudioSourceType, FcrMediaSourceState, FcrVideoRenderMode, FcrVideoStreamType, FcrCapability, FcrAiDenoiseLevel, FcrStreamPrivilegeOperation, FcrStreamPrivilegeVideoSourceType, FcrStreamPrivilegeAudioSourceType, FcrConnectionState, registerPlugin, FcrBoardToolType, FcrBoardShape, FcrVideoEncoderConfig, FcrDualVideoStreamConfig, } from './type';
|
|
3
3
|
export { FcrCoreEngineImpl as FcrCoreEngine } from './engine';
|
|
4
4
|
export { FcrCoreEngineConfig } from './struct';
|
|
@@ -119,10 +119,10 @@ class FcrMobileMediaControlImpl {
|
|
|
119
119
|
return this._mediaControl.getCameraTrack(this._cameraDeviceName).setCaptureParams(params);
|
|
120
120
|
}
|
|
121
121
|
startCameraPreview(view, config) {
|
|
122
|
-
this._mediaControl.getCameraTrack(this._cameraDeviceName).startPreview(config, view);
|
|
122
|
+
return this._mediaControl.getCameraTrack(this._cameraDeviceName).startPreview(config, view);
|
|
123
123
|
}
|
|
124
124
|
stopCameraPreview(view) {
|
|
125
|
-
this._mediaControl.getCameraTrack(this._cameraDeviceName).stopPreview(view);
|
|
125
|
+
return this._mediaControl.getCameraTrack(this._cameraDeviceName).stopPreview(view);
|
|
126
126
|
}
|
|
127
127
|
stopCameraPreviewOnAllCanvas() {
|
|
128
128
|
throw new Error('Method not implemented.');
|
|
@@ -164,12 +164,11 @@ class FcrMobileMediaControlImpl {
|
|
|
164
164
|
openDevice(deviceType) {
|
|
165
165
|
switch (deviceType) {
|
|
166
166
|
case _type.FcrDeviceType.Camera:
|
|
167
|
-
this.getCameraTrack(this._cameraDeviceName).start();
|
|
168
|
-
break;
|
|
167
|
+
return this.getCameraTrack(this._cameraDeviceName).start();
|
|
169
168
|
case _type.FcrDeviceType.Microphone:
|
|
170
|
-
this.getMicrophoneTrack(this._microphoneDeviceName).start();
|
|
171
|
-
break;
|
|
169
|
+
return this.getMicrophoneTrack(this._microphoneDeviceName).start();
|
|
172
170
|
default:
|
|
171
|
+
return -1;
|
|
173
172
|
}
|
|
174
173
|
}
|
|
175
174
|
closeDevice(deviceType) {
|
|
@@ -619,7 +619,7 @@ export interface FcrMobileMediaControl {
|
|
|
619
619
|
* Open the specified device.
|
|
620
620
|
* @param deviceType The type of the device to open.
|
|
621
621
|
*/
|
|
622
|
-
openDevice(deviceType: FcrDeviceType):
|
|
622
|
+
openDevice(deviceType: FcrDeviceType): number;
|
|
623
623
|
/**
|
|
624
624
|
* Close the specified device.
|
|
625
625
|
* @param deviceType The type of the device to close.
|
|
@@ -641,8 +641,8 @@ export interface FcrMobileMediaControl {
|
|
|
641
641
|
startCameraTest(): void;
|
|
642
642
|
stopCameraTest(): void;
|
|
643
643
|
setCaptureParams(params: FcrCameraCaptureParams): number;
|
|
644
|
-
startCameraPreview(view: string | object, config: FcrRenderConfig):
|
|
645
|
-
stopCameraPreview(view: string | object):
|
|
644
|
+
startCameraPreview(view: string | object, config: FcrRenderConfig): number;
|
|
645
|
+
stopCameraPreview(view: string | object): number;
|
|
646
646
|
stopCameraPreviewOnAllCanvas(): void;
|
|
647
647
|
isCapabilitySupported(capability: FcrCapability): boolean;
|
|
648
648
|
startScreenCapture(excludeWindowList: string[]): void;
|
|
@@ -31,7 +31,6 @@ var _logger = require("../../utilities/logger");
|
|
|
31
31
|
var _error = require("../../utilities/error");
|
|
32
32
|
var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
|
|
33
33
|
var _schema = require("../../schema");
|
|
34
|
-
var _type2 = require("../../type");
|
|
35
34
|
let _initProto, _startSessionByPhoneDecs, _startSessionByIPDecs, _stopSessionDecs;
|
|
36
35
|
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 (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 (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (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 (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)]; } }; }
|
|
37
36
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
@@ -130,7 +129,6 @@ class FcrRoomConnectorControlImpl {
|
|
|
130
129
|
callId: sessionId,
|
|
131
130
|
userId: this._scene.getLocalUser().getLocalUserId()
|
|
132
131
|
}), _imports.ErrorModuleCode.FCR_ROOM, 'stop session failed');
|
|
133
|
-
return _type2.FcrReturnCode.SUCCESS;
|
|
134
132
|
}
|
|
135
133
|
addObserver(observer) {
|
|
136
134
|
this._observable.addObserver(observer);
|
|
@@ -78,7 +78,7 @@ export interface FcrRoomConnectorControl {
|
|
|
78
78
|
* Stops a session.
|
|
79
79
|
* @param sessionId
|
|
80
80
|
*/
|
|
81
|
-
stopSession(sessionId: string): Promise<
|
|
81
|
+
stopSession(sessionId: string): Promise<void>;
|
|
82
82
|
/**
|
|
83
83
|
* Adds an observer to the room connector.
|
|
84
84
|
* @param observer
|
|
@@ -191,6 +191,7 @@ class FcrStreamControlImpl {
|
|
|
191
191
|
audioSourceType: config.audioSourceType,
|
|
192
192
|
videoSourceUuid: config.videoSourceId,
|
|
193
193
|
audioSourceUuid: config.audioSourceId,
|
|
194
|
+
strict: true,
|
|
194
195
|
...(0, _imports.convertStreamTypeToPublishState)(config.streamType)
|
|
195
196
|
}))), _imports.ErrorModuleCode.FCR_ROOM_STREAM, 'add local streams failed');
|
|
196
197
|
|
|
@@ -228,12 +229,50 @@ class FcrStreamControlImpl {
|
|
|
228
229
|
bindLocalStreams(streams) {
|
|
229
230
|
return this._scene.localUser.bindLocalStreams(streams);
|
|
230
231
|
}
|
|
231
|
-
updatePublishPrivilegeOfStreams(privileges) {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
232
|
+
async updatePublishPrivilegeOfStreams(privileges) {
|
|
233
|
+
let response;
|
|
234
|
+
try {
|
|
235
|
+
response = await this._api.updateStreamBatch(this._scene.sceneId, Object.keys(privileges).map(streamId => ({
|
|
236
|
+
streamUuid: streamId,
|
|
237
|
+
audioState: this._getPublishStateByPrivilege(privileges[streamId].audioPrivilege),
|
|
238
|
+
videoState: this._getPublishStateByPrivilege(privileges[streamId].videoPrivilege),
|
|
239
|
+
strict: true
|
|
240
|
+
})));
|
|
241
|
+
} catch (error) {
|
|
242
|
+
const restfulError = error;
|
|
243
|
+
if (restfulError instanceof _imports.AgoraRestfulClientError && restfulError.serviceCode === 30418001) {
|
|
244
|
+
response = {
|
|
245
|
+
code: restfulError.serviceCode,
|
|
246
|
+
message: restfulError.message,
|
|
247
|
+
data: Array.isArray(restfulError.data) ? restfulError.data : []
|
|
248
|
+
};
|
|
249
|
+
} else {
|
|
250
|
+
return (0, _error.handleRequestError)(() => Promise.reject(error), _imports.ErrorModuleCode.FCR_ROOM_STREAM, 'update publish privilege of streams failed');
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
const code = response.code ?? -1;
|
|
254
|
+
const message = response.message ?? response.msg;
|
|
255
|
+
if (code !== 0 && code !== 30418001) {
|
|
256
|
+
throw (0, _error.generateFcrCoreServerError)(code, message ?? 'update publish privilege of streams failed');
|
|
257
|
+
}
|
|
258
|
+
const result = {
|
|
259
|
+
code,
|
|
260
|
+
list: (response.data ?? []).map(item => {
|
|
261
|
+
const detail = {
|
|
262
|
+
streamId: item.streamId ?? item.streamUuid ?? '',
|
|
263
|
+
code: item.code ?? 0
|
|
264
|
+
};
|
|
265
|
+
const itemMessage = item.message ?? item.msg;
|
|
266
|
+
if (itemMessage !== undefined) {
|
|
267
|
+
detail.message = itemMessage;
|
|
268
|
+
}
|
|
269
|
+
return detail;
|
|
270
|
+
})
|
|
271
|
+
};
|
|
272
|
+
if (message !== undefined) {
|
|
273
|
+
result.message = message;
|
|
274
|
+
}
|
|
275
|
+
return result;
|
|
237
276
|
}
|
|
238
277
|
updatePublishPrivilegeOfStreamsByScope(privilege, scope) {
|
|
239
278
|
const targetRteRoles = scope.targetRoleType.map(role => _type.FcrUserRoleToStringMap[role]);
|
|
@@ -35,7 +35,7 @@ export interface FcrStreamControl {
|
|
|
35
35
|
* Updates the publish privilege of streams.
|
|
36
36
|
* @param privileges
|
|
37
37
|
*/
|
|
38
|
-
updatePublishPrivilegeOfStreams(privileges: Record<string, FcrUpdateStreamPrivilege>): Promise<
|
|
38
|
+
updatePublishPrivilegeOfStreams(privileges: Record<string, FcrUpdateStreamPrivilege>): Promise<FcrBatchResult<FcrStreamUpdateResultDetail>>;
|
|
39
39
|
/**
|
|
40
40
|
* Updates the publish privilege of streams.
|
|
41
41
|
* @param privilege
|
|
@@ -142,6 +142,16 @@ export type FcrUpdateStreamPrivilege = {
|
|
|
142
142
|
videoPrivilege: FcrStreamPrivilegeOperation;
|
|
143
143
|
audioPrivilege: FcrStreamPrivilegeOperation;
|
|
144
144
|
};
|
|
145
|
+
export type FcrBatchResult<T> = {
|
|
146
|
+
code: number;
|
|
147
|
+
message?: string;
|
|
148
|
+
list: T[];
|
|
149
|
+
};
|
|
150
|
+
export type FcrStreamUpdateResultDetail = {
|
|
151
|
+
streamId: string;
|
|
152
|
+
code: number;
|
|
153
|
+
message?: string;
|
|
154
|
+
};
|
|
145
155
|
export type FcrUpdateStreamPrivilegeScope = {
|
|
146
156
|
videoSourceType?: FcrStreamPrivilegeVideoSourceType;
|
|
147
157
|
audioSourceType?: FcrStreamPrivilegeAudioSourceType;
|
package/lib/schema.d.ts
CHANGED
|
@@ -299,13 +299,13 @@ export declare const fcrChatRoomSendBaseMessageSchema: z.ZodObject<{
|
|
|
299
299
|
to?: string[] | undefined;
|
|
300
300
|
}>;
|
|
301
301
|
export type FcrChatRoomSendBaseMessageSchema = z.infer<typeof fcrChatRoomSendBaseMessageSchema>;
|
|
302
|
-
export declare const fcrChatRoomSendTextMessageSchema: z.ZodObject<{
|
|
302
|
+
export declare const fcrChatRoomSendTextMessageSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
303
303
|
content: z.ZodString;
|
|
304
|
-
}
|
|
304
|
+
}, {
|
|
305
305
|
type: z.ZodNativeEnum<typeof FcrChatRoomMessageType>;
|
|
306
306
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
307
307
|
to: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
308
|
-
}
|
|
308
|
+
}>, "strip", z.ZodTypeAny, {
|
|
309
309
|
type: FcrChatRoomMessageType;
|
|
310
310
|
content: string;
|
|
311
311
|
properties?: Record<string, unknown> | undefined;
|
|
@@ -334,7 +334,7 @@ export declare const fcrChatRoomFileSchema: z.ZodObject<{
|
|
|
334
334
|
filePath?: string | undefined;
|
|
335
335
|
}>;
|
|
336
336
|
export type FcrChatRoomFileSchema = z.infer<typeof fcrChatRoomFileSchema>;
|
|
337
|
-
export declare const fcrChatRoomSendImageMessageSchema: z.ZodObject<{
|
|
337
|
+
export declare const fcrChatRoomSendImageMessageSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
338
338
|
file: z.ZodObject<{
|
|
339
339
|
fileName: z.ZodString;
|
|
340
340
|
fileType: z.ZodString;
|
|
@@ -351,11 +351,11 @@ export declare const fcrChatRoomSendImageMessageSchema: z.ZodObject<{
|
|
|
351
351
|
data?: any;
|
|
352
352
|
filePath?: string | undefined;
|
|
353
353
|
}>;
|
|
354
|
-
}
|
|
354
|
+
}, {
|
|
355
355
|
type: z.ZodNativeEnum<typeof FcrChatRoomMessageType>;
|
|
356
356
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
357
357
|
to: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
358
|
-
}
|
|
358
|
+
}>, "strip", z.ZodTypeAny, {
|
|
359
359
|
type: FcrChatRoomMessageType;
|
|
360
360
|
file: {
|
|
361
361
|
fileName: string;
|
|
@@ -377,13 +377,13 @@ export declare const fcrChatRoomSendImageMessageSchema: z.ZodObject<{
|
|
|
377
377
|
to?: string[] | undefined;
|
|
378
378
|
}>;
|
|
379
379
|
export type FcrChatRoomSendImageMessageSchema = z.infer<typeof fcrChatRoomSendImageMessageSchema>;
|
|
380
|
-
export declare const messageSchema: z.ZodUnion<[z.ZodObject<{
|
|
380
|
+
export declare const messageSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
|
381
381
|
content: z.ZodString;
|
|
382
|
-
}
|
|
382
|
+
}, {
|
|
383
383
|
type: z.ZodNativeEnum<typeof FcrChatRoomMessageType>;
|
|
384
384
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
385
385
|
to: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
386
|
-
}
|
|
386
|
+
}>, "strip", z.ZodTypeAny, {
|
|
387
387
|
type: FcrChatRoomMessageType;
|
|
388
388
|
content: string;
|
|
389
389
|
properties?: Record<string, unknown> | undefined;
|
|
@@ -393,7 +393,7 @@ export declare const messageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
393
393
|
content: string;
|
|
394
394
|
properties?: Record<string, unknown> | undefined;
|
|
395
395
|
to?: string[] | undefined;
|
|
396
|
-
}>, z.ZodObject<{
|
|
396
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
397
397
|
file: z.ZodObject<{
|
|
398
398
|
fileName: z.ZodString;
|
|
399
399
|
fileType: z.ZodString;
|
|
@@ -410,11 +410,11 @@ export declare const messageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
410
410
|
data?: any;
|
|
411
411
|
filePath?: string | undefined;
|
|
412
412
|
}>;
|
|
413
|
-
}
|
|
413
|
+
}, {
|
|
414
414
|
type: z.ZodNativeEnum<typeof FcrChatRoomMessageType>;
|
|
415
415
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
416
416
|
to: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
417
|
-
}
|
|
417
|
+
}>, "strip", z.ZodTypeAny, {
|
|
418
418
|
type: FcrChatRoomMessageType;
|
|
419
419
|
file: {
|
|
420
420
|
fileName: string;
|
|
@@ -754,9 +754,9 @@ export declare const fcrGroupUpdateOptionsSchema: z.ZodObject<{
|
|
|
754
754
|
groupName: string;
|
|
755
755
|
}>;
|
|
756
756
|
export type FcrGroupUpdateOptionsSchema = z.infer<typeof fcrGroupUpdateOptionsSchema>;
|
|
757
|
-
export declare const fcrRoomJoinOptionsWithTicketSchema: z.ZodObject<{
|
|
757
|
+
export declare const fcrRoomJoinOptionsWithTicketSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
758
758
|
ticket: z.ZodOptional<z.ZodString>;
|
|
759
|
-
}
|
|
759
|
+
}, {
|
|
760
760
|
userName: z.ZodString;
|
|
761
761
|
userRole: z.ZodNativeEnum<typeof FcrUserRole>;
|
|
762
762
|
userProperties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -852,7 +852,7 @@ export declare const fcrRoomJoinOptionsWithTicketSchema: z.ZodObject<{
|
|
|
852
852
|
password: z.ZodOptional<z.ZodString>;
|
|
853
853
|
platform: z.ZodOptional<z.ZodNumber>;
|
|
854
854
|
avatar: z.ZodOptional<z.ZodString>;
|
|
855
|
-
}
|
|
855
|
+
}>, "strip", z.ZodTypeAny, {
|
|
856
856
|
userName: string;
|
|
857
857
|
userRole: FcrUserRole;
|
|
858
858
|
roomToken: string;
|
package/lib/type.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export type { FcrIPConnectorSession, FcrIPConnectorSessionParams, FcrPhoneConnec
|
|
|
31
31
|
export type { FcrRoomSession, FcrRoomSessionControl, FcrRoomSessionObserver, FcrRoomSessionParams, } from './room-control/room-session/type';
|
|
32
32
|
export { FcrScreenSharingState, FcrWhiteboardState } from './room-control/sharing-control/type';
|
|
33
33
|
export type { FcrSharingControl, FcrSharingObserver } from './room-control/sharing-control/type';
|
|
34
|
-
export type { FcrDimensions, FcrLocalAudioStats, FcrLocalStreamCreateConfig, FcrLocalVideoStats, FcrRemoteAudioStats, FcrRemoteVideoStats, FcrSize, FcrSnapshotInfo, FcrStreamControl, FcrStreamCreateConfig, FcrStreamEvent, FcrStreamObserver, FcrUpdateStreamPrivilege, FcrUpdateStreamPrivilegeScope, } from './room-control/stream-control/type';
|
|
34
|
+
export type { FcrDimensions, FcrLocalAudioStats, FcrLocalStreamCreateConfig, FcrLocalVideoStats, FcrRemoteAudioStats, FcrRemoteVideoStats, FcrSize, FcrSnapshotInfo, FcrBatchResult, FcrStreamControl, FcrStreamCreateConfig, FcrStreamEvent, FcrStreamObserver, FcrStreamUpdateResultDetail, FcrUpdateStreamPrivilege, FcrUpdateStreamPrivilegeScope, } from './room-control/stream-control/type';
|
|
35
35
|
export { FcrUserKickedOutType, FcrUserLeftReason, FcrUserRole, } from './room-control/user-control/type';
|
|
36
36
|
export type { FcrUserControl, FcrUserJoinedEvent, FcrUserKickedOutEvent, FcrUserLeftEvent, FcrUserObserver, FcrUserPageParams, FcrUserPageResponse, FcrUserPropertiesDeletedEvent, FcrUserPropertiesUpdatedEvent, FcrUserUpdatedEvent, } from './room-control/user-control/type';
|
|
37
37
|
export type { FcrAnnotationConfig, FcrAnnotationControl, } from './room-control/whiteboard-control-v2/annotation-control/type';
|
|
@@ -112,10 +112,10 @@ export class FcrMobileMediaControlImpl {
|
|
|
112
112
|
return this._mediaControl.getCameraTrack(this._cameraDeviceName).setCaptureParams(params);
|
|
113
113
|
}
|
|
114
114
|
startCameraPreview(view, config) {
|
|
115
|
-
this._mediaControl.getCameraTrack(this._cameraDeviceName).startPreview(config, view);
|
|
115
|
+
return this._mediaControl.getCameraTrack(this._cameraDeviceName).startPreview(config, view);
|
|
116
116
|
}
|
|
117
117
|
stopCameraPreview(view) {
|
|
118
|
-
this._mediaControl.getCameraTrack(this._cameraDeviceName).stopPreview(view);
|
|
118
|
+
return this._mediaControl.getCameraTrack(this._cameraDeviceName).stopPreview(view);
|
|
119
119
|
}
|
|
120
120
|
stopCameraPreviewOnAllCanvas() {
|
|
121
121
|
throw new Error('Method not implemented.');
|
|
@@ -157,12 +157,11 @@ export class FcrMobileMediaControlImpl {
|
|
|
157
157
|
openDevice(deviceType) {
|
|
158
158
|
switch (deviceType) {
|
|
159
159
|
case FcrDeviceType.Camera:
|
|
160
|
-
this.getCameraTrack(this._cameraDeviceName).start();
|
|
161
|
-
break;
|
|
160
|
+
return this.getCameraTrack(this._cameraDeviceName).start();
|
|
162
161
|
case FcrDeviceType.Microphone:
|
|
163
|
-
this.getMicrophoneTrack(this._microphoneDeviceName).start();
|
|
164
|
-
break;
|
|
162
|
+
return this.getMicrophoneTrack(this._microphoneDeviceName).start();
|
|
165
163
|
default:
|
|
164
|
+
return -1;
|
|
166
165
|
}
|
|
167
166
|
}
|
|
168
167
|
closeDevice(deviceType) {
|
|
@@ -30,7 +30,6 @@ import { createLogger, generateLogObserver } from '../../utilities/logger';
|
|
|
30
30
|
import { handleRequestError } from '../../utilities/error';
|
|
31
31
|
import validateParams from '../../utilities/validate-params';
|
|
32
32
|
import { fcrIPConnectorSessionParamsSchema, fcrPhoneConnectorSessionParamsSchema, stringSchema } from '../../schema';
|
|
33
|
-
import { FcrReturnCode } from '../../type';
|
|
34
33
|
import { ErrorModuleCode } from '../../imports';
|
|
35
34
|
|
|
36
35
|
/**
|
|
@@ -125,7 +124,6 @@ export class FcrRoomConnectorControlImpl {
|
|
|
125
124
|
callId: sessionId,
|
|
126
125
|
userId: this._scene.getLocalUser().getLocalUserId()
|
|
127
126
|
}), ErrorModuleCode.FCR_ROOM, 'stop session failed');
|
|
128
|
-
return FcrReturnCode.SUCCESS;
|
|
129
127
|
}
|
|
130
128
|
addObserver(observer) {
|
|
131
129
|
this._observable.addObserver(observer);
|
|
@@ -32,12 +32,12 @@ import { AgoraObservable, bound, convertStreamTypeToPublishState, objectSchema,
|
|
|
32
32
|
import { FcrReturnCode, FcrUserRoleToStringMap } from '../../type';
|
|
33
33
|
import { FcrVideoStreamType, FcrVideoSourceType, FcrAudioSourceType, FcrMediaSourceState } from '../../type';
|
|
34
34
|
import { convertRteUserToFcrUser } from '../../utilities/user';
|
|
35
|
-
import { handleRequestError } from '../../utilities/error';
|
|
35
|
+
import { generateFcrCoreServerError, handleRequestError } from '../../utilities/error';
|
|
36
36
|
import { createLogger, generateLogObserver } from '../../utilities/logger';
|
|
37
37
|
import validateParams from '../../utilities/validate-params';
|
|
38
38
|
import { stringArraySchema, stringSchema, numberSchema, fcrStreamBindConfigArrySchema, agoraRtcVideoEncoderConfigurationSchema, fcrVideoStreamTypeSchema, fcrRenderConfigSchema, fcrRenderViewSchema, fcrScreenStreamCreateConfigSchema, fcrLocalStreamCreateArrayConfigSchema, fcrUpdateStreamPrivilegeScopeSchema, fcrUpdateStreamPrivilegesRecordSchema, fcrUpdateStreamPrivilegeSchema, createUnionSchema, fcrSizeSchema, fcrScreenScenarioTypeSchema } from '../../schema';
|
|
39
39
|
import { AgoraRteStreamPrivilegeOperation, AgoraRteStreamLayer } from '../../imports';
|
|
40
|
-
import { ErrorModuleCode } from '../../imports';
|
|
40
|
+
import { AgoraRestfulClientError, ErrorModuleCode } from '../../imports';
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* @internal
|
|
@@ -188,6 +188,7 @@ export class FcrStreamControlImpl {
|
|
|
188
188
|
audioSourceType: config.audioSourceType,
|
|
189
189
|
videoSourceUuid: config.videoSourceId,
|
|
190
190
|
audioSourceUuid: config.audioSourceId,
|
|
191
|
+
strict: true,
|
|
191
192
|
...convertStreamTypeToPublishState(config.streamType)
|
|
192
193
|
}))), ErrorModuleCode.FCR_ROOM_STREAM, 'add local streams failed');
|
|
193
194
|
|
|
@@ -225,12 +226,50 @@ export class FcrStreamControlImpl {
|
|
|
225
226
|
bindLocalStreams(streams) {
|
|
226
227
|
return this._scene.localUser.bindLocalStreams(streams);
|
|
227
228
|
}
|
|
228
|
-
updatePublishPrivilegeOfStreams(privileges) {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
229
|
+
async updatePublishPrivilegeOfStreams(privileges) {
|
|
230
|
+
let response;
|
|
231
|
+
try {
|
|
232
|
+
response = await this._api.updateStreamBatch(this._scene.sceneId, Object.keys(privileges).map(streamId => ({
|
|
233
|
+
streamUuid: streamId,
|
|
234
|
+
audioState: this._getPublishStateByPrivilege(privileges[streamId].audioPrivilege),
|
|
235
|
+
videoState: this._getPublishStateByPrivilege(privileges[streamId].videoPrivilege),
|
|
236
|
+
strict: true
|
|
237
|
+
})));
|
|
238
|
+
} catch (error) {
|
|
239
|
+
const restfulError = error;
|
|
240
|
+
if (restfulError instanceof AgoraRestfulClientError && restfulError.serviceCode === 30418001) {
|
|
241
|
+
response = {
|
|
242
|
+
code: restfulError.serviceCode,
|
|
243
|
+
message: restfulError.message,
|
|
244
|
+
data: Array.isArray(restfulError.data) ? restfulError.data : []
|
|
245
|
+
};
|
|
246
|
+
} else {
|
|
247
|
+
return handleRequestError(() => Promise.reject(error), ErrorModuleCode.FCR_ROOM_STREAM, 'update publish privilege of streams failed');
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
const code = response.code ?? -1;
|
|
251
|
+
const message = response.message ?? response.msg;
|
|
252
|
+
if (code !== 0 && code !== 30418001) {
|
|
253
|
+
throw generateFcrCoreServerError(code, message ?? 'update publish privilege of streams failed');
|
|
254
|
+
}
|
|
255
|
+
const result = {
|
|
256
|
+
code,
|
|
257
|
+
list: (response.data ?? []).map(item => {
|
|
258
|
+
const detail = {
|
|
259
|
+
streamId: item.streamId ?? item.streamUuid ?? '',
|
|
260
|
+
code: item.code ?? 0
|
|
261
|
+
};
|
|
262
|
+
const itemMessage = item.message ?? item.msg;
|
|
263
|
+
if (itemMessage !== undefined) {
|
|
264
|
+
detail.message = itemMessage;
|
|
265
|
+
}
|
|
266
|
+
return detail;
|
|
267
|
+
})
|
|
268
|
+
};
|
|
269
|
+
if (message !== undefined) {
|
|
270
|
+
result.message = message;
|
|
271
|
+
}
|
|
272
|
+
return result;
|
|
234
273
|
}
|
|
235
274
|
updatePublishPrivilegeOfStreamsByScope(privilege, scope) {
|
|
236
275
|
const targetRteRoles = scope.targetRoleType.map(role => FcrUserRoleToStringMap[role]);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fcr-core",
|
|
3
3
|
"description": "Core APIs for building online scenes",
|
|
4
|
-
"version": "3.10.
|
|
4
|
+
"version": "3.10.6",
|
|
5
5
|
"module": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@types/lodash": "^4.14.168",
|
|
42
42
|
"@types/sinon": "^17.0.2",
|
|
43
43
|
"@types/uuid": "^8.3.0",
|
|
44
|
-
"agora-toolchain": "3.10.
|
|
44
|
+
"agora-toolchain": "3.10.6",
|
|
45
45
|
"core-js": "^3.33.3",
|
|
46
46
|
"decomment": "^0.9.5",
|
|
47
47
|
"husky": "^9.0.11",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"@netless/video-js-plugin": "^0.3.8",
|
|
62
62
|
"@netless/white-snapshot": "^0.4.2",
|
|
63
63
|
"@netless/window-manager": "^1.0.7-beta.6",
|
|
64
|
-
"agora-foundation": "3.10.
|
|
65
|
-
"agora-rte-sdk": "3.10.
|
|
64
|
+
"agora-foundation": "3.10.6",
|
|
65
|
+
"agora-rte-sdk": "3.10.6",
|
|
66
66
|
"await-to-js": "^3.0.0",
|
|
67
67
|
"dayjs": "^1.10.4",
|
|
68
68
|
"easemob-websdk": "4.13.0",
|