NextLevel

public class NextLevel : NSObject

⬆️ NextLevel, Rad Media Capture in Swift (http://nextlevel.engineering)

  • 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()
  • 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 metadataOutput(_ output: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection)