Skip to content

Commit c6d0e7d

Browse files
Fix scaling mode when selecting camera (#4502)
* Update default scaling mode to Crop when selecting a camera * Change files --------- Co-authored-by: Donald McEachern <94866715+dmceachernmsft@users.noreply.github.com>
1 parent e011179 commit c6d0e7d

3 files changed

Lines changed: 27 additions & 3 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "fix",
4+
"workstream": "Scaling mode",
5+
"comment": "Update default scaling mode to Crop when selecting a camera",
6+
"packageName": "@azure/communication-react",
7+
"email": "79475487+mgamis-msft@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "fix",
4+
"workstream": "Scaling mode",
5+
"comment": "Update default scaling mode to Crop when selecting a camera",
6+
"packageName": "@azure/communication-react",
7+
"email": "79475487+mgamis-msft@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ import {
99
IContextualMenuStyles,
1010
merge
1111
} from '@fluentui/react';
12+
import { _preventDismissOnEvent as preventDismissOnEvent } from '@internal/acs-ui-common';
1213
import React from 'react';
1314
import { useLocale } from '../localization';
15+
import { VideoStreamOptions } from '../types';
1416
import { ControlBarButton, ControlBarButtonProps, ControlBarButtonStyles } from './ControlBarButton';
1517
import { _HighContrastAwareIcon } from './HighContrastAwareIcon';
1618
import { buttonFlyoutItemStyles } from './styles/ControlBar.styles';
17-
import { _preventDismissOnEvent as preventDismissOnEvent } from '@internal/acs-ui-common';
19+
20+
const defaultLocalVideoViewOptions = {
21+
scalingMode: 'Crop',
22+
isMirrored: true
23+
} as VideoStreamOptions;
1824

1925
/**
2026
* Styles for the {@link DevicesButton} menu.
@@ -161,7 +167,7 @@ export interface DeviceMenuProps {
161167
selectedMicrophone?: OptionsDevice;
162168
selectedSpeaker?: OptionsDevice;
163169
selectedCamera?: OptionsDevice;
164-
onSelectCamera?: (device: OptionsDevice) => Promise<void>;
170+
onSelectCamera?: (device: OptionsDevice, options?: VideoStreamOptions) => Promise<void>;
165171
onSelectMicrophone?: (device: OptionsDevice) => Promise<void>;
166172
onSelectSpeaker?: (device: OptionsDevice) => Promise<void>;
167173
styles?: Partial<DeviceMenuStyles>;
@@ -296,7 +302,7 @@ export const generateDefaultDeviceMenuProps = (
296302
isChecked: camera.id === selectedCamera?.id,
297303
onClick: () => {
298304
if (camera.id !== selectedCamera?.id) {
299-
onSelectCamera(camera);
305+
onSelectCamera(camera, defaultLocalVideoViewOptions);
300306
}
301307
}
302308
}))

0 commit comments

Comments
 (0)