Banuba SDK iOS

image

Banuba SDK delivery includes the following parts: BanubaSdk.frameworkand BanubaEffectPlayer.framework.

BanubaEffectPlayer.framework provides a relativly low-level cross-platform API which is described in the API reference.

BanubaSdk.framework is build on the top of BanubaEffectPlayer.framework and provides the iOS-specific functionality.

BanubaEffectPlayer.framework provided in the compiled form and BanubaSdk.framework in sources are available for your reference and fine-tuning.

The entry point to BanubaSdk.framework is BanubaSdkManager class. This class provides the following functionality:

  • Rendering layer configuration -- setRenderTarget (RenderTarget on the diagramm).
  • Start/stop Effect Player -- startEffectPlayer, stopEffectPlayer.
  • Continuous photo rendering (i.e. the dynamic effect applied to the frozen image) -- startEditingImage, captureEditedImage, stopEditingImage.
  • Take a photo with the camera and apply the current effect -- makeCameraPhoto.
  • Apply the effect to an in-memory photo (e.g. images created from files) -- processImageData.
  • Apply the watermark while rendering -- configureWatermark, removeWatermark.
  • Apply the effect to the sequence of frames in memory (e.g. video file) -- startVideoProcessing, stopVideoProcessing, processVideoFrame.
  • Push a frame from the camera -- push.
  • Take snapshots -- output?.takeSnapshot.
  • Record a screen video with effects applied -- outputService.startVideoCapturing, outputService.stopVideoCapturing (OutputService and SBVideoWriter on the diagramm).
  • Send frames to other destinations (e.g. via WebRTC) -- outoutService.startForwardingFrames, outputService.stopForwardingFrames.
  • Camera and audio input control -- input(instanse of InputService, see the diagramm).
  • Capturing the frames rendered (in binary form, used for debugging) -- setFrameDataRecord.
  • Voice Changer (change user's voice in videos) -- voiceChanger.

The Effect component makes up an essential part of the SDK usage. The effect is represented as a folder with scripts and resources. Please, refer to the iOS demo app section for more details about effects.

Configuring watermark

If you wan't to apply watermark to your photos, you should use output?.takeSnapshot method instead of makeCameraPhoto. Watermark can be used only with snapshots made with takeSnapshot.

guard let watermark = UIImage(named: "YOUR_WATERMARK_IMAGE") else {return}
let offset = CGPoint(x: 20.0, y: 10.0)
let watermarkInfo = WatermarkInfo(image: watermark,
corner: .bottomLeft, offset: offset, targetNormalizedWidth: 0.7)
sdkManager.configureWatermark(watermarkInfo)
let config = OutputConfiguration(applyWatermark: true, adjustDeviceOrientation: true,
mirrorFrontCamera: false)
sdkManager.output?.takeSnapshot(configuration: config) {}
Still have any questions about FaceAR SDK for iOS?

Visit our FAQ or contact our support.

Last updated on