Player
public class Player : NSObject
Player uses input to take processed frames, draw effect and present them into the outputs.
-
Declaration
Swift
public let effectPlayer: BNBEffectPlayer -
Declaration
Swift
public var enableTouches: Bool { get set } -
Rendering modes
See moreDeclaration
Swift
public enum RenderMode -
Setup rendering mode,
loopby defaultDeclaration
Swift
public var renderMode: RenderMode { get set } -
Current player
sizeDeclaration
Swift
public var size: CGSize { get } -
Player
volumein range [0, 1] where 1 is maximumDeclaration
Swift
public var volume: Float { get set } -
Current
effectDeclaration
Swift
public var effect: BNBEffect? { get } -
Create player
playshould be called after create, to starteffectapplyingDeclaration
Swift
public init(fps: Int = 30, renderBackend: BNBRenderBackendType = .metal, useThread: Bool = true)Parameters
fpsmax rendering frame rate, 30 by default
-
Start playback, create RenderTarget
Declaration
Swift
public func play() -
Pause playback
Declaration
Swift
public func pause() -
Stop playback, destroy RenderTarget
Declaration
Swift
public func stop() -
Use provided
inputwith currentoutputsDeclaration
Swift
public func use(input: Input?) -
Use provided
outputswith currentinputDeclaration
Swift
public func use(outputs: [Output]) -
Load
effectwith pathDeclaration
Swift
public func load(effect: String, sync: Bool = false, completion: ((BNBEffect?) -> Void)? = nil) -> BNBEffect? -
Reload
configfor current effect.Declaration
Swift
public func reload(config: String, sync: Bool = false) -> BNBReloadResult?Parameters
configeffect config JSON.
syncwait until effect is reloaded and activated.
-
Setup callback on
resizeeventDeclaration
Swift
public func onResize(action: @escaping (CGSize) -> Void)Parameters
actioncallback is fired when
inputgives frame with changedsize -
Setup callback on
rendereventDeclaration
Swift
public func onRender(action: @escaping (Bool, Int64) -> Void)Parameters
actioncallback which reports
statusandframeNumber, if success -
Draw and present rendered result synchronously, can be used only in
manualrendering mode.Declaration
Swift
public func render() -> Bool
Player Class Reference