> For the complete documentation index, see [llms.txt](https://docs.facephi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.facephi.com/docs.facephi-en/sdks/sdk-mobile/ios-sdk/modulos/video-identificacion.md).

# Video Identification - VideoID

## Introduction <a href="#id-1-introduccion" id="id-1-introduccion"></a>

Face Capture is performed with the ***VideoID Component***.

This component is responsible for recording a user while they identify themselves, showing their face and their Identity document.

* Internal management of cameras, microphone, and permissions.
* Connection with the services.
* OCR reading and document capture.

In the section of [Simplified Launch](/docs.facephi-en/sdks/sdk-mobile/ios-sdk/inicializacion/lanzamiento-simplificado.md) the necessary steps for the basic integration of the SDK are detailed. In this section, information is added for the launch of this component.

## Dependency

To avoid conflicts and compatibility issues, if you want to install the component in a project that contains an old version of the Facephi libraries (*Widgets*), they must be completely removed before installing the components of the ***SDKMobile***.

### **CocoaPods**

* The required dependencies that must have been installed previously (by adding them to the project's Podfile) are:

```
pod 'FPHISDKMainComponent', '~> $VERSION'
```

* To install the NFC component, the following entry must be included in the application's Podfile:

```
pod 'FPHISDKVideoIDComponent', '~> $VERSION'
```

### **SPM**

* The mandatory dependencies that must have been installed previously are:

```
//HTTPS
https://github.com/facephi-clienters/SDK-SdkPackage-SPM.git
//SSH
git@github.com:facephi-clienters/SDK-SdkPackage-SPM.git

```

* To install the video identification component, it must be included in the project's modules:

```
//HTTPS
https://github.com/facephi-clienters/SDK-VideoIDPackage-SPM.git
//SSH
git@github.com:facephi-clienters/SDK-VideoIDPackage-SPM.git
```

## Permissions

In the client application where the components are to be integrated, it is necessary to include the following elements in the file **Info.plist**:

```
Camera usage must be allowed (Privacy - Camera Usage Description)
It is necessary to allow the use of the microphone (NSMicrophoneUsageDescription - Privacy - Microphone Usage Description)
```

## Available controllers <a href="#id-4-controladores-disponibles" id="id-4-controladores-disponibles"></a>

| **Controller**             | **Description**                                 |
| -------------------------- | ----------------------------------------------- |
| VideoIdController          | Main controller of video identification         |
| SignatureVideoIdController | Controller for signing a process with a Capture |

## Simplified Launch <a href="#id-4-lanzamiento-simplificado" id="id-4-lanzamiento-simplificado"></a>

Once the SDK has been started and a new operation has been created, the component can be launched. Any of its controllers can be used to execute its functionality.

Launch:

```
let controller = VideoIdController(
  data: videoIdConfigurationData,
  output: { sdkResult in
    // Do whatever with the result
    ...
  }, viewController: viewController)
SDKController.shared.launch(controller: controller)
```

## Basic configuration <a href="#id-5-configuracion-basica" id="id-5-configuracion-basica"></a>

To launch the current component, an object *VideoIdConfigurationData* must be created, which will be the configuration of the component controller.

The basic configuration needed for this is as follows:

```swift
static var videoIDConfiguration: VideoIDConfigurationData {
    return VideoIDConfigurationData(mode: .FACE_DOCUMENT_FRONT_BACK)
}
```

The different modes are:

* .ONLY\_FACE
* .FACE\_DOCUMENT\_FRONT
* .FACE\_DOCUMENT\_FRONT\_BACK

## Result reception <a href="#id-7-recepcion-del-resultado" id="id-7-recepcion-del-resultado"></a>

The controllers will return the necessary information in SdkResult format.

### Error handling <a href="#id-71-recepcion-de-errores" id="id-71-recepcion-de-errores"></a>

In the error section, we will have the common enum *ErrorType*:

* VID\_CANCEL\_BY\_USER: The user has canceled the process
* VID\_CANCEL\_LAUNCH: A general cancellation of the SDK has been performed
* VID\_COMPONENT\_LICENSE\_ERROR: The component License is not valid
* VID\_EMPTY\_LICENSE: The License string is empty
* VID\_FACE\_DETECTION\_TIMEOUT: No face detected
* VID\_INITIALIZATION\_ERROR: Initialization error
* VID\_MANAGER\_NOT\_INITIALIZED: The managers are null
* VID\_NETWORK\_CONNECTION: Error in the internet connection
* VID\_NO\_DATA\_ERROR: The input data are null
* VID\_OPERATION\_NOT\_CREATED: There is no operation in progress
* VID\_PERMISSION\_DENIED: The user has denied the permissions
* VID\_SOCKET\_ERROR: Error in the services connection
* VID\_TIMEOUT: Timeout in the process
* VID\_VIDEO\_ERROR: Error in video processing
* VID\_VIDEO\_RECORDING\_ACTIVE: It cannot be started because the video recording process is active

### Successful execution receipt - *data* <a href="#id-62-recepcion-de-ejecucion-correcta-data" id="id-62-recepcion-de-ejecucion-correcta-data"></a>

In the SdkResult.Success part - *data*, we will have the VideoIdResult class.

The result returns the images in SdkImage format **SdkImage**, it is possible to extract the bitmap by accessing *image.bitmap*. If you wanted to convert it to base64, you can use the function:

`Base64.encodeToString(this.toByteArray(), Base64.NO_WRAP)`

The fields returned in the result are as follows:

**frontDocumentData**

Front document data. Includes:

* documentImage: Document image
* documentFullImage: Full captured image
* documentFaceImage: If a face is found on the document, its image is returned.
* iqaOverExposure: Numerical value between 0 and 1 that indicates the level of overexposure of the image; a high value suggests that the image is too bright, which can make the document harder to read.
* iqaReadable: Numerical value between 0 and 1 that indicates the readability of the document text; higher values imply that the text is clearer and easier to recognize.
* iqaSharpness: Numerical value between 0 and 1 that indicates the sharpness of the document image; high values reflect a more focused image, which improves data extraction capability.
* documentFaceImageTokenized: If a face is found on the document, its encrypted image is returned.

**backDocumentData**

Back document data. Includes:

* documentImage: Document image
* documentFullImage: Full captured image
* documentFaceImage: If a face is found on the document, its image is returned.
* iqaOverExposure: Numerical value between 0 and 1 that indicates the level of overexposure of the image; a high value suggests that the image is too bright, which can make the document harder to read.
* iqaReadable: Numerical value between 0 and 1 that indicates the readability of the document text; higher values imply that the text is clearer and easier to recognize.
* iqaSharpness: Numerical value between 0 and 1 that indicates the sharpness of the document image; high values reflect a more focused image, which improves data extraction capability.
* documentFaceImageTokenized: If a face is found on the document, its encrypted image is returned.

**faceImage**

User image captured in the first section of the process.

**ocrMap**

OCR map extracted from the document.

**ocrDiagnostic**

Dictionary with the OCR diagnosis of the document. The keys are the fields to validate and the values are instances of OcrDiagnostic.

OCR diagnosis extracted from the document.

* OK: The OCR is correct.
* NOT\_FOUND: The OCR key is not found.
* TOLERANCE\_ERROR: The OCR is not correct.
* WARNING: The OCR is not correct, but it is only a warning because it is an optional field.

**matchingSidesScore**

Numeric value between 0 and 1 that estimates the level of match between the faces of the document (front and back).

**documentType**

Document type obtained.

**personalData**

Reduced set of data obtained from the user:

* issuer
* documentNumber
* issueDate
* expiryDate
* name
* surname
* fullName
* gender
* birthDate
* birthPlace
* nationality
* address
* nfcKey
* numSupport
* mrz

**speechText**

Text that the user must say during the video recording.

**faceImageTokenized**

Encrypted image of the user captured in the first section of the process.

## Component Customization <a href="#id-8-personalizacion-del-componente" id="id-8-personalizacion-del-componente"></a>

Besides the changes that can be made at SDK level (which are explained in the document of *SDK Customization*), this specific component allows its interface to be modified.

### Texts <a href="#id-81-textos" id="id-81-textos"></a>

The texts can be customized by overriding the value of the following keys in a **Localizable.strings**. The keys containing the suffix ***\_alt*** are the literals used in the accessibility labels needed for the functionality of ***voice over***.

| **Name**                                                      | **Value**                                                                                  |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| video\_id\_component\_init\_message\_face\_content\_desc      | Place your face and the front of your document in the markers                              |
| video\_id\_component\_finish\_message                         | Video recording finished!                                                                  |
| video\_id\_component\_finish\_button                          | FINISH                                                                                     |
| video\_id\_component\_restart\_button                         | RECORD AGAIN                                                                               |
| video\_id\_component\_ready\_button                           | CONTINUE                                                                                   |
| video\_id\_component\_exit\_alert\_cancel                     | Cancel                                                                                     |
| video\_id\_component\_exit\_alert\_question                   | Are you sure you want to finish the process?                                               |
| video\_id\_component\_exit\_alert\_finish                     | Finish                                                                                     |
| video\_id\_component\_exit\_alert\_accept                     | Accept                                                                                     |
| video\_id\_component\_timeout\_title                          | Timeout exceeded                                                                           |
| video\_id\_component\_timeout\_desc                           | We couldn't complete the recording in time. Let's try again.                               |
| video\_id\_component\_internal\_error\_title                  | An error has occurred                                                                      |
| video\_id\_component\_internal\_error\_desc                   | Let's try again.                                                                           |
| video\_id\_component\_close\_button\_alt                      | Close                                                                                      |
| video\_id\_component\_back\_button\_alt                       | Back                                                                                       |
| video\_id\_component\_logo\_alt                               | Logo                                                                                       |
| video\_id\_component\_document\_front\_message                | Place the front of your document in the markers                                            |
| video\_id\_component\_document\_front\_message\_readable      | Keep the front of your document in the markers                                             |
| video\_id\_component\_document\_front\_message\_not\_readable | Bring the front of your document closer to the markers                                     |
| video\_id\_component\_document\_back\_message                 | Now place the back of your document                                                        |
| video\_id\_component\_document\_back\_message\_readable       | Keep the back of your document in the markers                                              |
| video\_id\_component\_document\_back\_message\_not\_readable  | Bring the back of your document closer to the markers                                      |
| video\_id\_component\_switch\_camera\_message                 | Prepare the document while the camera is being switched                                    |
| video\_id\_component\_face\_message                           | Place your face within the frame.                                                          |
| video\_id\_component\_multiple\_face\_message                 | Multiple faces detected. Place only your face within the frame                             |
| video\_id\_component\_speech\_message                         | Say out loud: "I (first and last name) accept the terms and conditions".                   |
| video\_id\_component\_front\_document\_captured\_message      | Front of the document captured correctly                                                   |
| video\_id\_component\_document\_back\_finish\_message         | Back of the document captured correctly                                                    |
| video\_id\_component\_face\_timeout\_title                    | We have not detected your face                                                             |
| video\_id\_component\_face\_timeout\_desc                     | Please place your face on the marker to start the process                                  |
| video\_id\_component\_ocr\_error\_desc                        | The document could not be read. Please check the lighting and the distance from the camera |

### Animations <a href="#id-82-animaciones" id="id-82-animaciones"></a>

If you want to modify the SDK animations (lottie), you must include the animations with the same name in the application's res/raw/ folder.

```
video_id_anim_doc_and_face.json
video_id_anim_face.json
video_id_anim_loading.json
```
