Platforms to show: All Mac Windows Linux Cross-Platform

AVCaptureDeviceMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
An AVCaptureDevice object represents a physical capture device and the properties associated with that device.
Example
dim device as AVCaptureDeviceMBS = AVCaptureDeviceMBS.defaultDeviceWithMediaType(AVFoundationMBS.AVMediaTypeVideo)
MsgBox device.localizedName

You use a capture device to configure the properties of the underlying hardware. A capture device also provides input data (such as audio or video) to an AVCaptureSession object.

You use the methods of the AVCaptureDevice class to enumerate the available devices, query their capabilities, and be informed about when devices come and go. Before you attempt to set properties of a capture device (its focus mode, exposure mode, and so on), you must first acquire a lock on the device using the lockForConfiguration method. You can then set the properties and release the lock using the unlockForConfiguration method. You may hold the lock if you want all settable device properties to remain unchanged. However, holding the device lock unnecessarily may degrade capture quality in other applications sharing the device and is not recommended.

May work for all built-in cameras and microphones as well as external USB webcams, as far as Apple supports them.
This is an abstract class. You can't create an instance, but you can get one from various plugin functions.

Authorization

Constant Value Description
AVAuthorizationStatusAuthorized 3 The client is authorized to access the hardware supporting a media type. This is default for MacOS 10.13 or older.
AVAuthorizationStatusDenied 2 The user explicitly denied access to the hardware supporting a media type for the client.
AVAuthorizationStatusNotDetermined 0 Indicates that the user has not yet made a choice regarding whether the client can access the hardware.
AVAuthorizationStatusRestricted 1 The client is not authorized to access the hardware for the media type. The user cannot change the client's status, possibly due to active restrictions such as parental controls being in place.

Device Position Modes

Constant Value Description
AVCaptureDevicePositionBack 1 The capture device is on the back of the unit.
AVCaptureDevicePositionFront 2 The capture device is on the front of the unit.
AVCaptureDevicePositionUnspecified 0 The capture device's position relative to the system hardware is unspecified.

Transport Control Modes

Constant Value Description
AVCaptureDeviceTransportControlsNotPlayingMode 0 Indicates that the tape transport is not threaded through the play head.
AVCaptureDeviceTransportControlsPlayingMode 1 Indicates that the tape transport is threaded through the play head.

Exposure Mode Constants

Constant Value Description
AVCaptureExposureModeAutoExpose 1 The device continuously monitors exposure levels and auto exposes when necessary.
AVCaptureExposureModeContinuousAutoExposure 2 The device performs an auto-expose operation now.
Example
AVCaptureExposureModeLocked 0 The exposure setting is locked.

Flash Modes

Constant Value Description
AVCaptureFlashModeAuto 2 The capture device continuously monitors light levels and uses the flash when necessary.
AVCaptureFlashModeOff 0 The capture device flash is always off.
AVCaptureFlashModeOn 1 The capture device flash is always on.

Focus Modes

Constant Value Description
AVCaptureFocusModeAutoFocus 1 The capture device performs an autofocus operation now.
AVCaptureFocusModeContinuousAutoFocus 2 The capture device continuously monitors focus and auto focuses when necessary.
AVCaptureFocusModeLocked 0 The focus is locked.

Torch Modes

Constant Value Description
AVCaptureTorchModeAuto 2 The capture device continuously monitors light levels and uses the torch when necessary.
AVCaptureTorchModeOff 0 The capture device torch is always off.
AVCaptureTorchModeOn 1 The capture device torch is always on.

White Balance Modes

Constant Value Description
AVCaptureWhiteBalanceModeAutoWhiteBalance 1 The device performs an auto white balance operation now.
AVCaptureWhiteBalanceModeContinuousAutoWhiteBalance 2 The device continuously monitors white balance and adjusts when necessary.
AVCaptureWhiteBalanceModeLocked 0 The white balance setting is locked.

This class has no sub classes.

Some methods using this class:

Some events using this class:

Some examples using this class:

Blog Entries

Xojo Developer Magazine

Release notes

  • Version 23.5
    • Added methods to work with reaction effects on macOS 14 and iOS 17 with AVCaptureDeviceMBS class.
  • Version 22.2
  • Version 20.2
  • Version 18.4
    • Added authorizationStatusForMediaType and requestAccessForMediaType methods for AVCaptureDeviceMBS class for MacOS 10.14 Mojave. For older MacOS versions we always report authorized.

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


AVCaptureDeviceInputSourceMBS   -   AVCaptureFileOutputMBS


The biggest plugin in space...