Platforms to show: All Mac Windows Linux Cross-Platform

Back to AVCaptureDeviceMBS class.

AVCaptureDeviceMBS.authorizationStatusForMediaType(mediaType as string) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 18.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the client's authorization status for accessing the underlying hardware that supports a given media type.

Mediatype: The media type, either AVMediaTypeVideo or AVMediaTypeAudio.
Returns the authorization status of the client

This method returns the AVAuthorizationStatus of the client for accessing the underlying hardware supporting the media type. Media type constants are defined in AVFoundationMBS. If any media type other than AVMediaTypeVideo or AVMediaTypeAudio is supplied, an NSInvalidArgumentException will be thrown. If the status is AVAuthorizationStatusNotDetermined, you may use the requestAccessForMediaType method to request access by prompting the user.

see
https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos?language=objc

Some examples using this method:

AVCaptureDeviceMBS.available as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Whether this class is available.

Returns true on Mac OS X 10.7 and newer.

AVCaptureDeviceMBS.AVCaptureMaxAvailableTorchLevel as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 14.0 ✅ Yes ❌ No ❌ No ✅ Yes All
The maximum torch level.

This constant always represents the maximum available torch level, independent of the actual maximum value currently supported by the device. Thus, pass this constant to the setTorchModeOnWithLevel:error: in situations where you want to specify the maximum torch level without having to worry about whether the device is overheating and might not accept a value of 1.0 as the maximum.
Available in OS X v10.9 and later.

AVCaptureDeviceMBS.defaultDeviceWithMediaType(mediaType as string) as AVCaptureDeviceMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the default device used to capture data of a given media type.
Example
dim device as AVCaptureDeviceMBS = AVCaptureDeviceMBS.defaultDeviceWithMediaType(AVFoundationMBS.AVMediaTypeAudio)
MsgBox device.localizedName

mediaType: A media type identifier.
For possible values, see AV Foundation Constants Reference.

Some examples using this method:

AVCaptureDeviceMBS.devices as AVCaptureDeviceMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array of the available capture devices on the system.
Example
dim devices() as AVCaptureDeviceMBS = AVCaptureDeviceMBS.devices
dim names() as string

for each d as AVCaptureDeviceMBS in devices
names.Append d.localizedName
next

// show all names in a message dialog
MsgBox Join(names, EndOfLine)

AVCaptureDeviceMBS.devicesWithMediaType(mediaType as string) as AVCaptureDeviceMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array of the devices able to capture data of a given media type.
Example
dim devices() as AVCaptureDeviceMBS = AVCaptureDeviceMBS.devicesWithMediaType(AVFoundationMBS.AVMediaTypeAudio)
dim names() as string

for each d as AVCaptureDeviceMBS in devices
names.Append d.localizedName
next

// show all names of audio devices in a message dialog
MsgBox Join(names, EndOfLine)

mediaType: A media type identifier.
For possible values, see AV Foundation Constants Reference.

Some examples using this method:

AVCaptureDeviceMBS.deviceWithUniqueID(deviceUniqueID as string) as AVCaptureDeviceMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the device with a given ID.

deviceUniqueID: The ID of a capture device.

AVCaptureDeviceMBS.requestAccessForMediaType(mediaType as string, tag as variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 18.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Requests access to the underlying hardware for the media type, showing a dialog to the user if necessary.

mediaType: The media type, either AVMediaTypeVideo or AVMediaTypeAudio

Use this function to request access to the hardware for a given media type. Media type constants are defined in AVFoundationMBS
If any media type other than AVMediaTypeVideo or AVMediaTypeAudio is supplied, an NSInvalidArgumentException will be thrown.

This call will not block while the user is being asked for access, allowing the client to continue running. Until access has been granted, any AVCaptureDevices for the media type will vend silent audio samples or black video frames. The user is only asked for permission the first time the client requests access. Later calls use the permission granted by the user.

Note that the authorization dialog will automatically be shown if the status is AVAuthorizationStatusNotDetermined when creating an AVCaptureDeviceInput.

Invoking this method with AVMediaTypeAudio is equivalent to calling AVAudioSessionMBS.requestRecordPermission.

Call returns directly as request is performed on thread.
The requestAccessForMediaTypeCompleted event is called later in your AVFoundationMBS subclass with results on main thread.
The granted value will always true for MacOS 10.13 or older.

see
https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos?language=objc

Some examples using this method:

The items on this page are in the following plugins: MBS AVFoundation Plugin.


The biggest plugin in space...