본문으로 건너뛰기
Version: 5.5

음 소거 상태 공유 및 제어

음 소거란 마이크로 입력된 오디오의 전송을 비활성화하는 것을 말합니다. 로컬 오디오를 음 소거하거나 음 소거 해제하고 애플리케이션의 음 소거 상태를 피어와 공유할 수 있습니다. 또한 특정 피어 또는 모든 피어에게 음 소거하거나 음 소거 해제하도록 요청할 수도 있습니다.

로컬 오디오 음 소거 제어 및 공유

로컬 오디오를 음 소거하거나 음 소거 해제하려면 muteMyAudio()를 사용하세요.

1대1 통화

1대1 통화에서는 로컬 오디오의 음 소거 상태 변경이 evtPeerMicMuted 또는 evtPeerMicUnmuted를 통해 피어에게 전송됩니다.

1대1 통화 로컬 오디오 음 소거 시퀀스 다이어그램

관련된 샘플 코드는 다음과 같습니다.

로컬 오디오 음 소거 또는 음 소거 해제하기

const planetKit = new PlanetKit.Call();

const isMute = true; // true for mute, false for unmute

planetKit.muteMyAudio(isMute)
.then(() => {
console.log(`muteMyAudio(isMute=${isMute})`);
})
.catch((error) => {
console.error(`muteMyAudio(isMute=${isMute}) failed:`, error);
});

피어 측에서 관련 이벤트 처리하기

const onEvtPeerMicMuted = () => {
// This is called when the peer changed their microphone status to be muted.
// Write your own code here.
};

const onEvtPeerMicUnmuted = () => {
// This is called when the peer changed their microphone status to be unmuted.
// Write your own code here.
};

// MakeCallParams for caller, VerifyCallParams for callee
const makeCallParams = {
...
delegate: {
...
evtPeerMicMuted: onEvtPeerMicMuted,
evtPeerMicUnmuted: onEvtPeerMicUnmuted
}
};

// Set the parameter when making or verifying a call

그룹 통화

그룹 통화에서는 로컬 오디오의 음 소거 상태 변경이 evtPeersMicMuted 또는 evtPeersMicUnmuted를 통해 피어에게 전송됩니다.

그룹 통화 로컬 오디오 음 소거 시퀀스 다이어그램

관련된 샘플 코드는 다음과 같습니다.

로컬 오디오 음 소거 또는 음 소거 해제하기

const planetKit = new PlanetKit.Conference();

const isMute = true; // true for mute, false for unmute

planetKit.muteMyAudio(isMute)
.then(() => {
console.log(`muteMyAudio(isMute=${isMute})`);
})
.catch((error) => {
console.error(`muteMyAudio(isMute=${isMute}) failed:`, error);
});

피어 측에서 관련 이벤트 처리하기

const onEvtPeersMicMuted = (peersMicMutedParam) => {
// This is called when one or more peers changed their microphone status to be muted.
// Write your own code here.
};

const onEvtPeersMicUnmuted = (peersMicUnmutedParam) => {
// This is called when one or more peers changed their microphone status to be unmuted.
// Write your own code here.
};

const conferenceParams = {
...
delegate: {
...
evtPeersMicMuted: onEvtPeersMicMuted,
evtPeersMicUnmuted: onEvtPeersMicUnmuted
}
};

// Set the parameter when joining a conference

원격 오디오 음 소거 요청

특정 피어 또는 모든 피어에게 오디오를 음 소거하거나 음 소거 해제하도록 요청할 수 있습니다.

  • 1대1 통화나 그룹 통화에서 특정 피어에게 음 소거 또는 음 소거 해제하도록 요청하려면 requestPeerMute()를 사용하세요.
  • 그룹 통화에서 모든 피어에게 음 소거하거나 음 소거 해제하도록 요청하려면 requestPeersMute()를 사용하세요.

음 소거 요청은 evtMyMuteRequestedByPeer를 통해 피어에게 전달됩니다.

Note

피어가 요청을 받았을 때 오디오를 음 소거하거나 음 소거 해제해야 하는지 여부는 구현에 따라 다릅니다.

다음 예시에서는 피어가 요청에 따라 음 소거하거나 음 소거 해제한다고 가정합니다.

1대1 통화

1대1 통화에서는 원격 오디오의 음 소거 상태 변경이 evtPeerMicMuted 또는 evtPeerMicUnmuted를 통해 로컬 사용자에게 전송됩니다.

1대1 통화 원격 오디오 음 소거 시퀀스 다이어그램

관련된 샘플 코드는 다음과 같습니다.

원격 오디오 음 소거 또는 음 소거 해제 요청하기

const planetKit = new PlanetKit.Call();

const isMute = true; // true for mute, false for unmute

planetKit.requestPeerMute(isMute);

피어 측에서 관련 이벤트 처리하기

const onEvtMyMuteRequestedByPeer = (isMute) => {
// This is called when the peer requests the local user to mute or unmute the microphone.
planetKit.muteMyAudio(isMute)
.then(() => {
console.log(`muteMyAudio(isMute=${isMute})`);
})
.catch((error) => {
console.error(`muteMyAudio(isMute=${isMute}) failed:`, error);
});
};

// MakeCallParams for caller, VerifyCallParams for callee
const makeCallParams = {
...
delegate: {
...
evtMyMuteRequestedByPeer: onEvtMyMuteRequestedByPeer
}
};

// Set the parameter when making or verifying a call

그룹 통화

그룹 통화에서는 원격 오디오의 음 소거 상태 변경이 evtPeersMicMuted 또는 evtPeersMicUnmuted를 통해 로컬 사용자에게 전송됩니다.

그룹 통화 원격 오디오 음 소거 시퀀스 다이어그램

관련된 샘플 코드는 다음과 같습니다.

원격 오디오 음 소거 또는 음 소거 해제 요청하기

const planetKit = new PlanetKit.Conference();

const userId = 'target-user-id'; // peer user ID
const isMute = true; // true for mute, false for unmute

// Request mute for single peer
planetKit.requestPeerMute(userId, isMute);

// Request mute for all peers
planetKit.requestPeersMute(isMute);

피어 측에서 관련 이벤트 처리하기

const onEvtMyMuteRequestedByPeer(peer, isMute) => {
// This is called when the peer requests the local user to mute or unmute the microphone.
planetKit.muteMyAudio(isMute)
.then(() => {
console.log(`muteMyAudio(isMute=${isMute})`);
})
.catch((error) => {
console.error(`muteMyAudio(isMute=${isMute}) failed:`, error);
});
};

const conferenceParams = {
...
delegate: {
...
evtMyMuteRequestedByPeer: onEvtMyMuteRequestedByPeer
}
};

// Set the parameter when joining a conference

관련 API

음 소거 제어 및 상태 공유와 관련된 API는 다음과 같습니다.

1대1 통화

메서드

이벤트

그룹 통화

메서드

이벤트