Skip to content

Commit dbcf2b0

Browse files
prabhjot-msftcarocao-msft
authored andcommitted
Video Effects Button and Pane (#2825)
* Video effects button and Pane * Change files * Duplicate change files for beta release * minor change * minor changes * minor changes * minor change * minor change * minor changes
1 parent fd7269b commit dbcf2b0

11 files changed

Lines changed: 106 additions & 4 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "pre-release",
3+
"comment": "Video Effects Button and Pane",
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": "pre-release",
3+
"comment": "Video Effects Button and Pane",
4+
"packageName": "@azure/communication-react",
5+
"email": "97124699+prabhjot-msft@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}

packages/communication-react/review/beta/communication-react.api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,7 @@ export interface CameraButtonProps extends ControlBarButtonProps {
10761076
enableDeviceSelectionMenu?: boolean;
10771077
localVideoViewOptions?: VideoStreamOptions;
10781078
onSelectCamera?: (device: OptionsDevice) => Promise<void>;
1079+
onShowVideoEffectsPicker?: (showVideoEffectsOptions: boolean) => void;
10791080
onToggleCamera?: (options?: VideoStreamOptions) => Promise<void>;
10801081
selectedCamera?: OptionsDevice;
10811082
strings?: Partial<CameraButtonStrings>;
@@ -1846,6 +1847,7 @@ export const DEFAULT_COMPONENT_ICONS: {
18461847
SplitButtonPrimaryActionMicMuted: JSX.Element;
18471848
VerticalGalleryLeftButton: JSX.Element;
18481849
VerticalGalleryRightButton: JSX.Element;
1850+
OptionsVideoBackgroundEffect: JSX.Element;
18491851
};
18501852

18511853
// @public
@@ -1949,6 +1951,7 @@ export const DEFAULT_COMPOSITE_ICONS: {
19491951
SplitButtonPrimaryActionMicMuted: JSX.Element;
19501952
VerticalGalleryLeftButton: JSX.Element;
19511953
VerticalGalleryRightButton: JSX.Element;
1954+
OptionsVideoBackgroundEffect: JSX.Element;
19521955
};
19531956

19541957
// @beta

packages/react-components/review/beta/react-components.api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ export interface CameraButtonProps extends ControlBarButtonProps {
166166
enableDeviceSelectionMenu?: boolean;
167167
localVideoViewOptions?: VideoStreamOptions;
168168
onSelectCamera?: (device: OptionsDevice) => Promise<void>;
169+
onShowVideoEffectsPicker?: (showVideoEffectsOptions: boolean) => void;
169170
onToggleCamera?: (options?: VideoStreamOptions) => Promise<void>;
170171
selectedCamera?: OptionsDevice;
171172
strings?: Partial<CameraButtonStrings>;
@@ -564,6 +565,7 @@ export const DEFAULT_COMPONENT_ICONS: {
564565
SplitButtonPrimaryActionMicMuted: JSX.Element;
565566
VerticalGalleryLeftButton: JSX.Element;
566567
VerticalGalleryRightButton: JSX.Element;
568+
OptionsVideoBackgroundEffect: JSX.Element;
567569
};
568570

569571
// @internal

packages/react-components/src/components/CameraButton.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ export interface CameraButtonProps extends ControlBarButtonProps {
147147
* Styles for {@link CameraButton} and the device selection flyout.
148148
*/
149149
styles?: Partial<CameraButtonStyles>;
150+
/* @conditional-compile-remove(video-background-effects) */
151+
/**
152+
* Callback when a effects is clicked
153+
*/
154+
onShowVideoEffectsPicker?: (showVideoEffectsOptions: boolean) => void;
150155
}
151156

152157
/**
@@ -218,6 +223,18 @@ export const CameraButton = (props: CameraButtonProps): JSX.Element => {
218223
iconName: props.checked ? 'SplitButtonPrimaryActionCameraOn' : 'SplitButtonPrimaryActionCameraOff',
219224
styles: { root: { lineHeight: 0 } }
220225
}
226+
},
227+
/* @conditional-compile-remove(video-background-effects) */
228+
{
229+
key: 'effects',
230+
text: 'Effects',
231+
title: 'Video Effects',
232+
iconProps: { iconName: 'OptionsVideoBackgroundEffect', styles: { root: { lineHeight: 0 } } },
233+
onClick: () => {
234+
if (props.onShowVideoEffectsPicker) {
235+
props.onShowVideoEffectsPicker(true);
236+
}
237+
}
221238
}
222239
]
223240
}

packages/react-components/src/theming/icons.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ import {
4444
} from '@fluentui/react-icons';
4545
/* @conditional-compile-remove(call-readiness) */
4646
import { Important20Filled } from '@fluentui/react-icons';
47-
47+
/* @conditional-compile-remove(video-background-effects) */
48+
import { VideoBackgroundEffect20Regular } from '@fluentui/react-icons';
4849
/* @conditional-compile-remove(pinned-participants) */
4950
import {
5051
Pin16Filled,
@@ -290,5 +291,7 @@ export const DEFAULT_COMPONENT_ICONS = {
290291
/* @conditional-compile-remove(vertical-gallery) */
291292
VerticalGalleryLeftButton: <ChevronLeft20Regular />,
292293
/* @conditional-compile-remove(vertical-gallery) */
293-
VerticalGalleryRightButton: <ChevronRight20Regular />
294+
VerticalGalleryRightButton: <ChevronRight20Regular />,
295+
/* @conditional-compile-remove(video-background-effects) */
296+
OptionsVideoBackgroundEffect: <VideoBackgroundEffect20Regular />
294297
};

packages/react-composites/review/beta/react-composites.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,7 @@ export const DEFAULT_COMPOSITE_ICONS: {
11441144
SplitButtonPrimaryActionMicMuted: JSX.Element;
11451145
VerticalGalleryLeftButton: JSX.Element;
11461146
VerticalGalleryRightButton: JSX.Element;
1147+
OptionsVideoBackgroundEffect: JSX.Element;
11471148
};
11481149

11491150
// @beta

packages/react-composites/src/composites/CallComposite/components/buttons/Camera.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export const Camera = (props: {
1515
styles?: ControlBarButtonStyles;
1616
splitButtonsForDeviceSelection?: boolean;
1717
disabled?: boolean;
18+
/* @conditional-compile-remove(video-background-effects) */
19+
onShowVideoEffectsPicker?: (showVideoEffectsOptions: boolean) => void;
1820
}): JSX.Element => {
1921
const cameraButtonProps = usePropsFor(CameraButton);
2022
const styles = useMemo(() => concatButtonBaseStyles(props.styles ?? {}), [props.styles]);
@@ -26,6 +28,8 @@ export const Camera = (props: {
2628
styles={styles}
2729
enableDeviceSelectionMenu={props.splitButtonsForDeviceSelection}
2830
disabled={cameraButtonProps.disabled || props.disabled}
31+
/* @conditional-compile-remove(video-background-effects) */
32+
onShowVideoEffectsPicker={props.onShowVideoEffectsPicker}
2933
/>
3034
);
3135
};

packages/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ import { CallCompositeOptions } from '../CallComposite/CallComposite';
4040
/* @conditional-compile-remove(call-readiness) */
4141
import { DeviceCheckOptions } from '../CallComposite/CallComposite';
4242
import { drawerContainerStyles } from '../CallComposite/styles/CallComposite.styles';
43+
/* @conditional-compile-remove(video-background-effects) */
44+
import { VideoEffectsPane } from '../common/VideoEffectsPane';
4345

4446
/**
4547
* Props required for the {@link CallWithChatComposite}
@@ -236,7 +238,16 @@ type CallWithChatScreenProps = {
236238
const CallWithChatScreen = (props: CallWithChatScreenProps): JSX.Element => {
237239
const { callWithChatAdapter, fluentTheme, formFactor = 'desktop' } = props;
238240
const mobileView = formFactor === 'mobile';
239-
241+
/* @conditional-compile-remove(video-background-effects) */
242+
const [showVideoEffectsPane, setVideoEffectsPane] = useState(false);
243+
244+
/* @conditional-compile-remove(video-background-effects) */
245+
const setShowVideoEffectsPane = useCallback(
246+
(showVideoEffectsOptions: boolean): void => {
247+
setVideoEffectsPane(showVideoEffectsOptions);
248+
},
249+
[setVideoEffectsPane]
250+
);
240251
if (!callWithChatAdapter) {
241252
throw new Error('CallWithChatAdapter is undefined');
242253
}
@@ -421,7 +432,13 @@ const CallWithChatScreen = (props: CallWithChatScreenProps): JSX.Element => {
421432
fluentTheme={fluentTheme}
422433
/>
423434
</Stack.Item>
424-
435+
{
436+
/* @conditional-compile-remove(video-background-effects) */
437+
<VideoEffectsPane
438+
showVideoEffectsOptions={showVideoEffectsPane}
439+
setshowVideoEffectsOptions={setShowVideoEffectsPane}
440+
/>
441+
}
425442
{chatProps.adapter && callAdapter && hasJoinedCall && (
426443
<CallWithChatPane
427444
chatCompositeProps={chatProps}
@@ -463,6 +480,8 @@ const CallWithChatScreen = (props: CallWithChatScreenProps): JSX.Element => {
463480
containerWidth={containerWidth}
464481
/* @conditional-compile-remove(PSTN-calls) */
465482
onClickShowDialpad={alternateCallerId ? onClickShowDialpad : undefined}
483+
/* @conditional-compile-remove(video-background-effects) */
484+
onShowVideoEffectsPicker={setShowVideoEffectsPane}
466485
/>
467486
</Stack.Item>
468487
</ChatAdapterProvider>

packages/react-composites/src/composites/CallWithChatComposite/CallWithChatControlBar.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ export interface CallWithChatControlBarProps {
4848
disableButtonsForHoldScreen?: boolean;
4949
/* @conditional-compile-remove(PSTN-calls) */
5050
onClickShowDialpad?: () => void;
51+
/* @conditional-compile-remove(video-background-effects) */
52+
onShowVideoEffectsPicker?: (showVideoEffectsOptions: boolean) => void;
5153
}
5254

5355
const inferCallWithChatControlOptions = (
@@ -188,6 +190,8 @@ export const CallWithChatControlBar = (props: CallWithChatControlBarProps & Cont
188190
splitButtonsForDeviceSelection={!props.mobileView}
189191
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
190192
disabled={props.disableButtonsForHoldScreen || isDisabled(options.cameraButton)}
193+
/* @conditional-compile-remove(video-background-effects) */
194+
onShowVideoEffectsPicker={props.onShowVideoEffectsPicker}
191195
/>
192196
)}
193197
{props.mobileView && isEnabled(options?.chatButton) && chatButton}

0 commit comments

Comments
 (0)