@azure/communication-react 1.5.1-alpha-202302160014 → 1.5.1-alpha-202302180014
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/dist/dist-cjs/communication-react/index.js +141 -1
- package/dist/dist-cjs/communication-react/index.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallContext.d.ts +14 -0
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js +44 -0
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.d.ts +1 -0
- package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js +21 -0
- package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/Converter.js +1 -0
- package/dist/dist-esm/calling-stateful-client/src/Converter.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/InternalCallContext.d.ts +3 -0
- package/dist/dist-esm/calling-stateful-client/src/InternalCallContext.js +25 -0
- package/dist/dist-esm/calling-stateful-client/src/InternalCallContext.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/LocalVideoStreamVideoEffectsSubscriber.d.ts +29 -0
- package/dist/dist-esm/calling-stateful-client/src/LocalVideoStreamVideoEffectsSubscriber.js +54 -0
- package/dist/dist-esm/calling-stateful-client/src/LocalVideoStreamVideoEffectsSubscriber.js.map +1 -0
- package/dist/dist-esm/calling-stateful-client/src/StreamUtils.js +1 -0
- package/dist/dist-esm/calling-stateful-client/src/StreamUtils.js.map +1 -1
- package/package.json +8 -8
@@ -161,7 +161,7 @@ const _toCommunicationIdentifier = (id) => {
|
|
161
161
|
// Copyright (c) Microsoft Corporation.
|
162
162
|
// Licensed under the MIT license.
|
163
163
|
// GENERATED FILE. DO NOT EDIT MANUALLY.
|
164
|
-
var telemetryVersion = '1.5.1-alpha-
|
164
|
+
var telemetryVersion = '1.5.1-alpha-202302180014';
|
165
165
|
|
166
166
|
// Copyright (c) Microsoft Corporation.
|
167
167
|
/**
|
@@ -1208,6 +1208,20 @@ class CallContext$2 {
|
|
1208
1208
|
constructor(userId, maxListeners = 50,
|
1209
1209
|
/* @conditional-compile-remove(PSTN-calls) */ alternateCallerId) {
|
1210
1210
|
this._callIdHistory = new CallIdHistory();
|
1211
|
+
/**
|
1212
|
+
* Tees direct errors to state.
|
1213
|
+
* @remarks
|
1214
|
+
* This is typically used for errors that are caught and intended to be shown to the user.
|
1215
|
+
*
|
1216
|
+
* @param error The raw error to report.
|
1217
|
+
* @param target The error target to tee error to.
|
1218
|
+
*
|
1219
|
+
* @private
|
1220
|
+
*/
|
1221
|
+
this.teeErrorToState = (error, target) => {
|
1222
|
+
const callError = toCallError(target, error);
|
1223
|
+
this.setLatestError(target, callError);
|
1224
|
+
};
|
1211
1225
|
this._logger = logger.createClientLogger('communication-react:calling-context');
|
1212
1226
|
this._state = {
|
1213
1227
|
calls: {},
|
@@ -1383,6 +1397,22 @@ class CallContext$2 {
|
|
1383
1397
|
}
|
1384
1398
|
});
|
1385
1399
|
}
|
1400
|
+
/* @conditional-compile-remove(video-background-effects) */
|
1401
|
+
setCallLocalVideoStreamVideoEffects(callId, videoEffects) {
|
1402
|
+
this.modifyState((draft) => {
|
1403
|
+
var _a, _b, _c, _d, _e, _f;
|
1404
|
+
const call = draft.calls[this._callIdHistory.latestCallId(callId)];
|
1405
|
+
if (call) {
|
1406
|
+
const stream = (_a = call.localVideoStreams) === null || _a === void 0 ? void 0 : _a.find((i) => i.mediaStreamType === 'Video');
|
1407
|
+
if (stream) {
|
1408
|
+
stream.videoEffects = {
|
1409
|
+
isActive: (_d = (_b = videoEffects.isActive) !== null && _b !== void 0 ? _b : (_c = stream.videoEffects) === null || _c === void 0 ? void 0 : _c.isActive) !== null && _d !== void 0 ? _d : false,
|
1410
|
+
effectName: (_e = videoEffects.effectName) !== null && _e !== void 0 ? _e : (_f = stream.videoEffects) === null || _f === void 0 ? void 0 : _f.effectName
|
1411
|
+
};
|
1412
|
+
}
|
1413
|
+
}
|
1414
|
+
});
|
1415
|
+
}
|
1386
1416
|
setCallIsMicrophoneMuted(callId, isMicrophoneMuted) {
|
1387
1417
|
this.modifyState((draft) => {
|
1388
1418
|
const call = draft.calls[this._callIdHistory.latestCallId(callId)];
|
@@ -1710,6 +1740,20 @@ class CallContext$2 {
|
|
1710
1740
|
}
|
1711
1741
|
});
|
1712
1742
|
}
|
1743
|
+
/* @conditional-compile-remove(video-background-effects) */
|
1744
|
+
setDeviceManagerUnparentedViewVideoEffects(localVideoStream, videoEffects) {
|
1745
|
+
this.modifyState((draft) => {
|
1746
|
+
var _a, _b, _c, _d, _e;
|
1747
|
+
const foundIndex = draft.deviceManager.unparentedViews.findIndex((stream) => stream.source.id === localVideoStream.source.id && stream.mediaStreamType === localVideoStream.mediaStreamType);
|
1748
|
+
if (foundIndex !== -1) {
|
1749
|
+
const draftStream = draft.deviceManager.unparentedViews[foundIndex];
|
1750
|
+
draftStream.videoEffects = {
|
1751
|
+
isActive: (_c = (_a = videoEffects.isActive) !== null && _a !== void 0 ? _a : (_b = draftStream.videoEffects) === null || _b === void 0 ? void 0 : _b.isActive) !== null && _c !== void 0 ? _c : false,
|
1752
|
+
effectName: (_d = videoEffects.effectName) !== null && _d !== void 0 ? _d : (_e = draftStream.videoEffects) === null || _e === void 0 ? void 0 : _e.effectName
|
1753
|
+
};
|
1754
|
+
}
|
1755
|
+
});
|
1756
|
+
}
|
1713
1757
|
getAndIncrementAtomicId() {
|
1714
1758
|
const id = this._atomicId;
|
1715
1759
|
this._atomicId++;
|
@@ -1826,6 +1870,7 @@ function convertSdkLocalStreamToDeclarativeLocalStream(stream) {
|
|
1826
1870
|
source: stream.source,
|
1827
1871
|
mediaStreamType: stream.mediaStreamType,
|
1828
1872
|
view: undefined
|
1873
|
+
// TODO [video-background-effects]: Add video effects state when it is added to the SDK
|
1829
1874
|
};
|
1830
1875
|
}
|
1831
1876
|
/**
|
@@ -1922,6 +1967,60 @@ function convertFromSDKToDeclarativeVideoStreamRendererView(view) {
|
|
1922
1967
|
};
|
1923
1968
|
}
|
1924
1969
|
|
1970
|
+
// Copyright (c) Microsoft Corporation.
|
1971
|
+
// Licensed under the MIT license.
|
1972
|
+
/* @conditional-compile-remove(video-background-effects) */
|
1973
|
+
/**
|
1974
|
+
* Subscribes to a LocalVideoStream's video effects events and updates the call context appropriately.
|
1975
|
+
* @private
|
1976
|
+
*/
|
1977
|
+
class LocalVideoStreamVideoEffectsSubscriber {
|
1978
|
+
constructor(args) {
|
1979
|
+
this.subscribe = () => {
|
1980
|
+
this._localVideoStreamEffectsAPI.on('effectsStarted', this.effectsStarted);
|
1981
|
+
this._localVideoStreamEffectsAPI.on('effectsStopped', this.effectsStopped);
|
1982
|
+
this._localVideoStreamEffectsAPI.on('effectsError', this.effectsError);
|
1983
|
+
};
|
1984
|
+
this.unsubscribe = () => {
|
1985
|
+
this._localVideoStreamEffectsAPI.off('effectsStarted', this.effectsStarted);
|
1986
|
+
this._localVideoStreamEffectsAPI.off('effectsStopped', this.effectsStopped);
|
1987
|
+
this._localVideoStreamEffectsAPI.off('effectsError', this.effectsError);
|
1988
|
+
};
|
1989
|
+
this.effectsStarted = (effectName) => {
|
1990
|
+
this.updateEffectsState({
|
1991
|
+
isActive: true,
|
1992
|
+
effectName: effectName
|
1993
|
+
});
|
1994
|
+
};
|
1995
|
+
this.effectsStopped = (effectName) => {
|
1996
|
+
this.updateEffectsState({
|
1997
|
+
isActive: false,
|
1998
|
+
effectName: effectName
|
1999
|
+
});
|
2000
|
+
};
|
2001
|
+
this.effectsError = (error) => {
|
2002
|
+
// When there is an error the effects have stopped. Update the state to reflect this.
|
2003
|
+
this.updateEffectsState({
|
2004
|
+
isActive: false
|
2005
|
+
});
|
2006
|
+
this._context.teeErrorToState(new Error(error.message), 'VideoEffectsFeature.startEffects');
|
2007
|
+
};
|
2008
|
+
this.updateEffectsState = (newEffectsState) => {
|
2009
|
+
if (this._parent === 'unparented') {
|
2010
|
+
this._context.setDeviceManagerUnparentedViewVideoEffects(this._localVideoStream, newEffectsState);
|
2011
|
+
}
|
2012
|
+
else {
|
2013
|
+
this._context.setCallLocalVideoStreamVideoEffects(this._parent.callId, newEffectsState);
|
2014
|
+
}
|
2015
|
+
};
|
2016
|
+
this._parent = args.parent;
|
2017
|
+
this._context = args.context;
|
2018
|
+
this._localVideoStream = args.localVideoStream;
|
2019
|
+
this._localVideoStreamEffectsAPI = args.localVideoStreamEffectsAPI;
|
2020
|
+
this.subscribe();
|
2021
|
+
}
|
2022
|
+
}
|
2023
|
+
|
1925
2024
|
// Copyright (c) Microsoft Corporation.
|
1926
2025
|
// Licensed under the MIT license.
|
1927
2026
|
/**
|
@@ -2310,6 +2409,7 @@ function createViewUnparentedVideo(context, internalContext, stream, options) {
|
|
2310
2409
|
// Else the stream still exists and status is not telling us to stop rendering. Complete the render process by
|
2311
2410
|
// updating the state.
|
2312
2411
|
internalContext.setUnparentedRenderInfo(stream, localVideoStream, 'Rendered', renderer);
|
2412
|
+
internalContext.subscribeToUnparentedViewVideoEffects(localVideoStream, context);
|
2313
2413
|
context.setDeviceManagerUnparentedView(stream, convertFromSDKToDeclarativeVideoStreamRendererView(view));
|
2314
2414
|
return {
|
2315
2415
|
renderer,
|
@@ -2927,6 +3027,7 @@ class CallSubscriber {
|
|
2927
3027
|
}));
|
2928
3028
|
};
|
2929
3029
|
this.localVideoStreamsUpdated = (event) => {
|
3030
|
+
var _a, _b;
|
2930
3031
|
// At time of writing only one LocalVideoStream is supported by SDK.
|
2931
3032
|
if (event.added.length > 0) {
|
2932
3033
|
const localVideoStreams = [convertSdkLocalStreamToDeclarativeLocalStream(this._call.localVideoStreams[0])];
|
@@ -2934,8 +3035,24 @@ class CallSubscriber {
|
|
2934
3035
|
// has the required data when component re-renders due to external state changes.
|
2935
3036
|
this._internalContext.setLocalRenderInfo(this._callIdRef.callId, this._call.localVideoStreams[0], 'NotRendered', undefined);
|
2936
3037
|
this._context.setCallLocalVideoStream(this._callIdRef.callId, [...localVideoStreams]);
|
3038
|
+
/* @conditional-compile-remove(video-background-effects) */
|
3039
|
+
{
|
3040
|
+
const localVideoStreamKey = event.added[0].source.id;
|
3041
|
+
(_a = this._localVideoStreamVideoEffectsSubscribers.get(localVideoStreamKey)) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
3042
|
+
this._localVideoStreamVideoEffectsSubscribers.set(localVideoStreamKey, new LocalVideoStreamVideoEffectsSubscriber({
|
3043
|
+
parent: this._callIdRef,
|
3044
|
+
context: this._context,
|
3045
|
+
localVideoStream: this._call.localVideoStreams[0],
|
3046
|
+
localVideoStreamEffectsAPI: this._call.localVideoStreams[0].feature(communicationCalling.Features.VideoEffects)
|
3047
|
+
}));
|
3048
|
+
}
|
2937
3049
|
}
|
2938
3050
|
if (event.removed.length > 0) {
|
3051
|
+
/* @conditional-compile-remove(video-background-effects) */
|
3052
|
+
{
|
3053
|
+
const localVideoStreamKey = event.removed[0].source.id;
|
3054
|
+
(_b = this._localVideoStreamVideoEffectsSubscribers.get(localVideoStreamKey)) === null || _b === void 0 ? void 0 : _b.unsubscribe();
|
3055
|
+
}
|
2939
3056
|
disposeView(this._context, this._internalContext, this._callIdRef.callId, undefined, convertSdkLocalStreamToDeclarativeLocalStream(event.removed[0]));
|
2940
3057
|
this._internalContext.deleteLocalRenderInfo(this._callIdRef.callId);
|
2941
3058
|
this._context.setCallLocalVideoStream(this._callIdRef.callId, []);
|
@@ -2953,6 +3070,8 @@ class CallSubscriber {
|
|
2953
3070
|
this._participantSubscribers = new Map();
|
2954
3071
|
this._recordingSubscriber = new RecordingSubscriber(this._callIdRef, this._context, this._call.feature(communicationCalling.Features.Recording));
|
2955
3072
|
this._transcriptionSubscriber = new TranscriptionSubscriber(this._callIdRef, this._context, this._call.feature(communicationCalling.Features.Transcription));
|
3073
|
+
/* @conditional-compile-remove(video-background-effects) */
|
3074
|
+
this._localVideoStreamVideoEffectsSubscribers = new Map();
|
2956
3075
|
this.subscribe();
|
2957
3076
|
}
|
2958
3077
|
addParticipantListener(participant) {
|
@@ -3454,6 +3573,10 @@ class InternalCallContext {
|
|
3454
3573
|
// The key is the stream ID. We assume each stream ID to only have one owning render info
|
3455
3574
|
this._unparentedRenderInfos = new Map();
|
3456
3575
|
this._callIdHistory = new CallIdHistory();
|
3576
|
+
// Used for keeping track of video effects subscribers that are not part of a Call.
|
3577
|
+
// The key is the stream ID. We assume each stream ID
|
3578
|
+
/* @conditional-compile-remove(video-background-effects) */
|
3579
|
+
this._unparentedViewVideoEffectsSubscriber = new Map();
|
3457
3580
|
}
|
3458
3581
|
setCallId(newCallId, oldCallId) {
|
3459
3582
|
this._callIdHistory.updateCallIdHistory(newCallId, oldCallId);
|
@@ -3528,8 +3651,25 @@ class InternalCallContext {
|
|
3528
3651
|
this._unparentedRenderInfos.set(statefulStream.source.id, { stream, status, renderer });
|
3529
3652
|
}
|
3530
3653
|
deleteUnparentedRenderInfo(localVideoStream) {
|
3654
|
+
var _a;
|
3655
|
+
/* @conditional-compile-remove(video-background-effects) */
|
3656
|
+
(_a = this._unparentedViewVideoEffectsSubscriber.get(localVideoStream.source.id)) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
3531
3657
|
this._unparentedRenderInfos.delete(localVideoStream.source.id);
|
3532
3658
|
}
|
3659
|
+
subscribeToUnparentedViewVideoEffects(localVideoStream, callContext) {
|
3660
|
+
var _a;
|
3661
|
+
/* @conditional-compile-remove(video-background-effects) */
|
3662
|
+
{
|
3663
|
+
// Ensure we aren't setting multiple subscriptions
|
3664
|
+
(_a = this._unparentedViewVideoEffectsSubscriber.get(localVideoStream.source.id)) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
3665
|
+
this._unparentedViewVideoEffectsSubscriber.set(localVideoStream.source.id, new LocalVideoStreamVideoEffectsSubscriber({
|
3666
|
+
parent: 'unparented',
|
3667
|
+
context: callContext,
|
3668
|
+
localVideoStream: localVideoStream,
|
3669
|
+
localVideoStreamEffectsAPI: localVideoStream.feature(communicationCalling.Features.VideoEffects)
|
3670
|
+
}));
|
3671
|
+
}
|
3672
|
+
}
|
3533
3673
|
// UnparentedRenderInfos are not cleared as they are not part of the Call state.
|
3534
3674
|
clearCallRelatedState() {
|
3535
3675
|
this._remoteRenderInfos.clear();
|