# Voice: participants event

> The participants event of the Voice interface fires when a player joins or leaves the voice server.

The **`participants`** event of the [`Voice`](/docs/client/voice) interface fires when another player joins or leaves the voice server, with the new set of players on it.

## Syntax

```ts
addEventListener("participants", (event) => {})
```

## Event type

A `CustomEvent`. Its `detail` is a `ReadonlySet<string>`: the new [`participants`](/docs/client/voice/participants), the player IDs of the other players on the voice server.

## Description

The event fires only when the set changes. It also fires with an empty set when voice drops, and with the players on it again after voice rejoins, so a listener added once keeps working across reconnects. [`disconnect()`](/docs/client/voice#connection) empties the set too.

## Examples

### Announcing who joins voice

A chat panel posts a line when a player joins or leaves voice.

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

export function announceVoice(voice: Voice, post: (line: string) => void): void {
  let before = new Set(voice.participants);
  voice.addEventListener("participants", ({ detail: now }) => {
    for (const player of now) if (!before.has(player)) post(`${player} joined voice`);
    for (const player of before) if (!now.has(player)) post(`${player} left voice`);
    before = new Set(now);
  });
}
```

When voice drops, every player reads as leaving, and joining again when it rejoins.

## See also

- [`Voice.participants`](/docs/client/voice/participants)
- [Proximity voice](/docs/room/guides/voice#client)
