> 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 performed 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 specific component 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 for stopping 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.

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

List of errors:

* VRC\_CANCEL\_BY\_USER: The user has cancelled the process
* VRC\_COMPONENT\_LICENSE\_ERROR: The component license is not valid
* 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 denied the necessary permissions. With `enableAudio=true` it also covers the denial or closing of the microphone permission and the rejection of the permission of `MediaProjection`.
* 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
* VRC\_FETCH\_DATA\_ERROR: Error while collecting the result

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

In case of success, the field `data` contains an object `VideoRecordingResult`.

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

## 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 `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**

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**

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 the recording does not start.

\ <br>
