Overview

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

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

Photo Editor SDK incudes Face AR product and an exclusive effect that allows to apply various features.

The biggest part of the SDK size are Face AR resources and Photo Editor effect which is around 70% . This number depends on product versions

Solution

Integrate SDKs with cut resources. Download and put these resource in runtime.

Implementation

All changes are available in PullRequest

  1. Upgrade to the latest SDK builds. Warning the following pods list is different to default VE 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.38.0'
  pod 'BanubaARCloudSDK', banuba_sdk_version #optional
  pod 'BanubaVideoEditorSDK', banuba_sdk_version
  pod 'BanubaAudioBrowserSDK', banuba_sdk_version #optional
  pod 'BanubaSDKLight', banuba_sdk_version
  pod 'BanubaSDKServicing', banuba_sdk_version
  pod 'VideoEditor', banuba_sdk_version
  pod 'BanubaUtilities', banuba_sdk_version
  pod 'BanubaVideoEditorGallerySDK', banuba_sdk_version
  pod 'BanubaLicenseServicingSDK', banuba_sdk_version

  pod 'BNBLicenseUtils', banuba_sdk_version
  
  pod 'VEExportSDK', banuba_sdk_version
  pod 'VEEffectsSDK', banuba_sdk_version
  pod 'VEPlaybackSDK', banuba_sdk_version

  # Photo Editor
  
  pod 'BanubaPhotoEditorSDKLight', '1.2.4'
end
    
  1. Put bnb-resources.zip file to your server. This file contains Face AR resources and Photo Editor effect. You are responsible for downloading this resources end 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 to Android SDK resources zip file.

    </aside>

    bnb-resources.zip

    // 1. Download resources from server first
    let resourcesZipFile = ...
    
    // 2. Unzip resources zip file
    let resourcesURL = ...
    
  2. Setup Video Editor with downloaded resources

    // 1. Initialize Banuba Video Editor instance first
    let videoEditorSDK = BanubaVideoEditor(
      token: token,
      configuration: config
    )
    
    // 2. Provide path to downloaded and extracted resources
    BNBUtilityManager.addResourcePath(resourcesURL.path)
    
    // 3. 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,
      **resourcesURL: resourcesURL**
    )
    
    // 2. Initialize Banuba Photo Editor instance with updated configuration
    photoEditorSDK = BanubaPhotoEditor(
      token: token,
      configuration: configuration
    )
    

<aside> ❗

Warning : This is important to provide Face AR resources for Banuba Video Editor after initializing because missing Face AR resources crashes Banuba Video Editor

</aside>

<aside> ⚠️

Migration to VE 1.39.0 and PE 1.2.5 you can find here

</aside>