Platforms to show: All Mac Windows Linux Cross-Platform

Back to AVCaptureDeviceMBS class.

AVCaptureDeviceMBS.availableReactionTypes as String()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 23.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a list of reaction types which can be passed to performEffectForReaction.
Example
Var device as AVCaptureDeviceMBS // your device

MessageBox Join(device.availableReactionTypes, EndOfLine)

The list may differ between devices, or be affected by changes to active format.

Requires macOS 14.0 or iOS 17.0.

List seen on macOS 14.0:

ReactionBalloons
ReactionFireworks
ReactionThumbsUp
ReactionRain
ReactionThumbsDown
ReactionLasers
ReactionConfetti
ReactionHeart

You may check AVCaptureReactionEffectStateMBS.available for whether this is available.

AVCaptureDeviceMBS.Constructor   Private

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The private constructor.

AVCaptureDeviceMBS.formats as AVCaptureDeviceFormatMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
An array of AVCaptureDeviceFormat objects representing the formats supported by the device (read-only)

You can use this property to enumerate the formats natively supported by the receiver.
You can set modelID to any of the formats in this array.
You can observe changes to the value of this property using key-value observing.

AVCaptureDeviceMBS.hasMediaType(mediaType as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a Boolean value that indicates whether the device provides media with a given type.
Example
Var device as AVCaptureDeviceMBS
device = AVCaptureDeviceMBS.defaultDeviceWithMediaType(AVFoundationMBS.AVMediaTypeVideo)
MsgBox str(device.hasMediaType(AVFoundationMBS.AVMediaTypeVideo)) // true
MsgBox str(device.hasMediaType(AVFoundationMBS.AVMediaTypeAudio)) // false

mediaType: A media type, such as AVMediaTypeVideo, AVMediaTypeAudio, or AVMediaTypeMuxed. For a complete list of supported media type constants, see AV Foundation Constants Reference.

Returns true if the device provides media of type mediaType, otherwise false.

Some examples using this method:

AVCaptureDeviceMBS.inputSources as AVCaptureDeviceInputSourceMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
An array of AVCaptureDeviceInputSource objects representing the input sources supported by the device. (read-only)

Some devices can capture data from one of multiple data sources (different input jacks on the same audio device, for example). For devices with multiple possible data sources, you can use this property to enumerate the possible choices.

You can observe changes to the value of this property using key-value observing.

Some examples using this method:

AVCaptureDeviceMBS.isExposureModeSupported(exposureMode as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a Boolean value that indicates whether the given exposure mode is supported.
Example
Var device as AVCaptureDeviceMBS
device = AVCaptureDeviceMBS.defaultDeviceWithMediaType(AVFoundationMBS.AVMediaTypeVideo)
MsgBox str(device.isExposureModeSupported(device.AVCaptureExposureModeAutoExpose))

exposureMode: An exposure mode. See "AVCaptureExposureMode" for possible values.
Returns true if exposureMode is supported, otherwise false.

AVCaptureDeviceMBS.isFlashModeSupported(FlashMode as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a Boolean value that indicates whether the given flash mode is supported.
Example
Var device as AVCaptureDeviceMBS
device = AVCaptureDeviceMBS.defaultDeviceWithMediaType(AVFoundationMBS.AVMediaTypeVideo)
MsgBox str(device.isFlashModeSupported(device.AVCaptureFlashModeAuto))

flashMode: A flash mode. See "AVCaptureFlashMode" for possible values.
Returns true if flashMode is supported, otherwise false.

AVCaptureDeviceMBS.isFocusModeSupported(focusMode as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a Boolean value that indicates whether the given focus mode is supported.
Example
Var device as AVCaptureDeviceMBS
device = AVCaptureDeviceMBS.defaultDeviceWithMediaType(AVFoundationMBS.AVMediaTypeVideo)
MsgBox str(device.isFocusModeSupported(device.AVCaptureFocusModeContinuousAutoFocus))

focusMode: A focus mode. See "AVCaptureFocusMode" for possible values.

Returns true if focusMode is supported, otherwise false.

AVCaptureDeviceMBS.isTorchModeSupported(torchMode as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a Boolean value that indicates whether the device supports the specified torch mode.
Example
Var device as AVCaptureDeviceMBS
device = AVCaptureDeviceMBS.defaultDeviceWithMediaType(AVFoundationMBS.AVMediaTypeVideo)
MsgBox str(device.isTorchModeSupported(device.AVCaptureTorchModeAuto))

torchMode: The desired torch mode. For a list of possible values, see "AVCaptureTorchMode."
Returns true if torchMode is supported, otherwise false.

AVCaptureDeviceMBS.isWhiteBalanceModeSupported(mode as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a Boolean value that indicates whether the given white balance mode is supported.
Example
Var device as AVCaptureDeviceMBS
device = AVCaptureDeviceMBS.defaultDeviceWithMediaType(AVFoundationMBS.AVMediaTypeVideo)
MsgBox str(device.isWhiteBalanceModeSupported(device.AVCaptureWhiteBalanceModeAutoWhiteBalance))

whiteBalanceMode: A focus mode. See "AVCaptureWhiteBalanceMode" for possible values.
Returns true if whiteBalanceMode is supported, otherwise false.

AVCaptureDeviceMBS.linkedDevices as AVCaptureDeviceMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
An array of AVCaptureDevice objects representing the devices physically linked to the receiver. (read-only)
Example
Var device as AVCaptureDeviceMBS
device = AVCaptureDeviceMBS.defaultDeviceWithMediaType(AVFoundationMBS.AVMediaTypeAudio)

Var linkedDevices() as AVCaptureDeviceMBS
linkedDevices = device.linkedDevices

for each d as AVCaptureDeviceMBS in linkedDevices
MsgBox device.localizedName+" → "+d.localizedName
next

The value of this property is an array of AVCaptureDevice objects that are a part of the same physical device as the receiver. For example, for an external iSight camera, the array contains an AVCaptureDevice instance representing the external iSight microphone.

Some examples using this method:

AVCaptureDeviceMBS.lockForConfiguration(byref error as NSErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Requests exclusive access to the device's hardware properties.

Error: If a lock cannot be acquired, this pointer contains an NSError object that describes the problem.

Returns true if a lock was acquired or false if it was not.

You must call this method before attempting to configure the hardware related properties of the device. This method returns true when it successfully locks the device for configuration by your code. After configuring the device properties, call unlockForConfiguration to release the configuration lock and allow other apps to make changes.

You may hold onto a lock (instead of releasing it) if you require the device properties to remain unchanged. However, holding the device lock unnecessarily may degrade capture quality in other apps sharing the device.

Some examples using this method:

AVCaptureDeviceMBS.performEffectForReaction(reactionType as String)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 23.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Triggers a specified reaction on the video stream.
Example
Var device as AVCaptureDeviceMBS // your device

device.performEffectForReaction AVCaptureReactionEffectStateMBS.AVCaptureReactionTypeBalloons

reactionType: Indicates which reaction to perform.

The entries in reactionEffectsInProgress may not reflect one-to-one against calls to this method. Depending on reaction style or resource limits, triggering multiple overlapping reactions of the same type may be coalesced into extending an existing reaction rather than overlaying a new one.

The reactionType requested must be one of those listed in availableReactionTypes or an exception will be thrown. Performing a reaction when canPerformReactionEffects is false is ignored, and VoIP applications are encouraged to transmit and display such reactions outside of the video feed.

Requires macOS 14.0 or iOS 17.0.
You may check AVCaptureReactionEffectStateMBS.available for whether this is available.

AVCaptureDeviceMBS.reactionEffectsInProgress as AVCaptureReactionEffectStateMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 23.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Contains an array of reaction effects that are currently being performed by the device, sorted by timestamp.
Example
Var device as AVCaptureDeviceMBS // your device

Var effects() as AVCaptureReactionEffectStateMBS = device.reactionEffectsInProgress

for each effect as AVCaptureReactionEffectStateMBS in effects
MessageBox effect.reactionType
next

If observing old and new values in the KVO callback, the reaction effects which are still running in the new array will have kCMTimeInvalid as their endTime property. Reaction effects which have ended will only be in the old array, and will have their endTime property set to the presentation time of the first frame where the reaction effect was no longer present.

Reaction effects which are triggered by either a call to performEffectForReaction or by the automatic gesture detection will be reflected in this array. It is key-value observable to be notified when reaction effects begin or end.

Requires macOS 14.0 or iOS 17.0.
You may check AVCaptureReactionEffectStateMBS.available for whether this is available.

AVCaptureDeviceMBS.setTransportControlsPlaybackMode(mode as Integer, speed as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Sets the transport control's playback mode and speed.

mode: An AVCaptureDeviceTransportControlsPlaybackMode constant indicating whether the deck should be put into play mode.
speed: A float value indicating the speed at which to wind or play the tape.

Before changing the value of this property, you must call lockForConfiguration to acquire exclusive access to the device's configuration properties. If you do not, this method raises an exception. When you are done configuring the device, call unlockForConfiguration to release the lock and allow other devices to configure the settings.

Some examples using this method:

AVCaptureDeviceMBS.supportsAVCaptureSessionPreset(preset as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a Boolean value that indicates whether the receiver can be used in an capture session configured with the given preset.
Example
Var device as AVCaptureDeviceMBS
device = AVCaptureDeviceMBS.defaultDeviceWithMediaType(AVFoundationMBS.AVMediaTypeVideo)
MsgBox str(device.supportsAVCaptureSessionPreset(AVFoundationMBS.AVCaptureSessionPreset1280x720))

preset: A capture session preset.

Returns true if the receiver can be used with preset, otherwise false.
An AVCaptureSession instance can be associated with a preset that configures its inputs and outputs to fulfill common use cases. You can use this method to determine if the receiver can be used in a capture session with the given preset. For a list of preset constants, see AVCaptureSession Class Reference.

Some examples using this method:

AVCaptureDeviceMBS.unlockForConfiguration

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Relinquishes exclusive control over the device's configuration.

Call this method to release the lock acquired using the lockForConfiguration method when you are done configuring the device.

Some examples using this method:

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


The biggest plugin in space...