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 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) | PlanetKit 3.0 |
1-to-1 call
To enable or disable a video call in 1-to-1 calls, use the following methods of PlanetKitCall
.
Method | Description | Related event callbacks |
---|---|---|
enableVideo() | Makes a request for enabling a video call. | videoEnabledByPeerAndMyVideoPaused |
disableVideo() | Makes a request for disabling a video call. You can provide a reason for disabling a video call. | videoDisabledByPeer |
Initial video state of the requester
The initialMyVideoState
parameter of enableVideo()
determines the initial video state of the requester. The value of the parameter can be one of the following, which are defined in the PlanetKitInitialMyVideoState
enum:
resume
: The camera is turned on and the video captured by the camera is transmitted.pause
: The camera remains turned off and video is not transmitted.
- The default value of the
initialMyVideoState
parameter isresume
. - If you set the parameter to
pause
, the requester's video is not transmitted. To capture and transmit the requester's video, you must callresumeMyVideo()
ofPlanetKitCall
afterward.
Enabling a video call
When the requester calls enableVideo()
, a video call is enabled with the request receiver's video in a paused state. To start sending the video, the request receiver must call resumeMyVideo()
.
Since PlanetKit 6.0, the function to set the response type (pausing the video or sending the video) in 1-to-1 calls has been deprecated and the request receiver's video becomes paused when a video call is enabled.
For more information on peerVideoDidPause
and peerVideoDidResume
, refer to Video pause event.
Disabling a video call
To stop video streaming during a video call, call disableVideo()
with a disableReason
value.
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. In this case, the call procedure should be as follows:
Group call
To enable or disable a video call in group calls, use the following methods of PlanetKitConference
.
Method | Description | Related event callbacks |
---|---|---|
enableVideo() | Makes a request for enabling a video call. | peersVideoDidUpdate (state= enabled ) |
disableVideo() | Makes a request for disabling a video call. Note: Unlike 1-to-1 calls, disableReason is not required in group calls. | peersVideoDidUpdate (state= disabled ) |
There are three states delivered by peersVideoDidUpdate
: 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
The initialMyVideoState
parameter of enableVideo()
determines the initial video state of the requester. The value of the parameter can be one of the following, which are defined in the PlanetKitInitialMyVideoState
enum:
resume
: The camera is turned on and the video captured by the camera is transmitted.pause
: The camera remains turned off and video is not transmitted.
- The default value of the
initialMyVideoState
parameter isresume
. - If you set the parameter to
pause
, the requester's video is not transmitted. To capture and transmit the requester's video, you must callresumeMyVideo()
ofPlanetKitConference
afterward.
Enabling a video call
After the requester calls enableVideo()
, each of other participants must decide whether to receive the stream or not by calling startVideo()
of PlanetKitPeerControl
.
For more information on how to use PlanetKitPeerControl
, refer to the group video call code example.
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 | API |
---|---|
PlanetKit 4.3 or higher | peersVideoDidUpdate |
PlanetKit 4.0 through 4.2 | evtConfVideoUpdated |
Lower than PlanetKit 4.0 | evtConfUpdated |
Related API
APIs related to enabling and disabling a video call are as follows.
Common
1-to-1 call
Methods
-
withResponseOnEnableVideo()
ofPlanetKitMakeCallSettingBuilder
-
withResponseOnEnableVideo()
ofPlanetKitVerifyCallSettingBuilder
-
enableVideo()
ofPlanetKitCall
-
disableVideo()
ofPlanetKitCall
-
resumeMyVideo()
ofPlanetKitCall
Events
Group call
Methods
-
enableVideo()
ofPlanetKitConference
-
disableVideo()
ofPlanetKitConference
-
resumeMyVideo()
ofPlanetKitConference