Initial audio state
You can set the initial audio state of the local user, which is applied when starting a 1-to-1 call or joining a group call.
| Supported call type | Minimum SDK version |
|---|---|
| 1-to-1 call, group call (conference) | PlanetKit 7.1 |
Overview
The PlanetKitInitialMyAudioState enum defines the following values for the initial audio state:
unmuted: The microphone is activated and audio captured by the microphone is transmitted.muted: The microphone is not activated and audio is not transmitted.
- The default value of the APIs described below is
unmuted. - If you set the initial audio state to
muted, the local user's microphone is not activated at the start of the call and audio is not transmitted to peers. To transmit audio, you must callmuteMyAudio()withfalseafterward. - Starting with
mutedprevents the microphone indicator from appearing at call start, since the microphone device is not activated until unmuted.
When CallKit is integrated (PlanetKitCallKitType set to user or planetkit), the microphone indicator is controlled by CallKit. When starting with .muted, the mute state is synchronized with CallKit after connection, which suppresses the indicator. The indicator may briefly appear on before synchronization completes. Once synchronization is complete, the indicator will reflect the mute state correctly.
Setting the initial audio state
Depending on the call type, the API used to set the initial audio state is as follows.
1-to-1 call
- Caller side: Use
withInitialMyAudioStateKey()ofPlanetKitMakeCallSettingBuilderwhen making a call. - Callee side: Set the
initialMyAudioStateparameter ofacceptCall()when accepting a call.
For a code example of setting the initial audio state in 1-to-1 calls, see 1-to-1 audio call and 1-to-1 video call.
Group call
Use withInitialMyAudioStateKey() of PlanetKitJoinConferenceSettingBuilder when joining a group call.
For a code example of setting the initial audio state in group calls, see Group audio call and Group video call.
Related API
APIs related to initial audio state setting are as follows.
Common
1-to-1 call
-
withInitialMyAudioStateKey(_:)ofPlanetKitMakeCallSettingBuilder -
acceptCall(startMessage:useResponderPreparation:recordOnCloud:initialMyVideoState:initialMyAudioState:)