BanubaSdkManager
@objc
public class BanubaSdkManager : NSObject
@objc extension BanubaSdkManager: InputServiceDelegate
extension BanubaSdkManager: BNBCameraPoiListener
extension BanubaSdkManager: BNBFaceNumberListener
extension BanubaSdkManager: BNBFrameDurationListener
-
Declaration
Swift
@objc public weak var delegate: BanubaSdkManagerDelegate?
-
Access to current instance of BNBEffectPlayer
Declaration
Swift
@objc public private(set) var effectPlayer: BNBEffectPlayer? { get }
-
Face orintation in frame (degrees).
Declaration
Swift
@objc public var faceOrientation: Int
-
Declaration
Swift
@objc public func effectManager() -> BNBEffectManager?
-
Enable autorotation mode. Camera orientation and render size should change along with UI orientation
Declaration
Swift
@objc public var autoRotationEnabled: Bool { get set }
-
Declaration
Swift
@discardableResult @objc public func loadEffect(_ effectUrl: String, synchronous: Bool = false) -> BNBEffect?
Parameters
effectUrl
path to effect relative to resource paths passed to
initialize
.synchronous
block the call until effect is loaded.
-
Declaration
Swift
@objc public func unloadEffect(effect: BNBEffect?)
Parameters
effect
effect which should be unloaded.
-
Declaration
Swift
@objc public func currentEffect() -> BNBEffect?
-
Maximum number of faces to trace simultaneously
Declaration
Swift
@objc public func setMaxFaces(_ maxFaces: Int)
-
Declaration
Swift
@objc public var input: InputServicing { get set }
-
Declaration
Swift
@objc public var output: OutputServicing? { get }
-
Declaration
Swift
@objc public var renderTarget: RenderTarget?
-
Declaration
Swift
@objc public var playerConfiguration: EffectPlayerConfiguration? { get }
-
Declaration
Swift
@objc public func setRenderTarget( view: EffectPlayerView, playerConfiguration: EffectPlayerConfiguration? )
-
Declaration
Swift
@objc public func setOpenGLRenderTarget( view: OpenGLEffectPlayerView, playerConfiguration: EffectPlayerConfiguration? )
-
Use this method for offscreen rendering only. For onscreen rendering use version wich accepts
EffectPlayerView
.Declaration
Swift
@objc public func setRenderTarget( layer: CAMetalLayer, playerConfiguration: EffectPlayerConfiguration? )
-
Declaration
Swift
@objc public func setOpenGLRenderTarget( layer: CAEAGLLayer, playerConfiguration: EffectPlayerConfiguration? )
-
Declaration
Swift
@objc public func removeRenderTarget()
-
Declaration
Swift
public private(set) var editingImageFrameData: BNBFrameData? { get }
-
Declaration
Swift
@objc public var renderThread: Thread? { get }
-
Declaration
Swift
@objc public var shouldAutoStartOnEnterForeground: Bool
-
Declaration
Swift
@objc public private(set) var isDrawOnDemandMode: Bool { get }
-
Declaration
Swift
@objc public private(set) var frameOnDemandRendered: Bool { get }
-
Declaration
Swift
@objc public private(set) var isLoaded: Bool { get }
-
Declaration
Swift
public override init()
-
Intialize common banuba SDK resources. This must be called before
BanubaSdkManger
instance creation. Counterpartdeinitialize
exists.Declaration
Swift
@objc public class func initialize( resourcePath: [String] = [], clientTokenString: String, logLevel: BNBSeverityLevel = .info )
Parameters
resourcePath
paths to cutom resources folders
clientTokenString
client token
logLevel
log level
-
Release common Banuba SDK resources
Declaration
Swift
@objc public class func deinitialize()
-
Enables performance diagnostics. Don’t call before initialize.
Declaration
Swift
@objc public class func enableDiagnostics(outputFolder: String)
-
Declaration
Swift
@objc public func setDrawOnDemandMode(_ mode: Bool)
-
Declaration
Swift
@objc public func requestFrameDraw()
-
Declaration
Swift
@objc public func setup(configuration: EffectPlayerConfiguration)
-
Declaration
Swift
@objc public func destroy()
-
BNBEffectPlayer may crash on certain devices. So, we downscale the input image before processing.
Declaration
Swift
@objc public static func scaleBeforeProcessing(_ buffer: CVPixelBuffer?) -> CVPixelBuffer?
-
Declaration
Swift
public func push(cmBuffer: CMSampleBuffer)
-
Declaration
Swift
public func push(cvBuffer: CVPixelBuffer)
-
Declaration
Swift
public func startEffectPlayer()
-
Declaration
Swift
public func stopEffectPlayer()
-
Declaration
Swift
public func destroyEffectPlayer()
-
startEditingImage(_:
recognizerIterations: imageOrientation: requireMirroring: faceOrientation: fieldOfView: resetEffect: completion: ) Image editing mode - renders effect on single frame prepared from image, applies effect on image in full resolution.
Workflow to use editing:
- Configure effect player with correct render target and render size to match aspect ratio of edited image (could be done with setRenderTarget call), load needed effect. Pay attention that render size could be less than original image size (moreover, bigger resolution could cause performance issues), the only restriction is to preserve aspect ratio.
- Call startEditingImage. Completion block returns is any face found or not. From that moment image with applied effect is rendered on provided render target.
- Call captureEditedImage to get edited image with applied effect in fullsize resolution.
- Call stopEditingImage. After that moment user can switch to other render target and restore previous logic (push frames from camera), if needed.
Declaration
Swift
public func startEditingImage( _ image: UIImage, recognizerIterations: NSNumber? = nil, imageOrientation: BNBCameraOrientation = .deg0, requireMirroring: Bool = false, faceOrientation: Int = 0, fieldOfView: Float = 60, resetEffect: Bool = false, completion: ((Int, CGRect) -> Void)? = nil )
-
updateEditingFrameWithImage(_:
imageOrientation: requireMirroring: faceOrientation: fieldOfView: completion: ) Helper method to fast image update during editing mode, when image is changed without modifying facial features, so framedata from previous image will be correct for new one.
Declaration
Swift
public func updateEditingFrameWithImage(_ image: UIImage, imageOrientation: BNBCameraOrientation = .deg0, requireMirroring: Bool = false, faceOrientation: Int = 0, fieldOfView: Float = 60, completion: ((Bool) -> Void)? = nil)
-
Declaration
Swift
public func captureEditedImage( imageOrientation: BNBCameraOrientation = .deg0, resetEffect: Bool = false, completion: @escaping (UIImage?) -> Void)
-
Declaration
Swift
public func stopEditingImage(startCameraInput: Bool = false)
-
Declaration
Swift
public func makeCameraPhoto(cameraSettings: CameraPhotoSettings, flipFrontCamera: Bool = false, srcImageHandler: ((CVPixelBuffer) -> Void)? = nil, completion: @escaping (UIImage?) -> Void)
-
Declaration
Swift
public func processImageData( _ inputData: CVImageBuffer, orientation: BNBCameraOrientation = .deg0, faceOrientation: Int = 0, fieldOfView: Float = 60, isMirrored: Bool = false, completion: @escaping (UIImage?) -> Void )
-
Declaration
Swift
public func processImageData( _ imputImage: UIImage, orientation: BNBCameraOrientation = .deg0, fieldOfView: Float = 60, isMirrored: Bool = false, completion: @escaping (UIImage?) -> Void )
-
Declaration
Swift
public func configureWatermark(_ watermarkInfo: WatermarkInfo)
-
Declaration
Swift
public func removeWatermark()
-
Declaration
Swift
public func startVideoProcessing( width: UInt, height: UInt, orientation: BNBCameraOrientation = .deg0, resetEffect: Bool = false )
-
Declaration
Swift
public func stopVideoProcessing(resetEffect: Bool = false)
-
processVideoFrame(from:
to: timeNs: iterations: cameraOrientation: requireMirroring: faceOrientation: fieldOfView: ) Declaration
Swift
public func processVideoFrame( from: CVPixelBuffer, to: CVPixelBuffer, timeNs: Int64, iterations: NSNumber? = nil, cameraOrientation: BNBCameraOrientation = .deg0, requireMirroring: Bool = false, faceOrientation: Int = 0, fieldOfView: Float = 60 )
-
Declaration
Swift
public var photoCameraOrientation: BNBCameraOrientation { get }
-
Declaration
Swift
public var photoImageOrientation: UIImage.Orientation { get }
-
Declaration
Swift
@objc public func activateRenderTarget()
-
Declaration
Swift
@objc public func surfaceChanged(width: CGFloat, height: CGFloat)
-
Declaration
Swift
public func onCameraPoiChanged(_ x: Float, y: Float)
-
Declaration
Swift
public func onFaceNumberChanged(_ faceNumber: Int32)
-
Declaration
Swift
public func onRecognizerFrameDurationChanged( _ instant: Float, averaged: Float )
-
Declaration
Swift
public func onCameraFrameDurationChanged(_ instant: Float, averaged: Float)
-
Declaration
Swift
public func onRenderFrameDurationChanged(_ instant: Float, averaged: Float)