> 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/android-sdk/componentes-modulos/video-grabacion.md).

# Video Recording - Videorecording

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

Screen video recording is done with the ***VideoRecording Component***.

This component is responsible for capturing the device screen in the background. It is mainly intended for recording the onboarding process.

***

## Dependency <a href="#id-2-dependencia" id="id-2-dependencia"></a>

The component's specific dependency is:

```
implementation "com.facephi.androidsdk:video_recording_component:$version"
```

***

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

| **Controller**               | **Description**                     |
| ---------------------------- | ----------------------------------- |
| VideoRecordingController     | Main video recording controller.    |
| StopVideoRecordingController | Controller to stop video recording. |

***

***

## 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.

### Starting the capture <a href="#id-41-lanzamiento-de-la-captura" id="id-41-lanzamiento-de-la-captura"></a>

To start screen recording:

```kotlin
val response = SDKController.launch(
    VideoRecordingController(
        VideoRecordingConfigurationData(...)
    )
)

when (response) {
    is SdkResult.Error   -> Napier.d("ERROR - ${response.error.name}")
    is SdkResult.Success -> response.data
}

```

### Stop the capture <a href="#id-42-detener-la-captura" id="id-42-detener-la-captura"></a>

To stop screen recording:

```kotlin
val controller = StopVideoRecordingController()

controller.setOutput {
    Napier.d("APP: VIDEO RECORDING STATE (stop): ${it.name}")
}

SDKController.launch(controller)

```

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

Errors will be returned as a 'VideoRecordingError' object.

Error list:

* VRC\_CANCEL\_BY\_USER: The user has canceled the process
* VRC\_COMPONENT\_LICENSE\_ERROR: The component License is not correct
* 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 required permissions. With `enableAudio=true` it also covers the denial or dismissal of the microphone permission and the rejection of the permission of `MediaProjection`.
* VRC\_SOCKET\_ERROR: Error in the services connection
* VRC\_UNKNOWN\_ERROR: Unknown error
* VRC\_VIDEO\_CALL\_ACTIVE: It cannot be started because there is an active Video Call
* VRC\_VIDEO\_ERROR: Error in video processing
* VRC\_VIDEO\_RECORDING\_ACTIVE: It cannot be started because the Video Recording process is active
* VRC\_FETCH\_DATA\_ERROR: Error in fetching the result

### Reception of the successful result - *data* <a href="#id-62-recepcion-del-resultado-correcto-data" id="id-62-recepcion-del-resultado-correcto-data"></a>

If successful, the field `data` contains an object `VideoRecordingResult`.

* `state`: Recording status. `SHARING` indicates that recording has started and `FINISH` indicates that it has been stopped successfully.

## 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 *VideoRecordingConfigurationData* must be created, which will be the configuration of the component controller.

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

The fields `url`, `apiKey` and `tenantId` 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**

Path to the video socket

#### **apiKey**

ApiKey required to connect to the video socket

#### **tenantId**

Identifier of the tenant that refers to the current client, required to connect to the video service.

#### **enableAudio**

Enables audio capture during screen recording. By default `false`. When reported as `true`, Android requests `RECORD_AUDIO` before the `MediaProjection`; if the user denies or closes the permissions screen, it returns `VRC_PERMISSION_ERROR` and recording does not start.

\ <br>
