Skip to content

Introduction

The goal of this framework is to capture a selfie video guiding the user in a self-contained and accessible system.

This SDK captures a selfie video with the device front camera.

Some permissions are needed and have to be written in the info.plist of the app using the framework:

  • Camera.
  • Microphone.

In order to improve the user experience, the camera takes the selfie video automatically (without touching the screen), this is done due to its automatic face recognition and tracking.

The video is recorded in mp4 format. The image is encoded with h264 codification and the audio with aac codification.

Additionally, there are two working modes which can be selected:

  • VD_ONBOARDING: full lifeproof mode with SEPBLAC requirements, showing ID card.
  • VD_AUTHENTICATION: lifeproof mode to authenticate the user.

The SDK can be configured using a dictionary. All possible keys and values can be checked in Configuration.

Description

  • The detected documents are (Document id: description):
    • AR_IDCard_2009: Argentina IDCard 2009 v2
    • AR_IDCard_2012: Argentina IDCard 2012 v2
    • AT_DrivingLicense_2006: Austria DrivingLicense 2006
    • AT_DrivingLicense_2014: Austria DrivingLicense 2014
    • AT_IDCard_2002: Austria IDCard 2002
    • AT_IDCard_2010: Austria IDCard 2010
    • AT_IDCard_2021: Austria IDCard 2021
    • AT_ResidencePermit_2005: Austria ResidencePermit 2005
    • AT_ResidencePermit_2011: Austria ResidencePermit 2011
    • AT_ResidencePermit_2020: Austria ResidencePermit 2020
    • CO_IDCard_2000: Cedula de Ciudadania 2000
    • DE_IDCard_2007: Germany IDCard 2007
    • DE_IDCard_2010: Germany IDCard 2010
    • ES_IDCard_2006: DNI 2.0
    • ES_IDCard_2015: DNI 3.0
    • ES_IDCard_2021: Spain IDCard 2021 (DNI 4.0)
    • ES_ResidencePermit_2007: Spain ResidencePermit 2007 v2 (CERCU)
    • ES_ResidencePermit_2010: NIE 2010
    • ES_ResidencePermit_2011: NIE 2011
    • ES_ResidencePermit_2020: NIE 2020
    • HR_IDCard_2003: Croatia IDCard 2003
    • HR_IDCard_2015: Croatia IDCard 2015
    • HR_IDCard_2021: Croatia IDCard 2021
    • HU_IDCard_2000: Hungary IDCard 2000
    • HU_IDCard_2015: Hungary IDCard 2015
    • MX_IDCard_2008: Credencial C
    • MX_IDCard_2014: Credencial D/E/F
    • MX_IDCard_2019: Credencial G
    • MYS2001: Malaysia IDCard
    • PE_IDCard_2007: Peru IDCard 2007
    • PE_IDCard_2013: Peru IDCard 2013
    • PE_IDCard_2020: Peru IDCard 2020
    • PE_ResidencePermit_2017: Peru ResidencePermit 2017
    • RO_IDCard_2009: Romania IDCard 2009 and 2017
    • RO_IDCard_2021: Romania IDCard 2021
  • Other documents can be passed to the SDK but are not detected.

Specifications

  • iOS (iPhone only) minimum operating system version: 11.0.
  • Additionally, some dependencies are needed.
    • Internal dependencies.
      • VDLibrary.
      • ImageProcessing.
  • Full SDK implementation sizes in MB:

    Architecture VDLibrary ImageProcessing SDK Total
    arm64 (device) 2.67 10.40 1.95 15.02
    arm64 (simulator) 2.65 10.37 1.94 14.96
    x86_64 (simulator) 2.62 16.07 1.91 20.60
    TOTAL 5.65 36.81 4.09 46.55

    These sizes have been calculated using lipo -detailed_info for fat libraries and gdu or du for the rest of files. No dSYMs folders are included in these sizes. The final AppStore and installed sizes may differ.

    If more than one architecture is supported the total size is the sum of each one of them, e.g. if all architectures are supported the combined size of this SDK and its dependencies will be a total of 46.55MB.

    The final user is not affected by this total size because the store only distributes the specific architecture of the user's device once the app is downloaded and installed.

  • Video size is ~10MB for a 20 sec HD video.

Integration

  • Create a new Xcode project.
  • Add permissions required into Info.plist:
    • Camera Usage.
    • Microphone Usage.
  • Drag and drop all .xcframework into Xcode and copy inside project.
  • Add all .framework into the targets general tab, inside Embedded Binaries and Linked Frameworks and Libraries (if it does not appear yet), they should appear in mode "Embed & Sign".
  • Import VDVideoSelfieCapture/VDVideoSelfieCapture.h and implement VDVideoSelfieCaptureProtocol in the class that uses it.
  • Write down all the required delegated methods into the class that uses the framework. Call the methods of the SDK as needed.

SDK update

Once a new SDK is released the following steps have to be followed to properly update the SDK.

  • Remove all updating .framework located in the project. Do not remove only the reference; remove the actual file if the deletion is done with the help of Xcode. Just in case, empty the bin too.
  • Compile and/or run to force errors. If no error occurs then a cached framework is in memory. Clean cache and project.
  • Add all new .xcframework and implement new interfaces if necessary.
  • Compile and run.

In case of doubt, also the following can be done.

  • Check the installed version by calling the getVersion() method.
  • Check the md5/rsa values against the ones in the CHECKSUMS.md file.

Example of use

#import "VDVideoSelfieCapture/VDVideoSelfieCapture.h"
@interface ViewController () <VDVideoSelfieCaptureProtocol>

- (void) viewDidAppear:(BOOL)animated {
  NSMutableDictionary<NSString*, id>* configuration = [NSMutableDictionary dictionary];

  ////////////// Veridas' recommended configuration //////////////
  configuration[@"countdowntextcolor"] = @{@"alpha": @"1", @"red": @"255", @"green": @"255", @"blue": @"255"};
  configuration[@"tickcolor"] = @{@"alpha": @"1", @"red": @"83", @"green": @"163", @"blue": @"53"};
  configuration[@"tickcirclecolor"] = @{@"alpha": @"1", @"red": @"220", @"green": @"239", @"blue": @"212"};
  configuration[@"facemobileovalcolor"] = @{@"alpha": @"1", @"red": @"220", @"green": @"239", @"blue": @"212"};
  configuration[@"documentmobileovalcolor"] = @{@"alpha": @"1", @"red": @"220", @"green": @"239", @"blue": @"212"};
  configuration[@"videoinformativelabelbackgroundcolor"] = @{@"alpha": @"0.690", @"red": @"255", @"green": @"255", @"blue": @"255"};
  configuration[@"videoinformativelabelbackgroundcolorfinal"] = @{@"alpha": @"0.690", @"red": @"0", @"green": @"13", @"blue": @"68"};
  configuration[@"videoinformativelabelbordercolor"] = @{@"alpha": @"0.690", @"red": @"255", @"green": @"255", @"blue": @"255"};
  configuration[@"videoinformativelabelbordercolorfinal"] = @{@"alpha": @"0.690", @"red": @"0", @"green": @"13", @"blue": @"68"};
  configuration[@"videoinformativelabeltextcolor"] = @{@"alpha": @"1", @"red": @"255", @"green": @"255", @"blue": @"255"};
  configuration[@"documentlabeltextbackgroundcolor"] = @{@"alpha": @"0.690", @"red": @"255", @"green": @"255", @"blue": @"255"};
  configuration[@"documentlabeltextbackgroundcolorfinal"] = @{@"alpha": @"0.690", @"red": @"0", @"green": @"13", @"blue": @"68"};
  configuration[@"documentlabeltextcolor"] = @{@"alpha": @"1", @"red": @"255", @"green": @"255", @"blue": @"255"};
  configuration[@"tutorialbackgroundcolor"] = @{@"alpha": @"1", @"red": @"255", @"green": @"255", @"blue": @"255"};
  configuration[@"tutorialtitlecolor"] = @{@"alpha": @"1", @"red": @"0", @"green": @"13", @"blue": @"68"};
  configuration[@"tutorialtextcolor"] = @{@"alpha": @"1", @"red": @"0", @"green": @"13", @"blue": @"68"};
  configuration[@"tutorialcontinuebuttoncolor"] = @{@"alpha": @"1", @"red": @"0", @"green": @"13", @"blue": @"68"};
  configuration[@"tutorialcontinuebuttontextcolor"] = @{@"alpha": @"1", @"red": @"255", @"green": @"255", @"blue": @"255"};

  if(![VDVideoSelfieCapture isStarted]){
      //Document can be indicated to the SDK.
      [VDVideoSelfieCapture setDocumentStringToSearch:@"ES_IDCard_2006"]; or [VDVideoSelfieCapture setDocumentStringToSearch:VDVIDEO_ID_ES_IDCard_2006];
      // Start with configuration can be done.
      [VDVideoSelfieCapture startWithDelegate:self andConfiguration: configuration];
  }
}

// Delegated methods.
// Called when the selfie video has been captured
- (void)VDVideoSelfieCaptured:(NSData*)videoSelfieData{
  // Do as needed with the video.
}

// Called when the framework has finished.
// processFinished (Boolean) Indicates if the process has finished (true) or has been interrupted (false)
- (void)VDVideoSelfieAllFinished: (Boolean)processFinished {
    // When the framework ends, proceed as needed
}
import VDVideoSelfieCapture
class MyClass: VDVideoSelfieCaptureProtocol {
    // PROTOCOL IMPLEMENTATION.
    // Called when a selfie video has been captured
    func vdVideoSelfieCaptured(_ videoSelfieData: Data!) {
        // Do with data as needed.
    }
    // Called when the framework has finished.
    // processFinished (Boolean) Indicates if the process has finished (true) or has been interrupted (false)
    func vdVideoSelfieAllFinished(_ processFinished: Bool) {
        // When the framework ends, proceed as needed
    }
    ....

    // Call something like this to start the video selfie capture
    var configuration: [String: Any] = ["closebutton": "NO", "documentmobileoval": "YES"]

    ////////////// Veridas' recommended configuration //////////////
    configuration["countdowntextcolor"] = ["alpha": "1", "red": "255", "green": "255", "blue": "255"]
    configuration["tickcolor"] = ["alpha": "1", "red": "83", "green": "163", "blue": "53"]
    configuration["tickcirclecolor"] = ["alpha": "1", "red": "220", "green": "239", "blue": "212"]
    configuration["facemobileovalcolor"] = ["alpha": "1", "red": "220", "green": "239", "blue": "212"]
    configuration["documentmobileovalcolor"] = ["alpha": "1", "red": "220", "green": "239", "blue": "212"]
    configuration["videoinformativelabelbackgroundcolor"] = ["alpha": "0.690", "red": "255", "green": "255", "blue": "255"]
    configuration["videoinformativelabelbackgroundcolorfinal"] = ["alpha": "0.690", "red": "0", "green": "13", "blue": "68"]
    configuration["videoinformativelabelbordercolor"] = ["alpha": "0.690", "red": "255", "green": "255", "blue": "255"]
    configuration["videoinformativelabelbordercolorfinal"] = ["alpha": "0.690", "red": "0", "green": "13", "blue": "68"]
    configuration["videoinformativelabeltextcolor"] = ["alpha": "1", "red": "255", "green": "255", "blue": "255"]
    configuration["documentlabeltextbackgroundcolor"] = ["alpha": "0.690", "red": "255", "green": "255", "blue": "255"]
    configuration["documentlabeltextbackgroundcolorfinal"] = ["alpha": "0.690", "red": "0", "green": "13", "blue": "68"]
    configuration["documentlabeltextcolor"] = ["alpha": "1", "red": "255", "green": "255", "blue": "255"]
    configuration["tutorialbackgroundcolor"] = ["alpha": "1", "red": "255", "green": "255", "blue": "255"]
    configuration["tutorialtitlecolor"] = ["alpha": "1", "red": "0", "green": "13", "blue": "68"]
    configuration["tutorialtextcolor"] = ["alpha": "1", "red": "0", "green": "13", "blue": "68"]
    configuration["tutorialcontinuebuttoncolor"] = ["alpha": "1", "red": "0", "green": "13", "blue": "68"]
    configuration["tutorialcontinuebuttontextcolor"] = ["alpha": "1", "red": "255", "green": "255", "blue": "255"]

    if !VDVideoSelfieCapture.isStarted() {
        VDVideoSelfieCapture.setDocumentStringToSearch(documentName) // This document is retrieved, when possible, from VDDocumentCapture
        VDVideoSelfieCapture.start(withDelegate: self, andConfiguration: configuration)
    }
}

Workflow

The next diagram represents de current workflow of the framework. Some method's names may de shortened due to legibility issues.

Workflow

Third party libraries