NextLevel
public class NextLevel : NSObject
⬆️ NextLevel, Rad Media Capture in Swift (http://nextlevel.engineering)
-
Undocumented
Declaration
Swift
public weak var delegate: NextLevelDelegate?
-
Undocumented
Declaration
Swift
public weak var previewDelegate: NextLevelPreviewDelegate?
-
Undocumented
Declaration
Swift
public weak var deviceDelegate: NextLevelDeviceDelegate?
-
Undocumented
Declaration
Swift
public weak var flashDelegate: NextLevelFlashAndTorchDelegate?
-
Undocumented
Declaration
Swift
public weak var videoDelegate: NextLevelVideoDelegate?
-
Undocumented
Declaration
Swift
public weak var photoDelegate: NextLevelPhotoDelegate?
-
-
Undocumented
Declaration
Swift
public weak var portraitEffectsMatteDelegate: NextLevelPortraitEffectsMatteDelegate?
-
Undocumented
Declaration
Swift
public weak var metadataObjectsDelegate: NextLevelMetadataOutputObjectsDelegate?
-
Live camera preview, add as a sublayer to the UIView’s primary layer.
Declaration
Swift
public var previewLayer: AVCaptureVideoPreviewLayer
-
Configuration for video
Declaration
Swift
public var videoConfiguration: NextLevelVideoConfiguration
-
Configuration for audio
Declaration
Swift
public var audioConfiguration: NextLevelAudioConfiguration
-
Configuration for photos
Declaration
Swift
public var photoConfiguration: NextLevelPhotoConfiguration
-
Undocumented
Declaration
Swift
public var arConfiguration: NextLevelARConfiguration? { get }
-
Indicates whether the capture session automatically changes settings in the app’s shared audio session. By default, is
true
.Declaration
Swift
public var automaticallyConfiguresApplicationAudioSession: Bool
-
The current capture mode of the device.
Declaration
Swift
public var captureMode: NextLevelCaptureMode { get set }
-
The current device position.
Declaration
Swift
public var devicePosition: NextLevelDevicePosition { get set }
-
When
true
actives device orientation updatesDeclaration
Swift
public var automaticallyUpdatesDeviceOrientation: Bool
-
The current orientation of the device.
Declaration
Swift
public var deviceOrientation: NextLevelDeviceOrientation { get set }
-
When
true
, enables photo capture stabilization.Declaration
Swift
public var photoStabilizationEnabled: Bool
-
Video stabilization mode
Declaration
Swift
public var videoStabilizationMode: NextLevelVideoStabilizationMode { get set }
-
When
true
, enables streaming depth data capture (use PhotoConfiguration for photos) -
When
true
, enables streaming of portrait effects matte data capture (use PhotoConfiguration for photos)Declaration
Swift
public var portraitEffectsMatteCaptureEnabled: Bool
-
Specifies types of metadata objects to detect
Declaration
Swift
public var metadataObjectTypes: [AVMetadataObject.ObjectType]?
-
Checks if the system is recording.
Declaration
Swift
public var isRecording: Bool { get }
-
Checks if the current capture session is running
Declaration
Swift
public var isRunning: Bool { get }
-
The current recording session, a powerful means for modifying and editing previously recorded clips. The session provides features such as ‘undo’.
Declaration
Swift
public var session: NextLevelSession? { get }
-
Shared Core Image rendering context.
Declaration
Swift
public var sharedCIContext: CIContext? { get set }
-
Method for providing a NextLevel singleton. This isn’t required for use.
Declaration
Swift
public static let shared: NextLevel
-
Undocumented
Declaration
Swift
public override init()
-
Checks the current authorization status for the desired media type.
Declaration
Swift
public static func authorizationStatus(forMediaType mediaType: AVMediaType) -> NextLevelAuthorizationStatus
Parameters
mediaType
Specified media type (i.e. AVMediaTypeVideo, AVMediaTypeAudio, etc.)
Return Value
Authorization status for the desired media type.
-
Requests authorization permission.
Declaration
Swift
public static func requestAuthorization(forMediaType mediaType: AVMediaType, completionHandler: @escaping ((AVMediaType, NextLevelAuthorizationStatus) -> Void) )
Parameters
mediaType
Specified media type (i.e. AVMediaTypeVideo, AVMediaTypeAudio, etc.)
completionHandler
A block called with the responding access request result
-
Starts the current recording session.
Throws
‘NextLevelError.authorization’ when permissions are not authorized, ‘NextLevelError.started’ when the session has already started.Declaration
Swift
public func start() throws
-
Stops the current recording session.
Declaration
Swift
public func stop()
-
Freezes the live camera preview layer.
Declaration
Swift
public func freezePreview()
-
Un-freezes the live camera preview layer.
Declaration
Swift
public func unfreezePreview()
-
Triggers a camera device position change.
Declaration
Swift
public func flipCaptureDevicePosition()
-
Changes capture device if the desired device is available.
Declaration
Swift
public func changeCaptureDeviceIfAvailable(captureDevice: NextLevelDeviceType) throws
-
Changes the current capture device’s mirroring mode.
Declaration
Swift
public var mirroringMode: NextLevelMirroringMode { get set }
-
Checks if a flash is available.
Declaration
Swift
public var isFlashAvailable: Bool { get }
-
The flash mode of the device.
Declaration
Swift
public var flashMode: NextLevelFlashMode { get set }
-
Checks if a torch is available.
Declaration
Swift
public var isTorchAvailable: Bool { get }
-
Torch mode of the device.
Declaration
Swift
public var torchMode: NextLevelTorchMode { get set }
-
Checks if focusing at a point of interest is supported.
Declaration
Swift
public var isFocusPointOfInterestSupported: Bool { get }
-
Checks if focus lock is supported.
Declaration
Swift
public var isFocusLockSupported: Bool { get }
-
Checks if focus adjustment is in progress.
Declaration
Swift
public var isAdjustingFocus: Bool { get }
-
The focus mode of the device.
Declaration
Swift
public var focusMode: NextLevelFocusMode { get set }
-
The lens position of the device.
Declaration
Swift
public var lensPosition: Float { get set }
-
Focuses, exposures, and adjusts white balanace at the point of interest.
Declaration
Swift
public func focusExposeAndAdjustWhiteBalance(atAdjustedPoint adjustedPoint: CGPoint)
Parameters
adjustedPoint
The point of interest.
-
Changes focus at adjusted point of interest.
Declaration
Swift
public func focusAtAdjustedPointOfInterest(adjustedPoint: CGPoint)
Parameters
adjustedPoint
The point of interest for focus
-
Checks if exposure lock is supported.
Declaration
Swift
public var isExposureLockSupported: Bool { get }
-
Checks if an exposure adjustment is progress.
Declaration
Swift
public var isAdjustingExposure: Bool { get }
-
The exposure mode of the device.
Declaration
Swift
public var exposureMode: NextLevelExposureMode { get set }
-
Changes exposure at adjusted point of interest.
Declaration
Swift
public func exposeAtAdjustedPointOfInterest(adjustedPoint: CGPoint)
Parameters
adjustedPoint
The point of interest for exposure.
-
Adjusts exposure duration to a custom value in seconds.
Declaration
Swift
public func expose(withDuration duration: Double, durationPower: Double = 5, minDurationRangeLimit: Double = (1.0 / 1000.0))
Parameters
duration
The exposure duration in seconds.
durationPower
Larger power values will increase the sensitivity at shorter durations.
minDurationRangeLimit
Minimum limitation for duration.
-
Adjusts exposure to a specific custom ISO value.
Declaration
Swift
public func expose(withISO iso: Float)
Parameters
iso
The exposure ISO value.
-
Adjusts exposure to the specified target bias.
Declaration
Swift
public func expose(withTargetBias targetBias: Float)
Parameters
targetBias
The exposure target bias.
-
Checks if white balance lock is supported.
Declaration
Swift
public var isWhiteBalanceLockSupported: Bool { get }
-
Checks if an white balance adjustment is progress.
Declaration
Swift
public var isAdjustingWhiteBalance: Bool { get }
-
The white balance mode of the device.
Declaration
Swift
public var whiteBalanceMode: NextLevelWhiteBalanceMode { get set }
-
Undocumented
Declaration
Swift
public var whiteBalanceTemperature: Float { get set }
-
Undocumented
Declaration
Swift
public var whiteBalanceTint: Float { get set }
-
Adjusts white balance gains to custom values.
Declaration
Swift
public func adjustWhiteBalanceGains(_ whiteBalanceGains: AVCaptureDevice.WhiteBalanceGains)
Parameters
whiteBalanceGains
Gains values for adjustment.
-
Changes the current device frame rate.
Declaration
Swift
public var frameRate: CMTimeScale { get set }
-
Changes the current device frame rate within the desired dimensions.
Declaration
Swift
public func updateDeviceFormat(withFrameRate frameRate: CMTimeScale, dimensions: CMVideoDimensions)
Parameters
frameRate
Desired frame rate.
dimensions
Desired video dimensions.
-
Checks if video capture is supported by the hardware.
Declaration
Swift
public var isVideoCaptureSupported: Bool { get }
-
Checks if video capture is available, based on available storage and supported hardware functionality.
Declaration
Swift
public var canCaptureVideo: Bool { get }
-
Updates video capture zoom factor.
Declaration
Swift
public var videoZoomFactor: Float { get set }
-
Triggers a photo capture from the last video frame.
Declaration
Swift
public func capturePhotoFromVideo()
-
Enables delegate callbacks for rendering into a custom context. videoDelegate, func nextLevel(_ nextLevel: NextLevel, renderToCustomContextWithImageBuffer imageBuffer: CVPixelBuffer, onQueue queue: DispatchQueue)
Declaration
Swift
public var isVideoCustomContextRenderingEnabled: Bool { get set }
-
Settings this property passes a modified buffer into the session for writing. The property is only observed when ‘isVideoCustomContextRenderingEnabled’ is enabled. Setting it to nil avoids modification for a frame.
Declaration
Swift
public var videoCustomContextImageBuffer: CVPixelBuffer? { get set }
-
Initiates video recording, managed as a clip within the ‘NextLevelSession’
Declaration
Swift
public func record()
-
Pauses video recording, preparing ‘NextLevel’ to start a new clip with ‘record()’ with completion handler.
Declaration
Swift
public func pause(withCompletionHandler completionHandler: (() -> Void)? = nil)
Parameters
completionHandler
Completion handler for when pause completes
-
Checks if a photo capture operation can be performed, based on available storage space and supported hardware functionality.
Declaration
Swift
public var canCapturePhoto: Bool { get }
-
Triggers a photo capture.
Declaration
Swift
public func capturePhoto()
-
Undocumented
Declaration
Swift
public func captureOutput(_ captureOutput: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection)
-
Undocumented
Declaration
Swift
public func fileOutput(_ output: AVCaptureFileOutput, didStartRecordingTo fileURL: URL, from connections: [AVCaptureConnection])
-
Undocumented
Declaration
Swift
public func fileOutput(_ output: AVCaptureFileOutput, didFinishRecordingTo outputFileURL: URL, from connections: [AVCaptureConnection], error: Error?)
-
Undocumented
Declaration
Swift
public func photoOutput(_ captureOutput: AVCapturePhotoOutput, willCapturePhotoFor resolvedSettings: AVCaptureResolvedPhotoSettings)
-
Undocumented
Declaration
Swift
public func photoOutput(_ output: AVCapturePhotoOutput, didCapturePhotoFor resolvedSettings: AVCaptureResolvedPhotoSettings)
-
Undocumented
Declaration
Swift
public func photoOutput(_ captureOutput: AVCapturePhotoOutput, didFinishProcessingPhoto photoSampleBuffer: CMSampleBuffer?, previewPhoto previewPhotoSampleBuffer: CMSampleBuffer?, resolvedSettings: AVCaptureResolvedPhotoSettings, bracketSettings: AVCaptureBracketedStillImageSettings?, error: Error?)
-
Undocumented
Declaration
Swift
public func photoOutput(_ captureOutput: AVCapturePhotoOutput, didFinishProcessingRawPhoto rawSampleBuffer: CMSampleBuffer?, previewPhoto previewPhotoSampleBuffer: CMSampleBuffer?, resolvedSettings: AVCaptureResolvedPhotoSettings, bracketSettings: AVCaptureBracketedStillImageSettings?, error: Error?)
-
Undocumented
Declaration
Swift
public func photoOutput(_ captureOutput: AVCapturePhotoOutput, didFinishCaptureFor resolvedSettings: AVCaptureResolvedPhotoSettings, error: Error?)
-
Undocumented
Declaration
Swift
public func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?)
-
Undocumented
Declaration
Swift
public func metadataOutput(_ output: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection)
-
Undocumented
Declaration
Swift
@objc public func handleSessionWasInterrupted(_ notification: Notification)
-
Undocumented
Declaration
Swift
@objc public func handleSessionInterruptionEnded(_ notification: Notification)