INFO
- This method is supported only on Android devices running Android 12 or later.
- This method is not supported on iOS devices.
import { useMediaDevice } from "@videosdk.live/react-native-sdk";
const { checkBlueToothPermission } = useMediaDevice();
const onPress = async () => {
try {
const hasPermission = await checkBlueToothPermission();
console.log("Bluetooth Permission:", hasPermission);
} catch (error) {
console.log("Error while checking Bluetooth permission", error);
}
};
Promise that resolves to a Map<string, boolean> indicating the permission status.Optionalpermissions: PermissionSpecifies 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-native-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);
}
Promise resolves with an array of PlaybackDeviceInfo objects.Promise resolves with an array of CameraDeviceInfo objects.Promise resolves with an array of DeviceInfo objects.INFO
- This method is supported only on Android devices running Android 12 or later.
- This method is not supported on iOS devices.
import { useMediaDevice } from "@videosdk.live/react-native-sdk";
const { requestBluetoothPermission } = useMediaDevice();
const onPress = async () => {
try {
const hasPermission = await requestBluetoothPermission();
console.log("Bluetooth Permission:", hasPermission);
} catch (error) {
console.log("Error while requesting Bluetooth permission", error);
}
};
Optionalpermissions: PermissionSpecifies the type of media permission to request.
Allowed value: Permission
import { Constants, useMediaDevice } from "@videosdk.live/react-native-sdk";
const { requestPermission } = useMediaDevice();
try {
const permissionsMap = await requestPermission(
Constants.permission.AUDIO_VIDEO
);
console.log(
"request Audio and Video Permissions",
requestAudioVideoPermission.get(Constants.permission.AUDIO),
requestAudioVideoPermission.get(Constants.permission.VIDEO)
);
} catch (ex) {
console.log("Error in requestPermission ", ex);
}
Note
requestPermission()will throw an error when matching media is not available.
NOTE
Make sure you have microphone permission granted on the device, otherwise, this event will not return the list.
An array of currently available media devices.
useMediaDeviceprovides methods and events to manage media devices and handle media permission access.