Overview

This doc explains how to reduce the size of Video Editor and Photo Editor SDK in your app bundle.

The Video Editor SDK includes the Face AR product for playing AR effects. Face AR contains many heavy resources that take up space in the SDK.

The Photo Editor SDK includes the Face AR product and an exclusive effect that allows applying various features.

The biggest part of the SDK size are the Face AR resources and the Photo Editor effect, which account for approximately 70% of the total size. This percentage may vary depending on the product versions.

Solution

Integrate the SDKs with trimmed resources, then download and provide those resources at runtime.

Implementation

All changes are available in this PullRequest

  1. Upgrade to the latest SDK builds.

Warning: The following pod list differs from the default Video Editor SDK pods.

source '<https://github.com/Banuba/specs.git>'
source '[<https://github.com/sdk-banuba/banuba-sdk-podspecs.git>](<https://github.com/sdk-banuba/banuba-sdk-podspecs.git>)'
platform :ios, '15.0'
use_frameworks!

target 'Example' do
  
  # Video Editor
  
  banuba_sdk_version = '1.51.0'
  pod 'BanubaVideoEditorSDK', banuba_sdk_version
  pod 'BanubaSDKLight', banuba_sdk_version
  
  pod 'BanubaARCloudSDK', banuba_sdk_version      # optional
  pod 'BanubaAudioBrowserSDK', banuba_sdk_version # optional
  pod 'BanubaGenAIVideos', banuba_sdk_version     # optional

  # Photo Editor
  
  pod 'BanubaPhotoEditorSDKLight', '1.3.5'
end
    
  1. Place the bnb-resources.zip file on your server.

    This file contains Face AR resources and Photo Editor effect. You are responsible for downloading this resources and extracting in your app. In this example resources embedded to the project end extracted once at start of the app.

    <aside> ❗

    IMPORTANT : This resources zip file is different from the Android SDK resources zip file.

    </aside>

    bnb-resources.zip

    // 1. Download resources from server first
    let resourcesZipFile = ...
    
    // 2. Unzip resources zip file
    let resourcesURL = ...
    

    This file contains the Face AR resources and the Photo Editor effect. You are responsible for downloading this resource and extracting it in your app.

    In the

    example PR

    , the resources are embedded in the project and extracted once when the app starts (for demonstration purposes). In a real‑world scenario, you would download them from your server.

  2. Setup Video Editor with downloaded resources

    // 1. Initialize Banuba Video Editor instance with path to downloaded and extracted resources
    let videoEditorSDK = BanubaVideoEditor(
      token: token,
      arguments: [
        **.externalFARResourcesURL: resourcesURL,
        .externalPhotoEditorResourcesURL: resourcesURL.appendingPathComponent("photo_editor")**
      ],
      configuration: config
    )
    
    // 2. Video Editor is ready for presenting
    videoEditorSDK.presentVideoEditor(...
    
  3. Setup Photo Editor with downloaded resources

    // 1. Provide path to downloaded and extracted resources in Photo Editor Configuration
    let configuration = PhotoEditorConfig(
      previewScreenMode: .disabled,
      **beautyMaskURL: resourcesURL.appendingPathComponent("photo_editor")
      effectPlayerResourcesURL: resourcesURL**
    )
    
    // 2. Initialize Banuba Photo Editor instance with updated configuration
    photoEditorSDK = BanubaPhotoEditor(
      token: token,
      configuration: configuration
    )
    

<aside> ❗

Warning: It is essential to provide the Face AR resources when initializing the Video Editor. Missing these resources will cause the SDK to crash.

</aside>