Skip to main content

How to use Face State Triggers in iOS

Banuba SDK has several face state triggers. To use them, you need to follow the next steps

Usage of Face State Triggers in your iOS app#

  1. Import BanubaEffectPlayer framework into your project.
    import BanubaEffectPlayer
  2. Add BNBFrameDataListener to your ViewController
    sdkManager.effectPlayer?.add(self as BNBFrameDataListener)
    note

    Remove BNBFrameDataListener when your ViewController is deinited

    sdkManager.effectPlayer?.remove(self as BNBFrameDataListener)
  3. Inherit interface BNBFrameDataListener and add protocol stubs
    extension ViewController: BNBFrameDataListener {
    func onFrameDataProcessed(_ frameData: BNBFrameData?) {
    }
    }
  4. From BNBFrameData you can get information about smile, mouth, brows and others
    extension ViewController: BNBFrameDataListener {
    func onFrameDataProcessed(_ frameData: BNBFrameData?) {
    guard let fD = frameData else { return }
    fD.getIsMouthOpen() //-> Bool
    fD.getIsSmile() //-> Bool
    fD.getIsBrowsRaised() //-> Bool
    fD.getIsBrowsShifted() //-> Bool
    }
    }
  5. Now you can use Face State Triggers in your iOS app
Last updated on