Rate this page:

How to make a video call

Making video calls in Voximplant is quite easy. To do that, you have to set everything up for a Voximplant scenario and an SDK client. Please note that prices for audio-only and video calls are different!

In case you already have a scenario for audio calls and want to enable video sending, follow the link below.

VoxEngine scenario

First, you need to set the video parameter of the callUser method to true, so that the call has video support. And you also need the scheme parameter with the internal information about codecs from the AppEvents.CallAlerting event.

After that, the retrieved scheme should be passed to the Call.answer method to handle calls properly.

Video support for Voximplant scenario

Video support for Voximplant scenario

Instead of easyProcess one can write the following: VoxEngine.forwardCallToUser(null, true);

Initiate a video call from SDKs

Please note

In order to make outbound calls from the SDK, you need to establish a connection with Voximplant Cloud and authorize the user first.

The first parameter is the Voximplant user to whom we make a call. Voximplant user must match the pattern we set when creating a rule in the Voximplant application. This is necessary for the correct call handling and scenario launching.

To create a video call, you should enable sending and receiving video by setting the VideoFlags parameter.

IMPORTANT

Safari browser for iOS requires a user interface for playing video during a call.

Video support for SDK clients

Video support for SDK clients

Special features

  1. If the Client.call method is called when the user is not logged in, the method will return null or an exception.

  2. On android, you need to request camera and microphone permission if it hasn't been received from the user yet. If access is not granted, the ICall.start method will throw an exception with the CallError.MISSING_PERMISSION error. This also applies to react-native, flutter, and unity if they run on android.

Answer a call with video

To receive incoming calls, you have to subscribe to the IncomingCall event.

Please note

To receive incoming calls, the application must be connected to Voximplant Cloud and the user must be authorized. If the application or web page is closed you need to set up push notifications.

Subscribing to IncomingCall

Subscribing to IncomingCall

When the event is triggered, we'll get the Call object representing the incoming call and allowing you to control it. In order to answer the call, use the Call.answer method and set the VideoFlags parameter in CallSettings.

Answering a call

Answering a call

Special features

On android, you need to request camera and microphone permission if it hasn't been received from the user yet. If access is not granted, the ICall.answer method will throw an exception with the CallError.MISSING_PERMISSION error. This also applies to react-native, flutter, and unity if they run on android.

Display local video

To display a local video stream, you need to create a UI element. It will be different for each platform:

Creating a UI element for local video

Creating a UI element for local video

Video stream (local or remote) is presented in SDK as the VideoStream interface. To access the video stream in order to display it, subscribe to the LocalVideoStreamAdded call event. This event will be triggered when the local video stream is created and ready for rendering.

To display the local video stream in the created UI element, you need to:

  • call the VideoStream.addVideoRenderer method – Android SDK/iOS SDK,
  • specify the videoStreamId for the required video element – React Native SDK/Flutter SDK),
  • use MediaRenderer.render (DOMNode) – Web SDK.
Displaying local video

Displaying local video

Special features

When adding a video renderer, one can specify the scale type: SCALE_FIT – the video will be displayed based on the aspect ratio or SCALE_FILL – the video will completely fill the UI element.

Endpoint and remote video

The Endpoint interface represents any remote call party (Web/iOS/Android application, SIP or regular phone, etc.).

Each Endpoint instance has built-in methods for managing video streams. Endpoints have their own events, e.g., to detect starting or terminating of receiving a video from a remote participant. To get the Endpoint object, subscribe to the EndpointAdded call event.

To display the video stream of a remote participant, create a separate UI element in the same way you did for the local video.

Endpoint has its own RemoteViddeoStreamAdded event, which provides access to the video stream of the remote call participant.

You need to subscribe to this event and add the previously created UI element as a video renderer of the video stream received from the event.

Displaying remote video

Displaying remote video

Call connected

The call is considered established when the CallConnected event is triggered. It means that the call has been answered on the remote side.

After the call is established, you can enable/disable video sending, put a call on hold and take it off hold, or enable screen sharing.

To handle this event, subscribe to it:

Subscribing to CallConnected

Subscribing to CallConnected