Promise that resolves to a Map<string, boolean> indicating the permission status.Optionalpermissions: Permission
Specifies the type of media permission to request.
Allowed value: Permission
A Promise that resolves to a Map<string, boolean> where:
true indicates permission is grantedfalse indicates permission is deniedimport { Constants, useMediaDevice } from "@videosdk.live/react-sdk";
const { checkPermissions } = useMediaDevice();
try {
const checkAudioVideoPermission = await checkPermissions();
console.log(
"check Audio and Video Permissions",
checkAudioVideoPermission.get(Constants.permission.AUDIO),
checkAudioVideoPermission.get(Constants.permission.VIDEO)
);
} catch (ex) {
console.log("Error checking permissions:", ex);
}
Note
This method will throw an error if the browser does not support permission checking functionality.
Promise resolves with an array of CameraDeviceInfo objects, or an empty array if the cameras could not be listed.Promise resolves with an array of DeviceInfo objects, or an empty array if the devices could not be listed.Promise resolves with an array of MicrophoneDeviceInfo objects, or an empty array if the microphones could not be listed.Promise resolves with an array of PlaybackDeviceInfo objects, or an empty array if the playback devices could not be listed.Optionalpermissions: Permission
Specifies the type of media permission to request.
Allowed value: Permission
import { Constants, useMediaDevice } from "@videosdk.live/react-sdk";
const { requestPermission } = useMediaDevice();
try {
const permissionsMap = await requestPermission(
Constants.permission.AUDIO_AND_VIDEO
);
console.log(
"request Audio and Video Permissions",
permissionsMap.get(Constants.permission.AUDIO),
permissionsMap.get(Constants.permission.VIDEO)
);
} catch (ex) {
console.log("Error in requestPermission ", ex);
}
Note
requestPermission()will throw an error when matching media is not available.
An array of currently available media devices.
useMediaDeviceprovides methods and events to manage media devices and handle media permission access.