Video Call Component
0. SDK Mobile baseline requirementsβ
SDK Mobile is a set of libraries (Components) that offer a series of functionalities and services, allowing their integration into a Mobile application in a simple and fully scalable way. Depending on the use case that is required, certain components must be installed. Its high level of modularity allows other new components to be added in the future without affecting those already integrated in the project.
For more information on the base configuration, go to the Getting Started section.
1. Introductionβ
The component discussed in the current document is called VideoCall Component. It is in charge of managing the communication between a user and an agent remotely, through a communication channel. It is mainly oriented to video assistance use cases.
2. Integration of the componentβ
Before integrating this component, it is recommended to read the documentation related to:
Getting Started and follow the instructions in that document.
This section will explain step by step how to integrate the current component into an existing project.
2.1. Dependencies required for integrationβ
To avoid conflicts and compatibility problems, in case you want to install the component in a project containing an old version of the Facephi libraries (Widgets), these must be completely removed before installing the SDKMobile components.
-
Currently FacePhi libraries are distributed remotely through different dependency managers. Mandatory dependencies that must be installed beforehand:
implementation "com.facephi.androidsdk:videocall_component:$sdk_videocall_component_version"
3. Start new operationβ
When you want to perform a specific operation, in order to generate the associated information correctly in the platform, the newOperation command must first be executed.
βΉοΈ This command must have been executed before launch. To learn more about how to start a new operation, it is recommended to consult the Start a new operation documentation, which details and explains what this process consists of.
4. Available controllersβ
Controller | Description |
---|---|
VideoCallController | Videocall main controller |
5. Component configurationβ
To configure the current component, once it has been initialised, a VideoCallConfigurationData object must be created and passed as a parameter to the SDKController when the component is launched.
The following section will show the fields that are part of this class and what each of them is used for.
5.1. Class VideoCallConfigurationDataβ
The fields included in the configuration, normally do not need to be reported as they are filled internally through the licence used.
These fields are usually reported only when the server is OnPremise.
5.1.1. urlβ
Path to the video socket
5.1.2. apiKeyβ
ApiKey needed for connection to the video socket
5.1.3. tenantIdβ
Tenant identifier referring to the current client, required for the connection to the video service.
5.1.4. activateScreenSharingβ
Activate the screen sharing option in the call
5.1.5. timeoutβ
Waiting time for an agent to pick up the call (ms)
6. Component useβ
Once the component has been started and a new operation has been created (section 3), the SDK components can be launched. There are two ways to launch the component:
- [WITH TRACKING] This call allows to launch the functionality of the component normally, but internal events will be tracked to the tracking server:
val result = SDKController.launch(
VideoCallController(VideoCallConfigurationData())
)
when (result) {
is SdkResult.Error -> Napier.d("VideoCall: ERROR - ${result.error.name}")
is SdkResult.Success -> Napier.d("VideoCall: OK - ScreenSharing: ${result.data.sharingScreen}")
}
- [WITHOUT TRACKING] This call allows to launch the functionality of the component normally, but no event will be tracked to the tracking server:
val result = SDKController.launchMethod(
VideoCallController(VideoCallConfigurationData())
)
when (result) {
is SdkResult.Error -> Napier.d("VideoCall: ERROR - ${result.error.name}")
is SdkResult.Success -> Napier.d("VideoCall: OK - ScreenSharing: ${result.data.sharingScreen}")
}
The launch method must be used by default. This method allows tracking to be used if your component is enabled, and will not use it when it is disabled (or the component is not installed).
On the other hand, the launchMethod method covers a special case, in which the integrator has tracking installed and activated, but in a certain flow within the application does not want to track information. In this case, this method is used to prevent this information from being sent to the platform.
7. Receipt of the resultβ
The controllers will return the required information in SdkResult format. More information in the Android Mobile SDK's 6. Result return section.
7.1. Receipt of errorsβ
On the error side, we will have the VideoCallError class.
Error list:
- ACTIVITY_RESULT_MSG_ERROR: The result of the activity is incorrect.
- APPLICATION_CONTEXT_ERROR: Required application context is null
- CANCEL_BY_USER: User has cancelled the process
- CANCEL_LAUNCH: A general cancellation of the SDK has been done.
- COMPONENT_LICENSE_ERROR: The license of the component is not correct
- EMPTY_LICENSE: License String is empty
- FACE_DETECTION_TIMEOUT: No face detected
- FETCH_DATA_ERROR: Error in the result collection
- FLOW_ERROR: Error in the flow process
- INITIALIZATION_ERROR: Initialisation error
- MANAGER_NOT_INITIALIZED: Managers are nil
- NETWORK_CONNECTION: Error in internet connection
- NO_DATA_ERROR: Input data is null
- OPERATION_NOT_CREATED: No operation in progress
- PERMISSION_DENIED: User has denied permissions
- SOCKET_ERROR: Error in the connection of services
- TIMEOUT: Timeout in the process
- VIDEO_ERROR: Error in video processing
- UNKNOWN_ERROR
7.2. Receipt of correct execution - dataβ
On successful execution, it simply reports that everything went well with the SdkResult.Success.
8. Screen sharingβ
The screen sharing functionality can be executed using the VideoCallScreenSharingManager class. With it, it is possible to start and end the screen sharing as well as to collect the states in which it is.
val videoCallScreenSharingManager = VideoCallScreenSharingManager(
SdkApplication(application)
)
videoCallScreenSharingManager.setOutput { state ->
Napier.d("SCREEN SHARING STATE: ${state.name}")
}
The possible states are:
AGENT_HANGUP,
PERMISSION_ERROR,
UNKNOWN_ERROR,
SHARING,
FINISH
Where SHARING indicates that the screen is being recorded and FINISH indicates that the process has finished.
If you want to enable the screen sharing option, the video call driver must be launched with the activateScreenSharing flag of its active configuration. The output of the video call launch will indicate whether the user has requested screen sharing with the sharingScreen flag.
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}")
if (result.data.sharingScreen) {
videoCallScreenSharingManager.startScreenSharingService()
}
}
}
}
To start and end screen sharing in the call:
// START
videoCallScreenSharingManager.startScreenSharingService()
// STOP
videoCallScreenSharingManager.stopScreenSharingService()
9. Customizing the componentβ
Apart from the changes that can be made at SDK level (which are explained in the Getting Started document), this particular component allows the modification of specific texts.
9.1. Textsβ
If you want to modify the SDK texts, you would have to include the following XML file in the client application, and modify the value of each String to the desired one.
<string name="video_call_component_text_waiting_agent_title">Connecting with an assistantβ¦</string>
<string name="video_call_component_local">You</string>
<string name="video_call_component_agent">Agent</string>
<string name="video_call_component_exit">Exit</string>
<string name="video_call_component_text_finish">Video assistance is complete</string>
<string name="video_call_component_accesibility_phone">Phone</string>
<string name="video_call_component_accesibility_switch">Switch camera</string>
<string name="video_call_component_restart">Repeat recording</string>
<string name="video_call_component_timeout_title">Time exceeded</string>
<string name="video_call_component_timeout_desc">An assistant could not be reached.</string>
<string name="video_call_component_internal_error_title">There was a technical problem</string>
<string name="video_call_component_internal_error_desc">An assistant could not be reached.</string>
9.2. Colorsβ
<color name="colorVideoCallActionsBackground">#30333d</color>
<color name="colorVideoCallButtonBackground">#FF526080</color>
9.3. Animationsβ
If you want to modify the animations (lottie) of the SDK you would have to include the animations with the same name in the res/raw/ folder of the application.
video_call_anim_waiting.json
9.4 External custom viewsβ
It is possible to completely modify the component screens while maintaining their functionality and navigation. To do so, the following interfaces must be implemented:
Error diagnosis screen:
interface IVideoCallErrorDiagnosticView {
@Composable
fun Content(
error: VideoCallError,
onRetry: () -> Unit,
onClose: () -> Unit,
)
}
Once the classes that implement the interfaces have been created, the "customViews" parameter can be added at component launch to be used in the SDK.
10. Logsβ
To display the logs of this component on the console, you can use the filter: "VIDEO_CALL:"