Voice: mutedPlayers property

Available since @irtio/client 5.0Browsers

The mutedPlayers read-only property of the Voice interface is the set of the other players on the voice server sending no audio: muted with setMuted(), or with no microphone on.

Value

A ReadonlySet<string> of player IDs, which doesn’t include this player. It’s empty while voice is down.

Description

A player who isn’t on the voice server is in neither mutedPlayers nor speaking. This player’s own mute is voice.muted. The mutedPlayers event, a CustomEvent, fires with the new set in its detail each time it changes.

Examples

Showing a muted icon

A scoreboard row shows a muted icon for a player on voice who isn’t sending audio.

// muted-icon.ts
import type { Voice } from "@irtio/client/voice";

export function voiceIcon(voice: Voice, player: string): string {
  if (!voice.participants.has(player)) return "";
  if (voice.mutedPlayers.has(player)) return "muted";
  return voice.speaking.has(player) ? "speaking" : "listening";
}

See also

Runtime availability

Browsers
mutedPlayers5.0