Skip to main content
Version: 1.1

Mute sharing and control

Mute refers to disabling the transmission of audio captured by the microphone. You can mute or unmute local audio and share your application's mute status with peers. You can also request a specific peer or all peers to mute or unmute their audio.

Control and share local audio mute

This section explains how to mute or unmute local audio by call type.

1-to-1 call

To mute or unmute local audio in 1-to-1 calls, use muteMyAudio(). The changes in the mute status of local audio are sent to peers through onPeerMicMuted or onPeerMicUnmuted.

The following diagram shows the flow of muting and unmuting local audio in a 1-to-1 call.

1-to-1 call mute local audio sequence diagram

Related sample code is as follows.

Muting or unmuting local audio

// mute: true for mute, false for unmute
Future<bool> muteMyAudioExample(PlanetKitCall call, bool mute) async {
final bool result = await call.muteMyAudio(mute);
print('muteMyAudio(mute=$mute) result: $result');
return result;
}
final callEventHandler = PlanetKitCallEventHandler(
onPeerMicMuted: (call) => print('peer mic muted'),
onPeerMicUnmuted: (call) => print('peer mic unmuted'),
);

Group call

To mute or unmute local audio in group calls, use muteMyAudio(). The changes in the mute status of local audio are sent to peers through onPeersMicMuted or onPeersMicUnmuted.

The following diagram shows the flow of muting and unmuting local audio in a group call.

Group call mute local audio sequence diagram

Related sample code is as follows.

Muting or unmuting local audio

// mute: true for mute, false for unmute
Future<bool> muteMyAudioExample(PlanetKitConference conference, bool mute) async {
final bool result = await conference.muteMyAudio(mute);
print('muteMyAudio(mute=$mute) result: $result');
return result;
}
final conferenceEventHandler = PlanetKitConferenceEventHandler(
onPeersMicMuted: (conference, peers) =>
print('peers mic muted (${peers.length})'),
onPeersMicUnmuted: (conference, peers) =>
print('peers mic unmuted (${peers.length})'),
);

Request remote audio mute

This section explains how to request muting or unmuting of remote audio by call type.

Note

Whether the peers need to mute or unmute their audio when they get a request is implementation-dependent.

The following examples assume that the peers will mute or unmute their audio according to the request.

1-to-1 call

To request a peer to mute or unmute in 1-to-1 calls, use requestPeerMute(). This request is sent to the peer through onMuteMyAudioRequestedByPeer, and changes in the mute status of remote audio are sent to the local user through onPeerMicMuted or onPeerMicUnmuted.

The following diagram shows the flow of requesting to mute and unmute remote audio in a 1-to-1 call.

1-to-1 call mute remote audio sequence diagram

Related sample code is as follows.

Requesting to mute or unmute remote audio

// mute: true for mute, false for unmute
Future<bool> requestPeerMuteExample(PlanetKitCall call, bool mute) async {
final bool result = await call.requestPeerMute(mute);
print('requestPeerMute(mute=$mute) result: $result');
return result;
}
final callEventHandler = PlanetKitCallEventHandler(
onMyAudioMuteRequestedByPeer: (call, mute) async {
print('my audio mute requested by peer: mute=$mute'),

final bool result = await call.muteMyAudio(mute);
print('muteMyAudio(mute=$mute) result: $result');
},
);

Group call

In group calls, you can request a specific peer or all peers to mute or unmute their audio.

  • To request a specific peer to mute or unmute one's own audio, use requestPeerMute().
  • To request all peers to mute or unmute their audio, use requestPeersMute().

These requests are sent to peers through onMuteMyAudioRequestedByPeer and the changes in the mute status of remote audio are sent to the local user through onPeersMicMuted or onPeersMicUnmuted.

The following diagram shows the flow of requesting to mute and unmute remote audio in a group call.

Group call mute remote audio sequence diagram

Related sample code is as follows.

Requesting to mute or unmute remote audio

// Request mute for single peer
// mute: true for mute, false for unmute
Future<bool> requestPeerMuteExample(PlanetKitConference conference, bool mute, PlanetKitUserId peerId) async {
final bool result = await conference.requestPeerMute(mute, peerId);
print('requestPeerMute(mute=$mute, peerId=$peerId) result: $result');
return result;
}

// Request mute for all peers
// mute: true for mute, false for unmute
Future<bool> requestPeersMuteExample(PlanetKitConference conference, bool mute) async {
final bool result = await conference.requestPeersMute(mute);
print('requestPeersMute(mute=$mute) result: $result');
return result;
}
final conferenceEventHandler = PlanetKitConferenceEventHandler(
onMyAudioMuteRequestedByPeer: (conference, peer, mute) async {
print('my audio mute requested by peer: mute=$mute'),

final bool result = await conference.muteMyAudio(mute);
print('muteMyAudio(mute=$mute) result: $result');
},
);

APIs related to mute sharing and control are as follows.

1-to-1 call

Methods

Events

Group call

Methods

Events