# 特定のユーザーに対して他のユーザーをミュートする

> How to mute other users for a specific player.

ローカルミュートを使用すると、特定のユーザーに対して他のユーザーをミュートできます。[`VivoxParticipant.MutePlayerLocally`](https://docs.unity3d.com/Packages/com.unity.services.vivox@latest/index.html?subfolder=/api/Unity.Services.Vivox.VivoxParticipant.html#Unity_Services_Vivox_VivoxParticipant_MutePlayerLocally) 関数を使用すると、ユーザーにはミュートされたユーザーの声が聞こえなくなりますが、チャンネル内の他のユーザーには引き続きミュートされたユーザーの声が聞こえます。[`VivoxParticipant.UnmutePlayerLocally`](https://docs.unity3d.com/Packages/com.unity.services.vivox@latest/index.html?subfolder=/api/Unity.Services.Vivox.VivoxParticipant.html#Unity_Services_Vivox_VivoxParticipant_UnmutePlayerLocally) を使用すると、ユーザーにミュートされたユーザーの声が再び聞こえるようになります。

例えば、Cynthia、Fernando、Wang がチャンネル内にいるとします。Fernando は Wang の声を聞きたくありません。ローカルミュートを使用すると、Wang の声が Fernando に聞こえなくなるように設定できます。ただし、Cynthia には引き続き Wang の声が聞こえ、Wang には引き続き Cynthia と Fernando の声が聞こえます。

これは VivoxParticipant の関数であるため、各 VivoxParticipant が個別の UI 表示を処理する何らかの方法を用意し、(Chat Channel Sample や [参加者の管理](../channels/participant-events) ページで示されているように) 全員がそれぞれミュートボタンを使えるようにすることをお勧めします。

別の方法として、以下の例では、`VivoxServices.Instance.ActiveChannels` ディクショナリを使用して、特定のチャンネル内の特定の参加者を、参加者の PlayerId とチャンネルの ChannelName を使用して検索し、ミュート/ミュート解除する方法を示しています。

```plaintext
void MutePlayerLocally(string PlayerId, string ChannelName)
{
    VivoxService.Instance.ActiveChannels[ChannelName].Where(participant => participant.PlayerId == PlayerId).First().MutePlayerLocally();
}

void UnmutePlayerLocally(string PlayerId, string ChannelName)
{
    VivoxService.Instance.ActiveChannels[ChannelName].Where(participant => participant.PlayerId == PlayerId).First().UnmutePlayerLocally();
}
```

> **Note:**
>
> ユーザーがどのユーザーをミュートしたかを示すように UI 要素を更新するには、他のユーザーがミュートされたことを確認するイベントを Vivox SDK から受信するまで待機する必要があります。このイベントの処理方法および UI への実装方法の例は、Chat Channel Sample と [参加者の管理](../channels/participant-events) ページにあります。
