> 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 steps required for the SDK's basic integration are detailed. This section adds the information for launching this component.

## Dependency

The specific component dependency is:

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

***

## Available controllers

| **Controller**          | **Description**                          |
| ----------------------- | ---------------------------------------- |
| VideoCallController     | Main video call controller               |
| StopVideoCallController | Stop screen sharing and the ongoing 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 must be created *VideoCallConfigurationData* which will be the configuration of the component controller.

The basic configuration required will not need any parameters:

```kotlin
VideoCallConfigurationData()
```

## Receiving the result

The launch will return the information in SdkResult format. It will be possible 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.

List of errors:

* 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 canceled the process
* VCL\_CANCEL\_LAUNCH: A general cancellation of the SDK has been made
* VCL\_COMPONENT\_LICENSE\_ERROR: The component license is not correct
* VCL\_EMPTY\_LICENSE: The license String is empty
* VCL\_FACE\_DETECTION\_TIMEOUT: No face detected
* VCL\_FETCH\_DATA\_ERROR: Error while collecting 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: Error in the internet connection
* VCL\_NO\_DATA\_ERROR: The input data is null
* VCL\_OPERATION\_NOT\_CREATED: There is no operation in progress
* VCL\_PERMISSION\_ERROR: The user has denied the permissions
* VCL\_SCREEN\_SHARING\_PERMISSION\_ERROR: The user has denied permission to share the screen
* 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

### Receiving 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 remains active with screen sharing started.

When the result is Success and the flag *sharingScreen* is active, screen sharing can be enabled.

***

## 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 must be created *VideoCallConfigurationData* 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 that refers to the current client, required for the connection with the video service.
* `activateScreenSharing`: Enable the screen sharing option in the call.
* `timeout`: Timeout for an agent to pick up the call (ms).

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

When the user enables 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 complete end of the call is FINISH.

***

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

Apart from the changes that can be made at the SDK level (which are explained in the document on [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 should include the animations with the same name in the app'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 that implement the interfaces have been created, the component launch can include the "customViews" parameter so they are used in the SDK.

\ <br>
