Skip to content

Latest commit

 

History

History
189 lines (129 loc) · 3.59 KB

integration_guide.md

File metadata and controls

189 lines (129 loc) · 3.59 KB

Integration Guide

  1. Configuration
  2. Usage
  3. Add AR Effects
  4. Additional Methods

Configuration

Android

  1. Define Banuba SDK version in the android build.gradle:
    ext {
        bnb_sdk_version = '1.16.+'
    }

IOS

  1. Add the source and version of the Banuba SDK in the IOS Podfile:
    source 'https://github.com/sdk-banuba/banuba-sdk-podspecs.git'
    $bnb_sdk_version = '~> 1.16.0'
  1. Add NSCameraUsageDescription in the Info.plist:
    <key>NSCameraUsageDescription</key>
    <string>We use camera to render AR effects</string>

Usage

  1. Init BanubaSdkManager:
    await _banubaSdkManager.initialize([],
        "Client Token",
        SeverityLevel.info);
  1. Attach EffectPlayerView to BanubaSdkManager:
    final _epWidget = EffectPlayerWidget(key: null);

    ...

    await _banubaSdkManager.attachWidget(_epWidget.banubaId);
  1. Start player:
    await _banubaSdkManager.openCamera();
    await _banubaSdkManager.startPlayer();
  1. Load and apply Effect:
    await _banubaSdkManager.loadEffect("path to the effect", false);

Add AR effects

Banuba Face AR SDK product is used on camera for applying various AR effects while making a content:

  1. Android - Add the folder with your effects to your project and setup it in the android build.gradle app module:
    task copyEffects {
        copy {
            from flutter.source + '/effects'
            into 'src/main/assets/bnb-resources/effects'
        }
    }

    gradle.projectsEvaluated {
        preBuild.dependsOn(copyEffects)
    }
  1. IOS - just link effects folder into Runner Xcode project (File -> Add Files to 'Runner'...).

Additional methods

  • Releases common Banuba SDK resources:
    static void deinitialize() {}
  • Creates and attaches render processing to a specific view:
    void attachWidget(int banubaId);
  • Closes Camera:
    void closeCamera();
  • Stops render processing. Effects will not be applied:
    void stopPlayer();
  • Unloads effect. Invoke this method after startPlayer:
    void unloadEffect();
  • Used for passing specific expressions to interact with an effect:
    void evalJs(String script);
  • Sets camera zoom level:
    void setZoom(double zoom);
  • Enables flashlight. Available only for back camera facing:
    void enableFlashlight(bool enabled);
  • Start video recording:
    void startVideoRecording(
        String filePath, bool captureAudio, int width, int height);
  • Stops video recording:
    void stopVideoRecording();
  • Takes photo from camera:
    void takePhoto(String filePath, int width, int height);
  • Sets camera facing: front, back:
    void setCameraFacing(bool front);
  • Processes image with applied effect:
    void processImage(String sourceFilePath, String destFilePath);
  • Starts image editing mode:
    void startEditingImage(String sourceImageFilePath);
  • Ending editing image and save result to destination file:
    void endEditingImage(String destImageFilePath);
  • Discard editing image mode:
    void discardEditingImage();