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

# Video Call - Videocall

## Introduction

The Video Call is managed 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/ios-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.

## Dependencies <a href="#id-21-dependencias-requeridas-para-la-integracion" id="id-21-dependencias-requeridas-para-la-integracion"></a>

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

### **CocoaPods**

* The required dependencies that must have been installed previously (by adding them to the project's Podfile) are:

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

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

```
pod 'FPHISDKVideoCallComponent', '~> $VERSION'
```

### **SPM**

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

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

```

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

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

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

| **Controller**      | **Description**            |
| ------------------- | -------------------------- |
| VideoCallController | Main Video Call controller |

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

```swift
let controller = VideoCallController(
    data: videoCallConfigurationData,
    extensionIdentifier: "com.organization.app.videocallExtension",
    output: { sdkResult in
        // Do whatever with the result
        ...
    },
    viewController: viewController)
SDKController.shared.launch(controller: controller)
```

`extensionIdentifier` must match the **Bundle Identifier** of the **Broadcast Upload Extension** for screen sharing that you add to your app (see [Screen Sharing Extension](#extension-de-compartir-pantalla)).

## Screen Sharing Extension

Starting with version **2.8.1**, the **Broadcast Upload Extension** for screen sharing during the Video Call is configured in the **integrating app** and is associated with the component **Video Call** using **`extensionIdentifier`**.

### Steps in the integrating app

1. In Xcode, add a target **Broadcast Upload Extension** to the app project (e.g. *File → New → Target → Broadcast Upload Extension*).
2. Define a **Bundle Identifier** unique for the extension (e.g. `com.organization.app.videocallExtension`).
3. Use that identifier as **`extensionIdentifier`** when creating **`VideoCallController`** (see the launch example above).
4. An entitlement of type `App Group`. When doing so, the same name must be entered in both the target and the extension.
5. In the `Info.plist` of the extension, you must modify `NSExtensionPrincipalClass` so that its value is `videocallComponent.VideoExtensionHandler`.
6. If installed through Cocoapods, the extension target must be added to the Podfile along with its dependency with VideoCall. If installed with SPM, the VideoCall dependency must be added to the extension target.
7. Enable **`activateScreenSharing`** in **`VideoCallConfigurationData`** when you want to offer screen sharing in the call.

There is an [code example with this functionality built in](https://github.com/facephi/sdk-mobile-ios-samples/tree/master/sdkmobile-demo-videocall-pods) and configured.

{% hint style="info" %}
In versions **2.8.0** and earlier, the broadcast extension could be associated with the Flow of **Video Recording**. Starting with **2.8.1** that responsibility passes to **Video Call**.
{% endhint %}

## Basic configuration

The basic required configuration will not need any parameters.

```swift
static var videoCallConfiguration: VideoCallConfigurationData{
        var configVideoCall = VideoCallConfigurationData()
        return configVideoCall
}
```

## Result reception <a href="#id-7-recepcion-del-resultado" id="id-7-recepcion-del-resultado"></a>

The controllers will return the necessary information in SdkResult format.

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

For the error part, we will have the common class *ErrorType*.

* 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\_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\_DENIED: The user has rejected the permissions
* 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\_RECORDING\_ACTIVE: It cannot be started because the video recording process is active

### Successful execution receipt - *data* <a href="#id-72-recepcion-de-ejecucion-correcta-data" id="id-72-recepcion-de-ejecucion-correcta-data"></a>

On successful execution, it is simply reported that everything went well with SdkResult.Success.

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-51-class-nfcconfigurationdata" id="id-51-class-nfcconfigurationdata"></a>

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

**activateScreenSharing**

Enable the screen sharing option in the call.

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

**vibrationEnabled**

If set to true, vibration is activated on errors and if the response from the Widget is OK

## Component Customization

Besides the changes that can be made at SDK level (which are explained in the document of *SDK Customization*), this specific component allows its interface to be modified.

### Texts

The texts can be customized by overriding the value of the following keys in a **Localizable.strings**. The keys containing the suffix ***\_alt*** are the literals used in the accessibility labels needed for the functionality of ***voice over***.

| **Name**                                            | **Value**                              |
| --------------------------------------------------- | -------------------------------------- |
| video\_call\_component\_exit\_alert\_question       | Are you sure you want to end the call? |
| video\_call\_component\_exit\_alert\_finish         | Finish                                 |
| video\_call\_component\_exit\_alert\_accept         | Accept                                 |
| video\_call\_component\_exit\_alert\_cancel         | Cancel                                 |
| video\_call\_component\_skip                        | SKIP                                   |
| video\_call\_component\_restart                     | RETRY                                  |
| video\_call\_component\_agent                       | Assistant                              |
| video\_call\_component\_text\_waiting\_agent\_title | Connecting with an assistant...        |
| video\_call\_component\_close\_button\_alt          | Close                                  |
| video\_call\_component\_back\_button\_alt           | Back                                   |
| video\_call\_component\_timeout\_title              | Timeout exceeded                       |
| video\_call\_component\_timeout\_desc               | Could not connect with an agent.       |

In this way, if you want to modify, for example, the text “*Finish*” of the key `video_call_component_exit_alert_finish` for the language **is**, you will have to go to the file **Localizable.strings** in the folder **es.lproj** if it exists (if not, it must be created) and there, add:

`"video_call_component_exit_alert_finish"="Terminar";`

If a message is not specified in the language file, it will be filled with the default message.

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

The colors are initialized similarly in the colors variable with a dictionary, having as value any desired UIColor.

```
sdkPrimaryColor
sdkBackgroundPrimaryColor
sdkSecondaryColor
sdkBodyTextColor
sdkTitleTextColor
sdkSuccessColor
sdkErrorColor
sdkNeutralColor
sdkAccentColor
sdkTopIconsColor
sdkBackgroundDisabled
```

### Animations <a href="#id-84-animaciones" id="id-84-animaciones"></a>

The animations to use are initialized similarly in the animations variable with a dictionary, having as value a string with the name of the animation found in xcassets that you want to use.

```
video_call_anim_waiting
```
