public class AVCaptureSession extends NSObject
AVCaptureSession is the central hub of the AVFoundation capture classes.
To perform a real-time capture, a client may instantiate AVCaptureSession and add appropriate AVCaptureInputs, such as AVCaptureDeviceInput, and outputs, such as AVCaptureMovieFileOutput. [AVCaptureSession startRunning] starts the flow of data from the inputs to the outputs, and [AVCaptureSession stopRunning] stops the flow. A client may set the sessionPreset property to customize the quality level or bitrate of the output.
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret| Modifier | Constructor and Description |
|---|---|
protected |
AVCaptureSession(org.moe.natj.general.Pointer peer) |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
accessInstanceVariablesDirectly() |
void |
addConnection(AVCaptureConnection connection)
addConnection:
|
void |
addInput(AVCaptureInput input)
addInput:
|
void |
addInputWithNoConnections(AVCaptureInput input)
addInputWithNoConnections:
|
void |
addOutput(AVCaptureOutput output)
addOutput:
|
void |
addOutputWithNoConnections(AVCaptureOutput output)
addOutputWithNoConnections:
|
static AVCaptureSession |
alloc() |
static AVCaptureSession |
allocWithZone(org.moe.natj.general.ptr.VoidPtr zone) |
boolean |
automaticallyConfiguresApplicationAudioSession()
[@property] automaticallyConfiguresApplicationAudioSession
|
boolean |
automaticallyConfiguresCaptureDeviceForWideColor()
[@property] automaticallyConfiguresCaptureDeviceForWideColor
|
static boolean |
automaticallyNotifiesObserversForKey(java.lang.String key) |
void |
beginConfiguration()
beginConfiguration
|
boolean |
canAddConnection(AVCaptureConnection connection)
canAddConnection:
|
boolean |
canAddInput(AVCaptureInput input)
canAddInput:
|
boolean |
canAddOutput(AVCaptureOutput output)
canAddOutput:
|
static void |
cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget) |
static void |
cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget,
org.moe.natj.objc.SEL aSelector,
java.lang.Object anArgument) |
boolean |
canSetSessionPreset(java.lang.String preset)
canSetSessionPreset:
|
static NSArray<java.lang.String> |
classFallbacksForKeyedArchiver() |
static org.moe.natj.objc.Class |
classForKeyedUnarchiver() |
void |
commitConfiguration()
commitConfiguration
|
NSArray<? extends AVCaptureConnection> |
connections()
[@property] connections
|
static java.lang.String |
debugDescription_static() |
static java.lang.String |
description_static() |
static long |
hash_static() |
AVCaptureSession |
init() |
NSArray<? extends AVCaptureInput> |
inputs()
[@property] inputs
|
static NSObject.Function_instanceMethodForSelector_ret |
instanceMethodForSelector(org.moe.natj.objc.SEL aSelector) |
static NSMethodSignature |
instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector) |
static boolean |
instancesRespondToSelector(org.moe.natj.objc.SEL aSelector) |
boolean |
isInterrupted()
[@property] interrupted
|
boolean |
isRunning()
[@property] running
|
static boolean |
isSubclassOfClass(org.moe.natj.objc.Class aClass) |
static NSSet<java.lang.String> |
keyPathsForValuesAffectingValueForKey(java.lang.String key) |
CMClockRef |
masterClock()
[@property] masterClock
|
static AVCaptureSession |
new_objc() |
NSArray<? extends AVCaptureOutput> |
outputs()
[@property] outputs
|
void |
removeConnection(AVCaptureConnection connection)
removeConnection:
|
void |
removeInput(AVCaptureInput input)
removeInput:
|
void |
removeOutput(AVCaptureOutput output)
removeOutput:
|
static boolean |
resolveClassMethod(org.moe.natj.objc.SEL sel) |
static boolean |
resolveInstanceMethod(org.moe.natj.objc.SEL sel) |
java.lang.String |
sessionPreset()
[@property] sessionPreset
|
void |
setAutomaticallyConfiguresApplicationAudioSession(boolean value)
[@property] automaticallyConfiguresApplicationAudioSession
|
void |
setAutomaticallyConfiguresCaptureDeviceForWideColor(boolean value)
[@property] automaticallyConfiguresCaptureDeviceForWideColor
|
void |
setSessionPreset(java.lang.String value)
[@property] sessionPreset
|
void |
setUsesApplicationAudioSession(boolean value)
[@property] usesApplicationAudioSession
|
static void |
setVersion_static(long aVersion) |
void |
startRunning()
startRunning
|
void |
stopRunning()
stopRunning
|
static org.moe.natj.objc.Class |
superclass_static() |
boolean |
usesApplicationAudioSession()
[@property] usesApplicationAudioSession
|
static long |
version_static() |
accessibilityActivate, accessibilityActivationPoint, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedLabel, accessibilityAttributedUserInputLabels, accessibilityAttributedValue, accessibilityContainerType, accessibilityCustomActions, accessibilityCustomRotors, accessibilityDecrement, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsHidden, accessibilityFrame, accessibilityHint, accessibilityIncrement, accessibilityLabel, accessibilityLanguage, accessibilityNavigationStyle, accessibilityPath, accessibilityPerformEscape, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityScroll, accessibilityTextualContext, accessibilityTraits, accessibilityUserInputLabels, accessibilityValue, accessibilityViewIsModal, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, hash, indexOfAccessibilityElement, isAccessibilityElement, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivationPoint, setAccessibilityAttributedHint, setAccessibilityAttributedLabel, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedValue, setAccessibilityContainerType, setAccessibilityCustomActions, setAccessibilityCustomRotors, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsHidden, setAccessibilityFrame, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLanguage, setAccessibilityNavigationStyle, setAccessibilityPath, setAccessibilityRespondsToUserInteraction, setAccessibilityTextualContext, setAccessibilityTraits, setAccessibilityUserInputLabels, setAccessibilityValue, setAccessibilityViewIsModal, setIsAccessibilityElement, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, superclass, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKeypublic static boolean accessInstanceVariablesDirectly()
public static AVCaptureSession alloc()
public static AVCaptureSession allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
public static boolean automaticallyNotifiesObserversForKey(java.lang.String key)
public static void cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)
public static void cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget,
org.moe.natj.objc.SEL aSelector,
java.lang.Object anArgument)
public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
public static org.moe.natj.objc.Class classForKeyedUnarchiver()
public static java.lang.String debugDescription_static()
public static java.lang.String description_static()
public static long hash_static()
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
public static NSMethodSignature instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)
public static boolean instancesRespondToSelector(org.moe.natj.objc.SEL aSelector)
public static boolean isSubclassOfClass(org.moe.natj.objc.Class aClass)
public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey(java.lang.String key)
public static AVCaptureSession new_objc()
public static boolean resolveClassMethod(org.moe.natj.objc.SEL sel)
public static boolean resolveInstanceMethod(org.moe.natj.objc.SEL sel)
public static void setVersion_static(long aVersion)
public static org.moe.natj.objc.Class superclass_static()
public static long version_static()
public void addConnection(AVCaptureConnection connection)
Adds an AVCaptureConnection to the session.
An AVCaptureConnection instance can only be added to a session using -addConnection: if canAddConnection: returns YES. When using -addInput: or -addOutput:, connections are formed automatically between all compatible inputs and outputs. Manually adding connections is only necessary when adding an input or output with no connections. -addConnection: may be called while the session is running.
connection - An AVCaptureConnection instance.public void addInput(AVCaptureInput input)
Adds an AVCaptureInput to the session.
An AVCaptureInput instance can only be added to a session using -addInput: if -canAddInput: returns YES. -addInput: may be called while the session is running.
input - An AVCaptureInput instance.public void addInputWithNoConnections(AVCaptureInput input)
Adds an AVCaptureInput to the session without forming any connections.
-addInputWithNoConnections: may be called while the session is running. The -addInput: method is the preferred method for adding an input to an AVCaptureSession. -addInputWithNoConnections: may be called if you need fine-grained control over which inputs are connected to which outputs.
input - An AVCaptureInput instance.public void addOutput(AVCaptureOutput output)
Adds an AVCaptureOutput to the session.
An AVCaptureOutput instance can only be added to a session using -addOutput: if -canAddOutput: returns YES. -addOutput: may be called while the session is running.
output - An AVCaptureOutput instance.public void addOutputWithNoConnections(AVCaptureOutput output)
Adds an AVCaptureOutput to the session without forming any connections.
-addOutputWithNoConnections: may be called while the session is running. The -addOutput: method is the preferred method for adding an output to an AVCaptureSession. -addOutputWithNoConnections: may be called if you need fine-grained control over which inputs are connected to which outputs.
output - An AVCaptureOutput instance.public boolean automaticallyConfiguresApplicationAudioSession()
Indicates whether the receiver should configure the application's audio session for recording.
The value of this property is a BOOL indicating whether the receiver should configure the application's audio session when needed for optimal recording. When set to YES, the receiver ensures the application's audio session is set to the PlayAndRecord category, and picks an appropriate microphone and polar pattern to match the video camera being used. When set to NO, and -usesApplicationAudioSession is set to YES, the receiver will use the application's audio session, but will not change any of its properties. If the session is not set up correctly for input, audio recording may fail. The default value is YES.
public boolean automaticallyConfiguresCaptureDeviceForWideColor()
Indicates whether the receiver automatically configures its video device's activeFormat and activeColorSpace properties, preferring wide color for photos.
The default value is YES. By default, the receiver automatically adjusts its source video AVCaptureDevice's activeFormat and activeColorSpace properties based on the supportedColorSpaces of the device's formats and the current AVCaptureSession topology. Wide color spaces are preferred over sRGB if an AVCapturePhotoOutput is present in the session. If you wish to set AVCaptureDevice's activeColorSpace manually, and prevent the AVCaptureSession from undoing your work, you must set automaticallyConfiguresCaptureDeviceForWideColor to NO. If the receiver's sessionPreset is set to AVCaptureSessionPresetInputPriority, the session will not alter the capture device's activeFormat, but might still alter its activeColorSpace.
public void beginConfiguration()
When paired with commitConfiguration, allows a client to batch multiple configuration operations on a running session into atomic updates.
-beginConfiguration / -commitConfiguration are AVCaptureSession's mechanism for batching multiple configuration operations on a running session into atomic updates. After calling [session beginConfiguration], clients may add or remove outputs, alter the sessionPreset, or configure individual AVCaptureInput or Output properties. All changes will be pended until the client calls [session commitConfiguration], at which time they will be applied together. -beginConfiguration / -commitConfiguration pairs may be nested, and will only be applied when the outermost commit is invoked.
public boolean canAddConnection(AVCaptureConnection connection)
Returns whether the proposed connection can be added to the receiver.
An AVCaptureConnection instance can only be added to a session using -addConnection: if canAddConnection: returns YES. When using -addInput: or -addOutput:, connections are formed automatically between all compatible inputs and outputs. Manually adding connections is only necessary when adding an input or output with no connections.
connection - An AVCaptureConnection instance.public boolean canAddInput(AVCaptureInput input)
Returns whether the proposed input can be added to the receiver.
An AVCaptureInput instance can only be added to a session using -addInput: if -canAddInput: returns YES.
input - An AVCaptureInput instance.public boolean canAddOutput(AVCaptureOutput output)
Returns whether the proposed output can be added to the receiver.
An AVCaptureOutput instance can only be added to a session using -addOutput: if -canAddOutput: returns YES.
output - An AVCaptureOutput instance.public boolean canSetSessionPreset(java.lang.String preset)
Returns whether the receiver can be configured with the given preset.
An AVCaptureSession instance can be associated with a preset that configures its inputs and outputs to fulfill common use cases. This method can be used to determine if the receiver supports the desired preset given its current input and output configuration. The receiver's sessionPreset property may only be set to a certain preset if this method returns YES for that preset.
preset - An AVCaptureSession preset.public void commitConfiguration()
When preceded by beginConfiguration, allows a client to batch multiple configuration operations on a running session into atomic updates.
-beginConfiguration / -commitConfiguration are AVCaptureSession's mechanism for batching multiple configuration operations on a running session into atomic updates. After calling [session beginConfiguration], clients may add or remove outputs, alter the sessionPreset, or configure individual AVCaptureInput or Output properties. All changes will be pended until the client calls [session commitConfiguration], at which time they will be applied together. -beginConfiguration / -commitConfiguration pairs may be nested, and will only be applied when the outermost commit is invoked.
public AVCaptureSession init()
public NSArray<? extends AVCaptureInput> inputs()
An NSArray of AVCaptureInputs currently added to the receiver.
The value of this property is an NSArray of AVCaptureInputs currently added to the receiver. Clients can add AVCaptureInputs to a session by calling -addInput:.
public boolean isInterrupted()
Indicates whether the session is being interrupted.
The value of this property is a BOOL indicating whether the receiver is currently being interrupted, such as by a phone call or alarm. Clients can key value observe the value of this property to be notified when the session ceases to be interrupted and again has access to needed hardware resources.
public boolean isRunning()
Indicates whether the session is currently running.
The value of this property is a BOOL indicating whether the receiver is running. Clients can key value observe the value of this property to be notified when the session automatically starts or stops running.
public CMClockRef masterClock()
Provides the master clock being used for output synchronization.
The masterClock is readonly. Use masterClock to synchronize AVCaptureOutput data with external data sources (e.g motion samples). All capture output sample buffer timestamps are on the masterClock timebase.
For example, if you want to reverse synchronize the output timestamps to the original timestamps, you can do the following: In captureOutput:didOutputSampleBuffer:fromConnection:
AVCaptureInputPort *port = [[connection inputPorts] objectAtIndex:0]; CMClockRef originalClock = [port clock];
CMTime syncedPTS = CMSampleBufferGetPresentationTime( sampleBuffer ); CMTime originalPTS = CMSyncConvertTime( syncedPTS, [session masterClock], originalClock );
This property is key-value observable.
public NSArray<? extends AVCaptureOutput> outputs()
An NSArray of AVCaptureOutputs currently added to the receiver.
The value of this property is an NSArray of AVCaptureOutputs currently added to the receiver. Clients can add AVCaptureOutputs to a session by calling -addOutput:.
public void removeConnection(AVCaptureConnection connection)
Removes an AVCaptureConnection from the session.
-removeConnection: may be called while the session is running.
connection - An AVCaptureConnection instance.public void removeInput(AVCaptureInput input)
Removes an AVCaptureInput from the session.
-removeInput: may be called while the session is running.
input - An AVCaptureInput instance.public void removeOutput(AVCaptureOutput output)
Removes an AVCaptureOutput from the session.
-removeOutput: may be called while the session is running.
output - An AVCaptureOutput instance.public java.lang.String sessionPreset()
Indicates the session preset currently in use by the receiver.
The value of this property is an AVCaptureSessionPreset indicating the current session preset in use by the receiver. The sessionPreset property may be set while the receiver is running.
public void setAutomaticallyConfiguresApplicationAudioSession(boolean value)
Indicates whether the receiver should configure the application's audio session for recording.
The value of this property is a BOOL indicating whether the receiver should configure the application's audio session when needed for optimal recording. When set to YES, the receiver ensures the application's audio session is set to the PlayAndRecord category, and picks an appropriate microphone and polar pattern to match the video camera being used. When set to NO, and -usesApplicationAudioSession is set to YES, the receiver will use the application's audio session, but will not change any of its properties. If the session is not set up correctly for input, audio recording may fail. The default value is YES.
public void setAutomaticallyConfiguresCaptureDeviceForWideColor(boolean value)
Indicates whether the receiver automatically configures its video device's activeFormat and activeColorSpace properties, preferring wide color for photos.
The default value is YES. By default, the receiver automatically adjusts its source video AVCaptureDevice's activeFormat and activeColorSpace properties based on the supportedColorSpaces of the device's formats and the current AVCaptureSession topology. Wide color spaces are preferred over sRGB if an AVCapturePhotoOutput is present in the session. If you wish to set AVCaptureDevice's activeColorSpace manually, and prevent the AVCaptureSession from undoing your work, you must set automaticallyConfiguresCaptureDeviceForWideColor to NO. If the receiver's sessionPreset is set to AVCaptureSessionPresetInputPriority, the session will not alter the capture device's activeFormat, but might still alter its activeColorSpace.
public void setSessionPreset(java.lang.String value)
Indicates the session preset currently in use by the receiver.
The value of this property is an AVCaptureSessionPreset indicating the current session preset in use by the receiver. The sessionPreset property may be set while the receiver is running.
public void setUsesApplicationAudioSession(boolean value)
Indicates whether the receiver will use the application's AVAudioSession for recording.
The value of this property is a BOOL indicating whether the receiver is currently using the application's AVAudioSession (see AVAudioSession.h). Prior to iOS 7, AVCaptureSession uses its own audio session, which can lead to unwanted interruptions when interacting with the application's audio session. In applications linked on or after iOS 7, AVCaptureSession shares the application's audio session, allowing for simultaneous play back and recording without unwanted interruptions. Clients desiring the pre-iOS 7 behavior may opt out by setting usesApplicationAudioSession to NO. The default value is YES.
public void startRunning()
Starts an AVCaptureSession instance running.
Clients invoke -startRunning to start the flow of data from inputs to outputs connected to the AVCaptureSession instance. This call blocks until the session object has completely started up or failed. A failure to start running is reported through the AVCaptureSessionRuntimeErrorNotification mechanism.
public void stopRunning()
Stops an AVCaptureSession instance that is currently running.
Clients invoke -stopRunning to stop the flow of data from inputs to outputs connected to the AVCaptureSession instance. This call blocks until the session object has completely stopped.
public boolean usesApplicationAudioSession()
Indicates whether the receiver will use the application's AVAudioSession for recording.
The value of this property is a BOOL indicating whether the receiver is currently using the application's AVAudioSession (see AVAudioSession.h). Prior to iOS 7, AVCaptureSession uses its own audio session, which can lead to unwanted interruptions when interacting with the application's audio session. In applications linked on or after iOS 7, AVCaptureSession shares the application's audio session, allowing for simultaneous play back and recording without unwanted interruptions. Clients desiring the pre-iOS 7 behavior may opt out by setting usesApplicationAudioSession to NO. The default value is YES.
public NSArray<? extends AVCaptureConnection> connections()
An NSArray of AVCaptureConnections currently added to the receiver.
The value of this property is an NSArray of AVCaptureConnections currently added to the receiver. Connections are formed implicitly by the receiver when a client calls -addInput: or -addOutput:. Connections are formed explicitly when a client calls -addConnection:.