Type Method

authorizationStatus(for:)

Returns a constant indicating whether the app has permission for recording a specified media type.

Declaration

class func authorizationStatus(for mediaType: AVMediaType) -> AVAuthorizationStatus

Parameters

mediaType

A media type constant, either video or audio.

Return Value

A constant indicating authorization status.

Discussion

Recording audio or video always requires explicit permission from the user. The first time you create any AVCaptureDeviceInput objects for a media type that requires permission, the system automatically displays an alert to request recording permission.

After the user grants recording permission, the system remembers the choice for future use in the same app, but the user can change this choice at any time using the Settings app. If the user has denied your app recoding permission or has not yet responded to the permission prompt, any audio recordings will contain only silence and any video recordings will contain only black frames.

If this method returns AVAuthorizationStatus.notDetermined, you can call requestAccess(for:completionHandler:) to prompt the user for recording permission.

Calling this method with any media type other than video or audio raises an exception.

See Also

Verifying Authorization

class func requestAccess(for: AVMediaType, completionHandler: (Bool) -> Void)

Requests the user’s permission, if needed, for recording a specified media type.

enum AVAuthorizationStatus

Constants that provide information regarding permission to use media capture devices.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software