Skip to content

Commit 12cbb34

Browse files
If video effect fails, none effect in picker is highlighted (#3334)
* If video effect fails, none effect in picker is highlighted * Change files * Duplicate change files for beta release * Minor changes
1 parent 8c39df4 commit 12cbb34

5 files changed

Lines changed: 30 additions & 5 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "If video effect fails, none effect in picker is highlighted",
4+
"packageName": "@azure/communication-react",
5+
"email": "97124699+prabhjot-msft@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "If video effect fails, none effect in picker is highlighted",
4+
"packageName": "@azure/communication-react",
5+
"email": "97124699+prabhjot-msft@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}

packages/react-composites/src/composites/CallComposite/adapter/CallAdapter.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ export type VideoBackgroundEffect =
300300
| VideoBackgroundBlurEffect
301301
| VideoBackgroundReplacementEffect;
302302

303-
/* @conditional-compile-remove(video-background-effects) */
304303
/**
305304
* Contains the attibutes to remove video background effect
306305
*

packages/react-composites/src/composites/CallComposite/selectors/localVideoStreamSelector.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ export const localVideoSelector = reselect.createSelector(
2525
return {
2626
isAvailable: !!localVideoStream,
2727
isMirrored: localVideoStream?.view?.isMirrored,
28-
renderElement: localVideoStream?.view?.target
28+
renderElement: localVideoStream?.view?.target,
29+
/* @conditional-compile-remove(video-background-effects) */
30+
activeVideoEffects: localVideoStream?.videoEffects
2931
};
3032
}
3133
);

packages/react-composites/src/composites/common/VideoEffectsPane.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ export const VideoEffectsPaneContent = (props: {
5050
/* @conditional-compile-remove(video-background-effects) */
5151
const strings = locale.strings.call;
5252
/* @conditional-compile-remove(video-background-effects) */
53+
const activeVideoEffects = useSelector(localVideoSelector).activeVideoEffects?.activeEffects;
54+
/* @conditional-compile-remove(video-background-effects) */
5355
const selectableVideoEffects: _VideoEffectsItemProps[] = useMemo(() => {
5456
const videoEffects: _VideoEffectsItemProps[] = [
5557
{
@@ -98,18 +100,18 @@ export const VideoEffectsPaneContent = (props: {
98100
const blurEffect: VideoBackgroundBlurEffect = {
99101
effectName: effectKey
100102
};
101-
adapter.updateSelectedVideoBackgroundEffect(blurEffect);
102103
activeVideoEffectChange({
103104
type: 'blur',
104105
timestamp: new Date(Date.now())
105106
});
106107
await adapter.startVideoBackgroundEffect(blurEffect);
108+
adapter.updateSelectedVideoBackgroundEffect(blurEffect);
107109
} else if (effectKey === 'none') {
108110
const noneEffect: VideoBackgroundNoEffect = {
109111
effectName: effectKey
110112
};
111-
adapter.updateSelectedVideoBackgroundEffect(noneEffect);
112113
await adapter.stopVideoBackgroundEffects();
114+
adapter.updateSelectedVideoBackgroundEffect(noneEffect);
113115
} else {
114116
const backgroundImg = selectableVideoEffects.find((effect) => {
115117
return effect.itemKey === effectKey;
@@ -120,17 +122,25 @@ export const VideoEffectsPaneContent = (props: {
120122
key: effectKey,
121123
backgroundImageUrl: backgroundImg.backgroundProps.url
122124
};
123-
adapter.updateSelectedVideoBackgroundEffect(replaceEffect);
124125
activeVideoEffectChange({
125126
type: 'replacement',
126127
timestamp: new Date(Date.now())
127128
});
128129
await adapter.startVideoBackgroundEffect(replaceEffect);
130+
adapter.updateSelectedVideoBackgroundEffect(replaceEffect);
129131
}
130132
}
131133
},
132134
[adapter, activeVideoEffectChange, selectableVideoEffects]
133135
);
136+
137+
/* @conditional-compile-remove(video-background-effects) */
138+
if (activeVideoEffectError && activeVideoEffects && activeVideoEffects.length === 0) {
139+
const noneEffect: VideoBackgroundNoEffect = {
140+
effectName: 'none'
141+
};
142+
adapter.updateSelectedVideoBackgroundEffect(noneEffect);
143+
}
134144
return VideoEffectsPaneTrampoline(
135145
onDismissError,
136146
activeVideoEffectError,

0 commit comments

Comments
 (0)