> 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/videollamada.md).

# Video Call - Videocall

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

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

This component is responsible for managing communication between a user and an agent (video assistance). Its main processes are:

* Internal management of cameras, microphone, and permissions.
* Connection with the services.

In the section of [Simplified Launch](/docs.facephi-en/sdks/sdk-mobile/android-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

The component's specific dependency is:

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

***

## Available controllers

| **Controller**          | **Description**                              |
| ----------------------- | -------------------------------------------- |
| VideoCallController     | Main Video Call controller                   |
| StopVideoCallController | Stop the screen sharing and the current call |

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

```kotlin
val response = SDKController.launch(
    VideoCallController(VideoCallConfigurationData(...))
)
when (response) {
    is SdkResult.Error -> Napier.d("ERROR - ${response.error.name}")
    is SdkResult.Success -> response.data
}
```

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

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

The basic configuration needed will not require any parameters:

```kotlin
VideoCallConfigurationData()
```

## Result reception

The launch will return the information in SdkResult format, allowing you to distinguish between a successful launch and an unsuccessful one:

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

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

The errors will be returned as a 'VideoCallError' object.

Error list:

* VCL\_ACTIVITY\_RESULT\_MSG\_ERROR: The activity result is incorrect
* VCL\_APPLICATION\_CONTEXT\_ERROR: The required application context is null
* VCL\_CANCEL\_BY\_USER: The user has cancelled the process
* VCL\_CANCEL\_LAUNCH: A general SDK cancellation has been performed
* VCL\_COMPONENT\_LICENSE\_ERROR: The component License is incorrect
* VCL\_EMPTY\_LICENSE: The license String is empty
* VCL\_FACE\_DETECTION\_TIMEOUT: No face has been detected
* VCL\_FETCH\_DATA\_ERROR: Error fetching the result
* VCL\_FLOW\_ERROR: Error in the flow process
* VCL\_INITIALIZATION\_ERROR: Initialization error
* VCL\_MANAGER\_NOT\_INITIALIZED: The managers are null
* VCL\_NETWORK\_CONNECTION: Internet connection error
* VCL\_NO\_DATA\_ERROR: The input data are null
* VCL\_OPERATION\_NOT\_CREATED: There is no operation in progress
* VCL\_PERMISSION\_ERROR: The user has rejected the permissions
* VCL\_SCREEN\_SHARING\_PERMISSION\_ERROR: The user has rejected the screen sharing permission
* VCL\_SOCKET\_ERROR: Error in the services connection
* VCL\_TIMEOUT: Timeout in the process
* VCL\_VIDEO\_ERROR: Error in video processing
* VCL\_UNKNOWN\_ERROR: Unknown error
* VCL\_VIDEO\_CALL\_ACTIVE: It cannot be started because there is already an active video call
* VCL\_VIDEO\_RECORDING\_ACTIVE: It cannot be started because the video recording process is active

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

In the SdkResult.Success part - *data*, we will have the class *VideoCallResult* which will have a single property.

* `sharingScreen`: Indicates whether the call is still active with screen sharing started.

When the result is Success and the flag *sharingScreen* screen sharing can be activated.

***

## Advanced information <a href="#id-7-informacion-avanzada" id="id-7-informacion-avanzada"></a>

This section expands on the component information.

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

To launch the current component, an object *VideoCallConfigurationData* 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 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`: Path to the video socket.
* `apiKey`: ApiKey required for the connection with the video socket.
* `tenantId`: Tenant identifier referring to the current client, required for the connection with the video service.
* `activateScreenSharing`: Activate the screen sharing option in the call.
* `timeout`: Timeout for an agent to answer the call (ms).

### Share screen <a href="#id-72-compartir-pantalla" id="id-72-compartir-pantalla"></a>

When the user activates the screen sharing functionality, the result will be received in the controller with "sharingScreen = true". This indicates that the call is still in progress.

```kotlin
val result = SDKController.launch(
    VideoCallController(VideoCallConfigurationData(activateScreenSharing = true)))

when (result) {
    is SdkResult.Error -> {
        Napier.d("VideoCall: ERROR - ${result.error.name}")
    }

    is SdkResult.Success -> {
            Napier.d("VideoCall: OK - ScreenSharing: ${result.data.sharingScreen}")
        }
    }

```

To stop the call, the StopVideoCallController controller will be used.

```kotlin
val controller = StopVideoCallController()

controller.setOutput { state ->
    Napier.d { "VIDEOCALL: SCREEN SHARING STATE: ${state.name}" }
}
viewModelScope.launch {
    SDKController.launch(controller)
}
```

The possible states are:

```kotlin
AGENT_HANGUP,
PERMISSION_ERROR,
NETWORK_CONNECTION_ERROR,
UNKNOWN_ERROR,
SHARING,
CANCEL_BY_USER,
FINISH
```

The state that indicates the call is fully finished is FINISH.

***

## 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](/docs.facephi-en/sdks/sdk-mobile/android-sdk/personalizacion.md)), 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 adding an XML resource file in the client application and overriding the default values.

```kotlin

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- Video call -->
    <string name="video_widget_call_component_text_waiting_agent_title">Connecting with an assistant...</string>
    <string name="video_widget_call_component_local">You</string>
    <string name="video_widget_call_component_agent">Assistant</string>
    <string name="video_widget_call_component_exit">Exit</string>
    <string name="video_widget_call_component_text_finish">Video assistance is complete</string>
    <string name="video_widget_call_component_phone_button_alt">Phone</string>
    <string name="video_widget_call_component_switch_button_alt">Switch camera</string>
    <string name="video_widget_call_component_restart">RETRY</string>
    <string name="video_widget_call_component_timeout_title">Time exceeded</string>
    <string name="video_widget_call_component_timeout_desc">Unable to connect with an agent.</string>
    <string name="video_widget_call_component_internal_error_title">There was a technical problem</string>
    <string name="video_widget_call_component_internal_error_desc">An assistant could not be reached.</string>
    <string name="video_widget_call_component_close_button_alt">Close</string>
    <string name="video_widget_call_component_back_button_alt">Back</string>
    <string name="video_widget_call_component_exit_alert_question">Do you want to end the call?</string>
    <string name="video_widget_call_component_exit_alert_finish">End</string>
    <string name="video_widget_call_component_exit_alert_accept">Accept</string>
    <string name="video_widget_call_component_exit_alert_cancel">Cancel</string>
    <string name="video_widget_call_component_skip">SKIP</string>
    <string name="video_widget_call_component_share_button_alt">Share screen</string>
</resources>

```

### Colors <a href="#id-82-colores" id="id-82-colores"></a>

```xml
<color name="colorVideoCallActionsBackground">#30333d</color>
<color name="colorVideoCallButtonBackground">#FF526080</color>
```

### Animations <a href="#id-83-animaciones" id="id-83-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_call_anim_waiting.json
```

### External views <a href="#id-84-vistas-externas" id="id-84-vistas-externas"></a>

It is possible to completely modify the component screens while maintaining their functionality and navigation. To do this, the following interfaces must be implemented:

Error diagnostic screen:

```kts

interface IVideoCallErrorDiagnosticView {
    @Composable
    fun Content(
        error: VideoCallError,
        onRetry: () -> Unit,
        onClose: () -> Unit,
    )
}

```

Once the classes implementing the interfaces have been created, when launching the component the "customViews" parameter can be added so that they are used in the SDK.

\ <br>
