Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "patch",
"area": "fix",
"workstream": "LocalPreview",
"comment": "Mobile configuration page enable device button when either microphone or camera is available",
"packageName": "@azure/communication-react",
"email": "edwardlee@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "patch",
"area": "fix",
"workstream": "LocalPreview",
"comment": "Mobile configuration page enable device button when either microphone or camera is available",
"packageName": "@azure/communication-react",
"email": "edwardlee@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export const LocalPreview = (props: LocalPreviewProps): JSX.Element => {
data-ui-id="call-composite-local-device-settings-options-button"
{...devicesButtonProps}
// disable button whilst all other buttons are disabled
disabled={!microphonePermissionGranted || !cameraPermissionGranted || hasNoDevices}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose technically we should be checking both the permission cross referencing those if there are devices for each?

const hasNoMics = !microphonePermissionGranted || !devicesButtonProps.microphones.length;
const hasNoSpeakers = !devicesButtonProps.speakers.length; // any permission needed here?
const hasNoCamera = !cameraPermissionGranted || !devicesButtonProps.cameras.length;
disabled = hasNoMics && hasNoSpeakers && hasNoCamera;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking of the case where we have cameras, but no camera permission

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although no permission maybe means we have no cameras... Though not sure if no camera via the role capability means that

Copy link
Copy Markdown
Member

@JamesBurnside JamesBurnside Dec 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually yeah no we just need to check the camera permission - ignore all this ^_^

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reopening -- but only because we might have no camera permission and no mic permission -- but still want to change the speaker.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking of the case where we have cameras, but no camera permission

No! I was thinking of the case where we have camera permission, but no cameras and we have microphones but no microphone permission (and lets assume no speakers). Then the button won't be disabled when it should be

Copy link
Copy Markdown
Member

@JamesBurnside JamesBurnside Dec 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you tell its the Friday before xmas 🎅

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this, as it does a check for when devices have no microphone or camera present despite having permissions.
However, the hasNoDevices does something similar here for this specific case so we are covered I believe.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there's still a couple edge cases:

  • no camera or microphone permission but user wishes to change speaker (button will be disabled when it should not)
  • we have camera permission and no cameras, and we have no microphone permission but do have mics, and have no speakers (button will be enabled when it should not)

disabled={(!microphonePermissionGranted && !cameraPermissionGranted) || hasNoDevices}
showLabel={true}
// disable tooltip as it obscures list of devices on mobile
strings={props.mobileView ? { tooltipContent: '' } : {}}
Expand Down