Skip to main content

Handling Device Permissions

Before allowing users to interact with their camera and microphone, it's important to check if the necessary permissions are granted on their iOS device. Dyte's iOS Core SDK provides easy-to-use APIs to check the status of these permissions.

Checking Permissions

Use the following APIs to check if the camera and microphone permissions are granted:

// Check if CAMERA permission is granted
let cameraPermissionGranted = meeting.localUser.isCameraPermissionGranted

// Check if RECORD_AUDIO (microphone) permission is granted
let micPermissionGranted = meeting.localUser.isMicrophonePermissionGranted

Alternatively, you can also use standard way to check if these permissions are granted:

if AVCaptureDevice.authorizationStatusForMediaType(AVMediaTypeVideo) ==  AVAuthorizationStatus.Authorized {
// Already Authorized
} else {
AVCaptureDevice.requestAccessForMediaType(AVMediaTypeVideo, completionHandler: { (granted: Bool) -> Void in
if granted == true {
// User granted
} else {
// User rejected

Refer to the iOS official documentation for more information on checking permissions.

You can use the permission status to enable or disable camera and microphone buttons in the pre-call UI, or provide visual feedback to indicate the availability of these media devices.

Automatic Permission Request

When the Dyte SDK is initialised, it automatically checks for the required media permissions. If the permissions are not granted, the SDK requests them on behalf of the developers.