---
name: "SDL_GetCameraPermissionState"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_GetCameraPermissionState"
---

# SDL\_GetCameraPermissionState(3)

Query if camera access has been approved by the user.

## NAME

SDL\_GetCameraPermissionState - Query if camera access has been approved by the user.

## HEADER FILE

Defined in SDL3/SDL\_camera.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**int SDL\_GetCameraPermissionState(SDL\_Camera \*camera);**

## DESCRIPTION

Cameras will not function between when the device is opened by the app and when the user permits access to the hardware. On some platforms, this presents as a popup dialog where the user has to explicitly approve access; on others the approval might be implicit and not alert the user at all.

This function can be used to check the status of that approval. It will return 0 if still waiting for user response, 1 if the camera is approved for use, and -1 if the user denied access.

Instead of polling with this function, you can wait for a

**SDL\_EVENT\_CAMERA\_DEVICE\_APPROVED**\
  (or

**SDL\_EVENT\_CAMERA\_DEVICE\_DENIED** ) event in the standard SDL event loop, which is guaranteed to be sent once when permission to use the camera is decided.

If a camera is declined, there's nothing to be done but call

**SDL\_CloseCamera** () to dispose of it.

## FUNCTION PARAMETERS

- *camera*

  the opened camera device to query.

## RETURN VALUE

Returns -1 if user denied access to the camera, 1 if user approved access, 0 if no decision has been made yet.

## THREAD SAFETY

It is safe to call this function from any thread.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_OpenCamera**(3)](/SDL_OpenCamera/3.md), **•**(3), [**SDL\_CloseCamera**(3)](/SDL_CloseCamera/3.md)
