Editar

Compartilhar via


AVCaptureDevice Class

Definition

Support for accessing the audio and video capture hardware for AVCaptureSession.

[Foundation.Register("AVCaptureDevice", true)]
[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.WatchOS, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.TvOS, ObjCRuntime.PlatformArchitecture.All, null)]
public class AVCaptureDevice : Foundation.NSObject
type AVCaptureDevice = class
    inherit NSObject
Inheritance
AVCaptureDevice
Attributes

Remarks

Once a capture session has begun, application developers must bracket configuration changes with calls to LockForConfiguration(NSError) and UnlockForConfiguration().

Constructors

AVCaptureDevice(IntPtr)

A constructor used when creating managed representations of unmanaged objects; Called by the runtime.

AVCaptureDevice(NSObjectFlag)

Constructor to call on derived classes to skip initialization and merely allocate the object.

Properties

ActiveColorSpace

Gets or sets the color space used for capture.

ActiveDepthDataFormat
ActiveDepthDataMinFrameDuration
ActiveFormat

The currently active format of the AVCaptureDevice.

ActiveInputSource
ActiveMaxExposureDuration
ActiveVideoMaxFrameDuration

The maximum frame duration.

ActiveVideoMinFrameDuration

The minimum frame duration.

AdjustingExposure

Whether the device is currently adjusting its exposure setting.

AdjustingFocus

Whether the device is currently adjusting its focus.

AdjustingWhiteBalance

Whether the device is currently adjusting its white balance.

AutoFocusRangeRestriction

Limits the range over which autofocus will be attempted.

AutoFocusRangeRestrictionSupported

Whether the device's autofocus can be restricted to specified ranges.

AutomaticallyAdjustsVideoHdrEnabled

Determines if HDR can be turned on and off for the video stream, if set, you can enable VideoHdrEnabled

AutomaticallyEnablesLowLightBoostWhenAvailable

Whether the system should automatically enable "boost mode" (ISO 3200) in low light.

Class (Inherited from NSObject)
ClassHandle

The handle for this class.

Connected

Whether the AVCaptureDevice is available for use.

DebugDescription

A developer-meaningful description of this object.

(Inherited from NSObject)
Description

Description of the object, the Objective-C version of ToString.

(Inherited from NSObject)
Devices

Developers should not use this deprecated property. Developers should use 'AVCaptureDeviceDiscoverySession' instead.

DeviceType

Gets the AVCaptureDeviceType of the capturing device.

DeviceWhiteBalanceGains

Gets the device-specific white balance RGB gains.

DualCameraSwitchOverVideoZoomFactor
ExposureDuration

Gets the exposure length, as a CMTime.

ExposureDurationCurrent

Represents the value associated with the constant AVCaptureExposureDurationCurrent

ExposureMode

The current exposure mode of the AVCaptureDevice.

ExposurePointOfInterest

The point within the field-of-view that is the "point of interest" for exposure.

ExposurePointOfInterestSupported

Whether the device supports the ExposurePointOfInterest.

ExposureTargetBias

Indicates the current Exposure Target Bias (measured in Exposure Value units).

ExposureTargetBiasCurrent

Represents the value associated with the constant AVCaptureExposureTargetBiasCurrent

ExposureTargetOffset

Gets the difference, in EV units, between the metered and target exposure values.

FlashActive

Whether the flash will go off when a still is captured.

FlashAvailable

Whether the flash is available for use.

FlashMode

The current AVCaptureFlashMode.

FocusMode

The current AVCaptureFocusMode.

FocusModeLensPositionCurrent

Represents the value associated with the constant AVCaptureLensPositionCurrent

FocusPointOfInterest

The point in the field-of-view that is the "point of interest" for autofocus.

FocusPointOfInterestSupported

Whether FocusPointOfInterest is available.

Formats

The AVCaptureDeviceFormats supported by the device.

GrayWorldDeviceWhiteBalanceGains

Gets the current gray world RGB white-balance gain values.

Handle

Handle (pointer) to the unmanaged object representation.

(Inherited from NSObject)
HasFlash

Determines whether the device has a flash.

HasTorch

Gets whether the device can be used as a flashlight.

InputSources
InUseByAnotherApplication
IsDirectBinding (Inherited from NSObject)
ISO

Gets the current ISO.

ISOCurrent

Represents the value associated with the constant AVCaptureISOCurrent

IsProxy (Inherited from NSObject)
LensAperture

The size, in mm, of the lens opening.

LensPosition

The focus position of the lens.

LensPositionCurrent

Represents the value associated with the constant AVCaptureLensPositionCurrent

LinkedDevices
LocalizedName

A localized, human-readable name (e.g., "Back Camera") for the AVCaptureDevice.

LockingFocusWithCustomLensPositionSupported

Gets a Boolean value that tells whether the device can lock the focus to a specific position.

LockingWhiteBalanceWithCustomDeviceGainsSupported

Gets a Boolean value that tells whether the device can lock the white balance with custom device-specific gains.

LowLightBoostEnabled

Whether the low-light "boost mode" (ISO 3200) is enabled.

LowLightBoostSupported

Whether the device supports ISO 3200 "low-light boost mode".

Manufacturer
MaxAvailableTorchLevel

Represents the value associated with the constant AVCaptureMaxAvailableTorchLevel

MaxAvailableVideoZoomFactor
MaxExposureTargetBias

The maximum allowed exposure bias, in EV units.

MaxWhiteBalanceGain

The maximum value to which gain in a white balance channel may be set.

MinAvailableVideoZoomFactor
MinExposureTargetBias

The minimum allowed exposure bias, in EV units.

ModelID

Identifies the model of the AVCaptureDevice.

Position

The physical position of the device.

RampingVideoZoom

Whether a zoom transition is in progress.

RetainCount

Returns the current Objective-C retain count for the object.

(Inherited from NSObject)
Self (Inherited from NSObject)
SmoothAutoFocusEnabled

Whether autofocus should be slowed down,for instance, for video capture.

SmoothAutoFocusSupported

Whether autofocus can be slowed down.

SubjectAreaChangeMonitoringEnabled

Gets a Boolean value that tells whether the receiver should watch the video for lighting, movement, or etc.

SubjectAreaDidChangeNotification

Notification constant for SubjectAreaDidChange

Superclass (Inherited from NSObject)
SuperHandle

Handle used to represent the methods in the base class for this NSObject.

(Inherited from NSObject)
Suspended
SystemPressureState
TorchActive

Whether the torch / flashlight is active.

TorchAvailable

Whether the AVCaptureDevice has a torch / flashlight.

TorchLevel

The current level, from 0 for off to 1 for maximum brightness, of the torch / flashlight.

TorchMode

The current AVCaptureTorchMode.

TransportControlsPlaybackMode
TransportControlsSpeed
TransportControlsSupported
UniqueID

A unique identifier for this AVCaptureDevice.

VideoHdrEnabled

Indicates if the device is currently streaming HDR video.

VideoZoomFactor

The current zoom of the video capture.

WasConnectedNotification

Notification constant for WasConnected

WasDisconnectedNotification

Notification constant for WasDisconnected

WeakTransportType
WhiteBalanceGainsCurrent

Represents the value associated with the constant AVCaptureWhiteBalanceGainsCurrent

WhiteBalanceMode

The active AVCaptureWhiteBalanceMode.

Zone (Inherited from NSObject)

Methods

AddObserver(NSObject, NSString, NSKeyValueObservingOptions, IntPtr)

Registers an object for being observed externally (using NSString keyPath).   Observed changes are dispatched to the observer’s object ObserveValue(NSString, NSObject, NSDictionary, IntPtr) method.

(Inherited from NSObject)
AddObserver(NSObject, String, NSKeyValueObservingOptions, IntPtr)

Registers an object for being observed externally (using string keyPath).   Observed changes are dispatched to the observer’s object ObserveValue(NSString, NSObject, NSDictionary, IntPtr) method.

(Inherited from NSObject)
AddObserver(NSString, NSKeyValueObservingOptions, Action<NSObservedChange>)

Registers an object for being observed externally using an arbitrary method.

(Inherited from NSObject)
AddObserver(String, NSKeyValueObservingOptions, Action<NSObservedChange>)

Registers an object for being observed externally using an arbitrary method.

(Inherited from NSObject)
AwakeFromNib()

Called after the object has been loaded from the nib file. Overriders must call base.AwakeFromNib().

(Inherited from NSObject)
BeginInvokeOnMainThread(Action) (Inherited from NSObject)
BeginInvokeOnMainThread(Selector, NSObject)

Invokes asynchrously the specified code on the main UI thread.

(Inherited from NSObject)
Bind(NSString, NSObject, String, NSDictionary) (Inherited from NSObject)
Bind(String, NSObject, String, NSDictionary)
Obsolete.
(Inherited from NSObject)
BindingInfo(String)
Obsolete.
(Inherited from NSObject)
BindingOptionDescriptions(String)
Obsolete.
(Inherited from NSObject)
BindingValueClass(String)
Obsolete.
(Inherited from NSObject)
CancelVideoZoomRamp()

Smoothly cancels an in-progress video zoom.

CommitEditing() (Inherited from NSObject)
CommitEditing(NSObject, Selector, IntPtr) (Inherited from NSObject)
ConformsToProtocol(IntPtr)

Invoked to determine if this object implements the specified protocol.

(Inherited from NSObject)
Copy()

Performs a copy of the underlying Objective-C object.

(Inherited from NSObject)
DangerousAutorelease() (Inherited from NSObject)
DangerousRelease() (Inherited from NSObject)
DangerousRetain() (Inherited from NSObject)
DefaultDeviceWithMediaType(String)
Obsolete.

The default device for the mediaType, which should be a value from AVMediaType.

DevicesWithMediaType(String)

An array of available AVCaptureDevices that can capture mediaType.

DeviceWithUniqueID(String)

The device whose UniqueID matches deviceUniqueID.

DidChange(NSKeyValueChange, NSIndexSet, NSString)

Indicates a change occurred to the indexes for a to-many relationship.

(Inherited from NSObject)
DidChange(NSString, NSKeyValueSetMutationKind, NSSet) (Inherited from NSObject)
DidChangeValue(String)

Indicates that a change occurred on the specified key.

(Inherited from NSObject)
Dispose()

Releases the resources used by the NSObject object.

(Inherited from NSObject)
Dispose(Boolean)

Releases the resources used by the NSObject object.

(Inherited from NSObject)
DoesNotRecognizeSelector(Selector)

Indicates that this object does not recognize the specified selector.

(Inherited from NSObject)
Equals(NSObject) (Inherited from NSObject)
Equals(Object) (Inherited from NSObject)
ExposedBindings() (Inherited from NSObject)
GetAuthorizationStatus(AVAuthorizationMediaType)
GetAuthorizationStatus(NSString)

Whether the app is permitted to capture the avMediaTypeToken.

GetBindingInfo(NSString) (Inherited from NSObject)
GetBindingOptionDescriptions(NSString) (Inherited from NSObject)
GetBindingValueClass(NSString) (Inherited from NSObject)
GetChromaticityValues(AVCaptureWhiteBalanceGains)

Gets the device-independent chromaticity values for the device-specific white balance RGB gains..

GetDefaultDevice(AVCaptureDeviceType, String, AVCaptureDevicePosition)

Returns the default device for the provided device and media types and front or back facing position.

GetDefaultDevice(AVMediaTypes)

Returns the default device for the provided media type.

GetDefaultDevice(NSString)

Returns the default device for the provided media type.

GetDeviceWhiteBalanceGains(AVCaptureWhiteBalanceChromaticityValues)

Returns the device-specific RGB white balance gains for the provided chromaticities.

GetDeviceWhiteBalanceGains(AVCaptureWhiteBalanceTemperatureAndTintValues)

Returns the device-specific RGB white balance gains for the provided temperature and tint values.

GetDictionaryOfValuesFromKeys(NSString[])

Retrieves the values of the specified keys.

(Inherited from NSObject)
GetHashCode()

Generates a hash code for the current instance.

(Inherited from NSObject)
GetMethodForSelector(Selector) (Inherited from NSObject)
GetNativeField(String)
Obsolete.
(Inherited from NSObject)
GetNativeHash() (Inherited from NSObject)
GetTemperatureAndTintValues(AVCaptureWhiteBalanceGains)

Returns the temperature and tint values for the provided white balance gains.

HasMediaType(AVMediaTypes)

Whether the device can provide the mediaType.

HasMediaType(String)

Whether the device can provide the mediaType.

Init() (Inherited from NSObject)
InitializeHandle(IntPtr, String) (Inherited from NSObject)
InitializeHandle(IntPtr) (Inherited from NSObject)
Invoke(Action, Double) (Inherited from NSObject)
Invoke(Action, TimeSpan) (Inherited from NSObject)
InvokeOnMainThread(Action) (Inherited from NSObject)
InvokeOnMainThread(Selector, NSObject)

Invokes synchrously the specified code on the main UI thread.

(Inherited from NSObject)
IsEqual(NSObject) (Inherited from NSObject)
IsExposureModeSupported(AVCaptureExposureMode)

Whether the exposureMode is supported.

IsFlashModeSupported(AVCaptureFlashMode)

Determines if a specific flash mode is supported by the hardware.

IsFocusModeSupported(AVCaptureFocusMode)

Whether the focusMode is supported.

IsKindOfClass(Class) (Inherited from NSObject)
IsMemberOfClass(Class) (Inherited from NSObject)
IsTorchModeSupported(AVCaptureTorchMode)

Determines whether the specific torch mode is supported by the device.

IsWhiteBalanceModeSupported(AVCaptureWhiteBalanceMode)

Whether the whiteBalanceMode is supported.

LockExposure(CMTime, Single, Action<CMTime>)

Locks the exposure for the provided duration and ISO, and runs a completion handler when it is finished.

LockExposureAsync(CMTime, Single)

Locks the exposure for the provided duration and ISO, and runs a completion handler when it is finished.

LockForConfiguration(NSError)

Gains exclusive access to the device configuration.

MarkDirty()

Promotes a regular peer object (IsDirectBinding is true) into a toggleref object.

(Inherited from NSObject)
MutableCopy()

Creates a mutable copy of the specified NSObject.

(Inherited from NSObject)
ObjectDidEndEditing(NSObject) (Inherited from NSObject)
ObserveValue(NSString, NSObject, NSDictionary, IntPtr)

Indicates that the value at the specified keyPath relative to this object has changed.

(Inherited from NSObject)
PerformSelector(Selector, NSObject, Double, NSString[]) (Inherited from NSObject)
PerformSelector(Selector, NSObject, Double)

Invokes the selector on the current instance and if the obj is not null, it passes this as its single parameter.

(Inherited from NSObject)
PerformSelector(Selector, NSObject, NSObject) (Inherited from NSObject)
PerformSelector(Selector, NSObject) (Inherited from NSObject)
PerformSelector(Selector, NSThread, NSObject, Boolean, NSString[]) (Inherited from NSObject)
PerformSelector(Selector, NSThread, NSObject, Boolean) (Inherited from NSObject)
PerformSelector(Selector) (Inherited from NSObject)
PrepareForInterfaceBuilder() (Inherited from NSObject)
RampToVideoZoom(nfloat, Single)
RemoveObserver(NSObject, NSString, IntPtr)

Stops the specified observer from receiving further notifications of changed values for the specified keyPath and context.

(Inherited from NSObject)
RemoveObserver(NSObject, NSString)

Stops the specified observer from receiving further notifications of changed values for the specified keyPath.

(Inherited from NSObject)
RemoveObserver(NSObject, String, IntPtr)

Stops the specified observer from receiving further notifications of changed values for the specified keyPath and context.

(Inherited from NSObject)
RemoveObserver(NSObject, String)

Stops the specified observer from receiving further notifications of changed values for the specified keyPath.

(Inherited from NSObject)
RequestAccessForMediaType(AVAuthorizationMediaType, AVRequestAccessStatus)
RequestAccessForMediaType(NSString, AVRequestAccessStatus)

Requests the application user's permission, if necessary, to capture the avMediaTypeToken.

RequestAccessForMediaTypeAsync(AVAuthorizationMediaType)
RequestAccessForMediaTypeAsync(NSString)

Requests the application user's permission, if necessary, to capture the avMediaTypeToken.

RespondsToSelector(Selector)

Whether this object recognizes the specified selector.

(Inherited from NSObject)
SetExposureTargetBias(Single, Action<CMTime>)

Sets the exposure target bias (measured in Exposure Value units).

SetExposureTargetBiasAsync(Single)

Sets the exposure target bias (measured in Exposure Value units).

SetFocusModeLocked(Single, Action<CMTime>)

Locks the lens position at the specified position.

SetFocusModeLockedAsync(Single)

Locks the lens position at the specified position.

SetNativeField(String, NSObject)
Obsolete.
(Inherited from NSObject)
SetNilValueForKey(NSString)

Sets the value of the specified key to null.

(Inherited from NSObject)
SetTorchModeLevel(Single, NSError)

Specifies the torch / flashlight level.

SetTransportControlsPlaybackMode(AVCaptureDeviceTransportControlsPlaybackMode, Single)
SetValueForKey(NSObject, NSString)

Sets the value of the property specified by the key to the specified value.

(Inherited from NSObject)
SetValueForKeyPath(IntPtr, NSString)

A constructor used when creating managed representations of unmanaged objects; Called by the runtime.

(Inherited from NSObject)
SetValueForKeyPath(NSObject, NSString)

Sets the value of a property that can be reached using a keypath.

(Inherited from NSObject)
SetValueForUndefinedKey(NSObject, NSString)

Indicates an attempt to write a value to an undefined key. If not overridden, raises an NSUndefinedKeyException.

(Inherited from NSObject)
SetValuesForKeysWithDictionary(NSDictionary)

Sets the values of this NSObject to those in the specified dictionary.

(Inherited from NSObject)
SetWhiteBalanceModeLockedWithDeviceWhiteBalanceGains(AVCaptureWhiteBalanceGains, Action<CMTime>)

Locks the device's white balance to the provided device-specific gains.

SetWhiteBalanceModeLockedWithDeviceWhiteBalanceGainsAsync(AVCaptureWhiteBalanceGains)

Locks the device's white balance to the provided device-specific gains.

SupportsAVCaptureSessionPreset(String)

Whether the AVCaptureDevice supports the preset.

ToString()

Returns a string representation of the value of the current instance.

(Inherited from NSObject)
Unbind(NSString) (Inherited from NSObject)
Unbind(String)
Obsolete.
(Inherited from NSObject)
UnlockForConfiguration()

With LockForConfiguration(NSError), commits the requested configuration changes.

ValueForKey(NSString)

Returns the value of the property associated with the specified key.

(Inherited from NSObject)
ValueForKeyPath(NSString)

Returns the value of a property that can be reached using a keypath.

(Inherited from NSObject)
ValueForUndefinedKey(NSString)

Indicates an attempt to read a value of an undefined key. If not overridden, raises an NSUndefinedKeyException.

(Inherited from NSObject)
WillChange(NSKeyValueChange, NSIndexSet, NSString)

Indicates that the values of the specified indices in the specified key are about to change.

(Inherited from NSObject)
WillChange(NSString, NSKeyValueSetMutationKind, NSSet) (Inherited from NSObject)
WillChangeValue(String)

Indicates that the value of the specified key is about to change.

(Inherited from NSObject)

Extension Methods

ObjectDidBeginEditing(NSObject, INSEditor)
ObjectDidEndEditing(NSObject, INSEditor)
GetValidModes(NSObject, NSFontPanel)
ValidateToolbarItem(NSObject, NSToolbarItem)
GetDebugDescription(INSObjectProtocol)
AcceptsPreviewPanelControl(NSObject, QLPreviewPanel)
BeginPreviewPanelControl(NSObject, QLPreviewPanel)
EndPreviewPanelControl(NSObject, QLPreviewPanel)
GetAccessibilityCustomRotors(NSObject)

Gets the array of UIAccessibilityCustomRotor objects appropriate for this object.

SetAccessibilityCustomRotors(NSObject, UIAccessibilityCustomRotor[])

Sets the array of UIAccessibilityCustomRotor objects appropriate for this object.

Applies to

See also