Enabling a video call from an audio call
You can switch to a video call in the middle of an audio call ("enable a video call") or switch back to an audio call during a video call ("disable a video call").
The process of making a request for enabling a video call and how peers respond to the request can vary depending on the call type. This page describes how to enable or disable a video call based on the call type.
Supported call type | Minimum SDK version |
---|---|
1-to-1 call, group call (conference) | WebPlanetKit 3.1 |
1-to-1 call
To enable or disable a video call in 1-to-1 calls, use the following methods of Call
.
Method | Description | Related event callbacks |
---|---|---|
enableVideo() | Makes a request for enabling a video call. | evtVideoEnabledByPeer |
disableVideo() | Makes a request for disabling a video call. | evtVideoDisabledByPeer |
Initial video state of the requester
You can set the initial video state by adding a boolean type cameraOn
as an argument to EnableVideoOptions
of enableVideo()
. The initial video state is set as follows depending on the value of cameraOn
:
- If
cameraOn
istrue
, the camera is turned on and the video captured by the camera is transmitted. - If
cameraOn
isfalse
, the camera remains turned off and video is not transmitted.
- The default value of
cameraOn
inEnableVideoOptions
istrue
. - If you set
cameraOn
tofalse
, the local user's video is not transmitted. To capture and transmit the local user's video, you must callresumeMyVideo()
afterward. - In versions prior to WebPlanetKit 5.2, the
cameraOn
feature was provided under the namevideoEnabled
.
Response types
In 1-to-1 calls, the type of user's response when a peer makes a request for enabling a video call can be set during the call setup process.
Response types are defined in RESPONSE_ENABLE_VIDEO
as follows:
PAUSE
: Pauses the user's video when a peer makes a request for enabling a video callSEND
: Sends the user's video when a peer makes a request for enabling a video call
You can set the response type as follows:
- On the caller side, set the response type with
responseOnEnableVideo
ofMakeCallParams
. - On the callee side, set the response type with
responseOnEnableVideo
ofVerifyCallParams
.
Enabling a video call
The video call requester always sends their video stream, but two scenarios are available on the receiver side. The scenario is selected by the value of the response type.
- Scenario 1: Manually respond with video streaming
- The response type of the receiver is
PAUSE
. - In this scenario, a video call is started in a paused status.
The receiver of the video call request (Client 02) can choose when to send their video stream.
- For more information on
evtPeerVideoPaused
andevtPeerVideoResumed
, refer to Video pause event.
- The response type of the receiver is
- Scenario 2: Automatically respond with video streaming
- The response type of the receiver is
SEND
. - The receiver of the video call request (Client 02) sends their stream when the request arrives.
- The response type of the receiver is
It is recommended to select the receiver's scenario and set it up in advance. In other words, set the response type value to a constant such as PAUSE
or SEND
.
Disabling a video call
To stop video streaming during a video call, call disableVideo()
.
Unlike native PlanetKit, WebPlanetKit does not support passing disableReason
when calling disableVideo()
in 1-to-1 calls.
Flow example for the decline case
If the receiver of the enableVideo()
request does not wish to participate in a video call, the user can decline the video call. It is assumed that the response type is PAUSE
. In this case, the call procedure should be as follows:
Camera open failure case
If a client receives the evtVideoEnabledByPeer
event but fails to open the camera, the client must call resumeMyVideo()
after successfully reopening its camera device.
Group call
To enable or disable a video call in group calls, use the following methods of Conference
.
Method | Description | Related event callbacks |
---|---|---|
enableVideo() | Makes a request for enabling a video call. | evtPeersVideoUpdated (state= ENABLED ) |
disableVideo() | Makes a request for disabling a video call. | evtPeersVideoUpdated (state= DISABLED ) |
There are three states delivered by evtPeersVideoUpdated
: ENABLED
, DISABLED
, and PAUSED
.
If the state is PAUSED
, you must take necessary actions by referring to pauseReason
. For more information, refer to Video pause event.
Initial video state of the requester
You can set the initial video state by adding a boolean type cameraOn
as an argument to EnableVideoOptions
of enableVideo()
. The initial video state is set as follows depending on the value of cameraOn
:
- If
cameraOn
istrue
, the camera is turned on and the video captured by the camera is transmitted. - If
cameraOn
isfalse
, the camera remains turned off and video is not transmitted.
- The default value of
cameraOn
inEnableVideoOptions
istrue
. - If you set
cameraOn
tofalse
, the local user's video is not transmitted. To capture and transmit the local user's video, you must callresumeMyVideo()
afterward. - In versions prior to WebPlanetKit 5.2, the
cameraOn
feature was provided under the namevideoEnabled
.
Enabling a video call
When calling enableVideo()
, the video call requester always sends their own camera stream. Each of other participants must decide whether to receive the stream or not by calling requestPeerVideo()
.
Disabling a video call
To stop video streaming during a group video call, call disableVideo()
.
Interface change
The following changes have been made to the interface of event related to enabling a video call in group calls.
SDK version | Group call |
---|---|
WebPlanetKit 5.0 or higher | evtPeersVideoUpdated |
WebPlanetKit 4.0 through 4.2 | evtConfVideoUpdated |
Related API
APIs related to enabling and disabling a video call are as follows.
1-to-1 call
Enums
Methods
responseOnEnableVideo
ofMakeCallParams
responseOnEnableVideo
ofVerifyCallParams
-
enableVideo()
ofCall
-
disableVideo()
ofCall
-
resumeMyVideo()
ofCall