> 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

This component requires iOS 13 or later.

## Introduction

The video call is managed with the ***VideoCall Component***.

This component manages communication between a user and an agent (video assistance). Its main processes are:

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

The [Simplified Launch](https://docs.facephi.com/docs.facephi-en/sdks/sdk-mobile/ios-sdk/inicializacion/lanzamiento-simplificado.md) section describes the steps required for basic SDK integration. This section provides information on launching 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 older version of the Facephi libraries (*Widgets*), these must be completely removed before installing the ***SDKMobile***.

### **CocoaPods**

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

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

* To install the Video Call component, add the following entry to the application's Podfile:

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

### **SPM**

* The required dependencies that must be installed beforehand 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, add it to 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 initialized and a new operation has been created, you can launch the component. You can use any of its controllers to run 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 associated with the component **Video Call** using **`extensionIdentifier`**.

### Steps in the integrating app

1. In Xcode, add a **Broadcast Upload Extension** target to the app project (e.g., *File → New → Target → Broadcast Upload Extension*).
2. Set a **Bundle Identifier** unique to the extension (e.g., `com.organization.app.videocallExtension`).
3. Use that identifier as the **`extensionIdentifier`** when creating **`VideoCallController`** (see the launch example above).
4. In both the target and the extension, you must add a capability of type `App Group`. When you do this, enter the same name for both the target and the extension.
5. In the `Info.plist` file for the extension, change `NSExtensionPrincipalClass` so that its value is `videocallComponent.VideoExtensionHandler`.
6. If installing with CocoaPods, add the extension target to the Podfile and add its dependency on Videocall. If installing with SPM, add the Videocall dependency to the extension target.
7. Enable **`activateScreenSharing`** in **`VideoCallConfigurationData`** when you want to offer screen sharing during the call.

There is a [programming example with this feature 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 **Video Recording**. Starting with **2.8.1** that responsibility is handled by **Video Call**.
{% endhint %}

## Basic Configuration

The basic configuration required does not need any parameters.

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

## Receiving the result <a href="#id-7-recepcion-del-resultado" id="id-7-recepcion-del-resultado"></a>

The controllers return the required information in SdkResult format.

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

For errors, we have the common class *ErrorType*.

* VCL\_CANCEL\_BY\_USER: The user canceled the process
* VCL\_CANCEL\_LAUNCH: The SDK was canceled entirely
* VCL\_COMPONENT\_LICENSE\_ERROR: The component license is invalid
* VCL\_EMPTY\_LICENSE: The license String is empty
* VCL\_FACE\_DETECTION\_TIMEOUT: No face was 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 is null
* VCL\_OPERATION\_NOT\_CREATED: There is no operation in progress
* VCL\_PERMISSION\_DENIED: The user denied the permissions
* VCL\_SOCKET\_ERROR: Error connecting to the services
* VCL\_TIMEOUT: Process timeout
* VCL\_VIDEO\_ERROR: Error processing the video
* VCL\_UNKNOWN\_ERROR: Unknown error
* VCL\_VIDEO\_RECORDING\_ACTIVE: Cannot start because the video recording process is active

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

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

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

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

This section provides additional information about the component.

### Advanced component configuration <a href="#id-51-class-nfcconfigurationdata" id="id-51-class-nfcconfigurationdata"></a>

The fields included in the configuration usually **do not need to be provided** because they are populated internally using the license in use.

**activateScreenSharing**

Enable screen sharing during 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 enabled for errors and when the widget response is OK

## Component customization

In addition to the changes that can be made at the SDK level (which are explained in the document on *SDK Customization*), this particular component also allows its interface to be modified.

### Text

The text can be customized by overriding the values of the following keys in a **Localizable.strings**. Keys with the suffix ***\_alt*** are the strings used in the accessibility labels required for the ***VoiceOver***.

| **Name**                                            | **Value**                              |
| --------------------------------------------------- | -------------------------------------- |
| video\_call\_component\_exit\_alert\_question       | Are you sure you want to end the call? |
| video\_call\_component\_exit\_alert\_finish         | End                                    |
| 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 to an assistant...          |
| video\_call\_component\_close\_button\_alt          | Close                                  |
| video\_call\_component\_back\_button\_alt           | Back                                   |
| video\_call\_component\_timeout\_title              | Time limit exceeded                    |
| video\_call\_component\_timeout\_desc               | Unable to connect to an agent.         |

So, if you want to modify, for example, the text “*End*” for the key `video_call_component_exit_alert_finish` for the language **es**, go to the file **Localizable.strings** in the folder **es.lproj** if it exists (otherwise, create it) and add:

`"video_call_component_exit_alert_finish"="Terminar";`

If a message is not specified in the language file, the default message will be used.

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

Colors are initialized similarly in the colors variable using a dictionary, with the desired UIColor as the value.

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

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

Animations are initialized similarly in the animations variable using a dictionary, with a string containing the name of the desired animation found in xcassets as the value.

```
video_call_anim_waiting
```
