You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/communication-services/tutorials/call-readiness/call-readiness-tutorial-part-2-requesting-device-access.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,14 +26,14 @@ Access the full code for this tutorial on [GitHub](https://github.com/Azure-Samp
26
26
## Requesting access to the camera and microphone
27
27
28
28
For calling applications, it's often vital a user has given permission to use the microphone and camera.
29
-
In this section, we'll create a series of components that will encourage the user to grant access to the camera and microphone.
30
-
We'll display prompts to the user to guide them through granting access.
31
-
We'll also inform the user with a prompt if access isn't granted.
29
+
In this section, we create a series of components that will encourage the user to grant access to the camera and microphone.
30
+
We display prompts to the user to guide them through granting access.
31
+
We inform the user with a prompt if access isn't granted.
32
32
33
33
### Creating prompts for camera and microphone access
34
34
35
-
We'll first create a series of device permissions prompts to get users into a state where they've accepted the microphone and camera permissions. These prompts will use the `CameraAndMicrophoneSitePermissions` component
36
-
from the UI Library. Like the Unsupported Browser prompt, we'll also host these prompts inside a FluentUI `modal`.
35
+
We first create a series of device permissions prompts to get users into a state where they've accepted the microphone and camera permissions. These prompts will use the `CameraAndMicrophoneSitePermissions` component
36
+
from the UI Library. Like the Unsupported Browser prompt, we host these prompts inside a FluentUI `modal`.
Here we'll add two new utility functions to check and request for camera and microphone access. Create a file called `devicePermissionUtils.ts` with two functions `checkDevicePermissionsState` and `requestCameraAndMicrophonePermissions`.
74
-
`checkDevicePermissionsState` will use the [PermissionAPI](https://developer.mozilla.org/docs/Web/API/Permissions_API). However, querying for camera and microphone isn't supported on Firefox and thus we ensure this method returns `unknown` in this case. Later we'll ensure we handle the `unknown` case when prompting the user for permissions.
73
+
Here we add two new utility functions to check and request for camera and microphone access. Create a file called `devicePermissionUtils.ts` with two functions `checkDevicePermissionsState` and `requestCameraAndMicrophonePermissions`.
74
+
`checkDevicePermissionsState` will use the [PermissionAPI](https://developer.mozilla.org/docs/Web/API/Permissions_API). However, querying for camera and microphone isn't supported on Firefox and thus we ensure this method returns `unknown` in this case. Later we ensure we handle the `unknown` case when prompting the user for permissions.
### Prompting the user to grant access to the camera and microphone
112
112
113
-
Now we have the prompts and check and request logic, we'll create a `DeviceAccessComponent` to prompt the user regarding device permissions.
114
-
In this component we'll display different prompts to the user based on the device permission state:
113
+
Now we have the prompts and check and request logic, we create a `DeviceAccessComponent` to prompt the user regarding device permissions.
114
+
In this component we display different prompts to the user based on the device permission state:
115
115
116
-
- If the device permission state is unknown, we'll display a prompt to the user informing them we're checking for device permissions.
117
-
- If we're requesting permissions, we'll display a prompt to the user encouraging them to accept the permissions request.
118
-
- If the permissions are denied, we'll display a prompt to the user informing them that they've denied permissions, and that they'll need to grant permissions to continue.
116
+
- If the device permission state is unknown, we display a prompt to the user informing them we're checking for device permissions.
117
+
- If we're requesting permissions, we display a prompt to the user encouraging them to accept the permissions request.
118
+
- If the permissions are denied, we display a prompt to the user informing them that they've denied permissions, and that they need to grant permissions to continue.
0 commit comments