> 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-grabacion.md).

# Video Recording - Videorecording

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

The *Component* The one handled in the current document is called ***VideoRecording Component***. It is responsible for capturing the device screen in the background. It is mainly intended for recording the Onboarding process.

In the section of [Simplified Launch](/docs.facephi-en/sdks/sdk-mobile/ios-sdk/inicializacion/lanzamiento-simplificado.md) the steps required for the SDK's basic integration are detailed. This section adds the information for launching this component.

## Dependencies

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*), these must be completely removed before installing the components of the ***SDKMobile***.

### CocoaPods

* Currently, FacePhi libraries are distributed remotely through different dependency managers, in this case CocoaPods. The dependencies **mandatory** dependencies that must have been installed previously (by adding them to the project's Podfile file) are:

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

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

```swift
  pod 'FPHISDKVideoRecordingComponent', '~> $VERSION'
```

### SPM

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

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

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

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

## Permissions

In the client application where the components will be integrated, it is necessary to include the following element in the **Info.plist** when recording is going to include audio:

```
It is necessary to allow microphone usage (NSMicrophoneUsageDescription - Privacy - Microphone Usage Description)
```

{% hint style="info" %}
Microphone permission is only necessary if you activate **`enableAudio`** in **`VideoRecordingConfigurationData`**. By default **`enableAudio`** is **`false`** and recording does not capture audio.
{% endhint %}

## Available controllers

| **Controller**           | **Description**                 |
| ------------------------ | ------------------------------- |
| VideoRecordingController | Main Video Recording Controller |

## Simplified Launch

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.

### Controller declaration

```swift
private var videoRecordingController: VideoRecordingController?
```

### Launching capture

To start screen recording:

```swift
public func launchVideoRecording(viewController: UIViewController) {
    let data = VideoRecordingConfigurationData()
    let videoRecordingController = VideoRecordingController(
        data: data,
        viewController: viewController,
        output: {
            print("videoRecordingController output: \($0.errorType)")
        })
    SDKController.shared.launch(controller: videoRecordingController)
    self.videoRecordingController = videoRecordingController
}
```

### Stop capture

To stop screen recording:

```swift
public func stopVideoRecording() {
    self.videoRecordingController?.stopVideoRecording()
}
```

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

Errors will be returned as a 'VideoRecordingError' object.

List of errors:

* VRC\_EMPTY\_LICENSE: The license String is empty
* VRC\_INITIALIZATION\_ERROR: Initialization error
* VRC\_OPERATION\_NOT\_CREATED: There is no operation in progress
* VRC\_NETWORK\_CONNECTION: Internet connection error
* VRC\_PERMISSION\_ERROR: The user has rejected the permissions
* VRC\_SOCKET\_ERROR: Services connection error
* VRC\_UNKNOWN\_ERROR: Unknown error
* VRC\_VIDEO\_CALL\_ACTIVE: Cannot start because there is an active Video Call
* VRC\_VIDEO\_ERROR: Error in video processing
* VRC\_VIDEO\_RECORDING\_ACTIVE: Cannot start because the video recording process is active

## Advanced information

This section expands on the component information.

### Advanced component configuration <a href="#id-51-configuracion-avanzada-del-componente" id="id-51-configuracion-avanzada-del-componente"></a>

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

Below are all the fields that are part of this class.

The fields included in the configuration, normally **do not need to be provided** since they are completed internally through the license used.

These fields are usually reported **only** when the **server** is **On-Premise**.

#### **url**

Video socket path

#### **apiKey**

ApiKey required for connection with the video socket

#### **tenantId**

Tenant identifier referring to the current client, necessary for connection to the video service.

#### **enableAudio**

Flag that allows you to configure whether video recording will have audio or not. By default to `false`.

{% hint style="info" %}
If **`enableAudio`** is **`true`**, you must declare the microphone permission in **Info.plist** (see the section [Permissions](#permisos)).
{% endhint %}
