Skip to main content
Version: 6.2

Holding a call

The hold/unhold feature allows you to pause or resume media transmission and reception while maintaining the connection.

  • When a user holds a call
    • Media transmission and reception is paused.
    • The peer is notified of the hold state and the user's media status changes through events.
  • When the user unholds a call
    • Media transmission and reception is resumed.
    • The peer is notified of the unhold state and the user's media status changes through events.

The behavior of holding and unholding a call differs depending on the call type. This page describes how you can hold or unhold a call.

Supported call typeMinimum SDK version
1-to-1 call, group call (conference)PlanetKit 3.0
Note

Prior to PlanetKit 5.5, holding/unholding a call did not directly affect the operation of camera. Starting with PlanetKit 5.5, however, the camera is controlled by holding/unholding as follows:

  • When you hold a call, PlanetKit turns off the camera and disables video transmission, making the camera indicator turned off.
  • When you unhold a call, PlanetKit turns on the camera and enables video transmission, making the camera indicator turned on.
Note

Prior to PlanetKit 6.0, holding/unholding a call did not directly affect the operation of microphone. Starting with PlanetKit 6.0, however, the microphone is controlled by holding/unholding as follows:

  • When you hold a call, PlanetKit turns off the microphone and disables audio transmission, making the microphone indicator turned off.
  • When you unhold a call, PlanetKit turns on the microphone and enables audio transmission, making the microphone indicator turned on.

1-to-1 call

To hold or unhold a 1-to-1 call, use hold() or unhold() of PlanetKitCall.

After you call hold() to pause the application's transmission and reception of media streams, the peer should wait for unhold() to be called in order to resume communication. On the peer side, the application lets PlanetKit play a hold tone that was set in the call parameter.

The following diagram shows the flow of holding and unholding in a 1-to-1 call.

1-to-1 call hold sequence diagram

API overview

The following APIs are used for holding and unholding a call in 1-to-1 calls.

MethodDescriptionRelated event callbacks
hold()Starts hold state. You can provide the hold reason.peerDidHold
unhold()Stops hold state.peerDidUnhold

Sample code

The following shows how to implement the feature to hold and unhold a 1-to-1 call.

Holding or unholding a call

let call: PlanetKitCall

... // Obtain the PlanetKitCall instance from the result of makeCall() or verifyCall()

// Hold the call, with optional reason
call.hold(reason: "User requested") { success in
NSLog("hold result: \(success).")
}

// Unhold the call
call.unhold() { success in
NSLog("unhold result: \(success).")
}
extension CallDelegateExample : PlanetKitCallDelegate {
...

func peerDidHold(_ call: PlanetKitCall, reason: String?) {
// This is called after the call is placed on hold.
// Write your own code here.
}

func peerDidUnhold(_ call: PlanetKitCall) {
// This is called after the call is resumed from hold.
// Write your own code here.
}
}

Relationship with other features

Here are some points to consider regarding other media control features.

Enabling and disabling a video call

A client that holds a call (Client 01) cannot request the enabling or disabling of a video call.

However, the peer client (Client 02) can request the enabling or disabling of a video call using the enableVideo() and disableVideo() methods. In 1-to-1 calls, enabling and disabling a video call are always processed simultaneously on both sides. Therefore, when Client 02 requests the enabling or disabling of a video call, both Client 02 and Client 01 will perform enabling or disabling of a video call accordingly. After that, the Client 01, which was previously on hold, will continue to remain on hold.

Screen share

During screen share, if the client of the presenter (the user who is doing screen share) calls hold(), the screen share is stopped and the following events are generated:

  • Presenter: myScreenShareDidStopByHold
  • Peer: peerDidStopScreenShare

Group call

To hold or unhold a group call, use hold() or unhold() of PlanetKitConference.

In group calls, the hold behavior is different from 1-to-1 calls. The key differences are as follows:

  • In 1-to-1 calls, media transmission and reception are paused for both users, but in group calls, only the media transmission and reception of the user who holds the call are paused.
  • There is no concept of hold tone.

The following diagram shows the flow of holding and unholding in a group call.

Group call hold sequence diagram

API overview

The following APIs are used for holding and unholding a call in group calls.

MethodDescriptionRelated event callbacks
hold()Starts hold state. You can provide the hold reason.peersDidHold
unhold()Stops hold state.peersDidUnhold

Sample code

The following shows how to implement the feature to hold and unhold a group call.

Holding or unholding a call

let conference: PlanetKitConference

... // Obtain the PlanetKitConference instance from the result of joinConference()

// Hold the conference, with optional reason
conference.hold(reason: "User requested") { success in
NSLog("hold result: \(success).")
}

// Unhold the conference
conference.unhold() { success in
NSLog("unhold result: \(success).")
}
extension ConferenceDelegateExample : PlanetKitConferenceDelegate {
...

func peersDidHold(_ conference: PlanetKitConference, peerHolds: [PlanetKitConferencePeerHold]) {
// This is called after the conference is placed on hold.
// Write your own code here.
}

func peersDidUnhold(_ conference: PlanetKitConference, peers: [PlanetKitConferencePeer]) {
// This is called after the conference is resumed from hold.
// Write your own code here.
}
}

Relationship with other features

Here are some points to consider regarding other media control features.

Enabling and disabling a video call

A client that holds a call (Client 01) cannot request the enabling or disabling of a video call.

Screen share

During screen share, if the client of the presenter (the user who is doing screen share) calls hold(), the screen share is stopped and the following events are generated:

  • Presenter: myScreenShareDidStopByHold
  • Peers: screenShareDidUpdate of PlanetKitConferenceDelegate, didUpdateScreenShare of PlanetKitPeerControlDelegate (DISABLED state)

For group calls, the scope of the screen share determines the peers who receive the events, as follows:

  • If the screen share is targeted for the main room, all peers in the room receive the events.
  • If the screen share is targeted for a subgroup, only the peers who subscribed to the subgroup receive the events.

APIs related to holding and unholding a call are as follows.

1-to-1 call

Methods

Events

Group call

Methods

Events