Skip to content

fix(desktop): the push-to-talk key held under a mute is heard and shown - #382

Open
Aizen93 wants to merge 1 commit into
developfrom
fix/push-to-talk-key-opens-detection-under-mute
Open

Aizen93 wants to merge 1 commit into
developfrom
fix/push-to-talk-key-opens-detection-under-mute

Conversation

@Aizen93

@Aizen93 Aizen93 commented Nov 28, 2026

Copy link
Copy Markdown
Owner

What was wrong

In push-to-talk mode the key opens the microphone whatever the mute flag says. A mute, or a deafen, also pauses speaking detection, and nothing ended that pause when the key was pressed with the mute still on:

  • In a voice channel the noise gate, which a pause closes, stayed closed. Silence was sent while the person's button showed an open microphone and the others saw the mute lifted.
  • In a direct call the voice was sent, and neither side saw the speaking ring.

A stop resets the pause, so after a rebuild of the audio pipeline, or in a call joined with the mute already on, the key did work: what it did depended on whether the mute had been clicked since the pipeline was built.

What the code does now

  • A push-to-talk key press ends the pause of speaking detection (usePushToTalk), after it has enabled the microphone track. In a voice channel the gate opens for the voice again; in both kinds of call "speaking" is announced and the ring shows, on the person's own avatar in a direct call too.
  • The release is unchanged: the raw track is disabled, the detector hears silence and says "not speaking" by itself, and a voice channel's producer is paused as after any release.
  • The mute flag is the person's own: the key does not clear it.
  • Two places left the microphone open under the mute flag while the key was held. With detection running there, both now close it:
    • A deafen switched on while the key holds the microphone open under the mute flag closes the track, pauses the producer and pauses detection, as a deafen with no mute flag does. Left open, a direct call went on sending the voice, and a voice channel showed a ring for a voice the server no longer forwarded.
    • A voice channel's connection restart under the mute flag closes the raw track, as a socket reconnect does. The new producer starts paused under the flag, here and on the server, so a ring would show for a voice nobody hears; the key pressed again opens the microphone.
  • A person who is deafened and holds the key is heard, in a voice channel as in a direct call (where they already were): the key lifts the mute a deafen implies, not the deafen. While the key is down the others see that person deafened and not muted.

This changes one sentence of #380: the ring on one's own avatar in a direct call no longer stays off while muted with the key held. It lights there, as it now does for the other person.

Key files

  • apps/desktop/src/hooks/usePushToTalk.ts
  • apps/desktop/src/stores/voiceStore.ts (toggleDeaf, and the plaintext branch of a connection restart)
  • apps/desktop/src/__tests__/stores/voicePushToTalkRelease.test.tsx (the second block)

Migrations

None. The server is unchanged.

Tests

  • voicePushToTalkRelease.test.tsx, through the real hook and the real store: the key under the mute flag in a voice channel and in a direct call, the release, a mute and a deafen switched on while the key is held (with and without the flag, the deafen in both kinds of call), a key press with no flag, with no call, and a call that ends with the key held.
  • voiceMicTrackLife.test.ts: a connection restart with the key held, under the mute flag (the raw track closes) and without it (it stays open), and under a moderator's mute (it closes with the flag).
  • audioAnalyser.test.ts: while the page timer decides, the end of a pause lets the next tick open the gain and announce "speaking" again, in a voice channel and in a direct call.
  • DMVoicePanelRenders.test.tsx: the mute flag does not hide the ring while the key is held; a detector still paused shows none.
  • pnpm typecheck, pnpm lint and the desktop unit suite pass on the branch.

To check by hand

In push-to-talk mode, with a second person in the call:

  1. A voice channel: click mute, then hold the key and talk. You are heard, the others see your ring, and nothing more is heard after the release.
  2. A direct call: the same, and both sides see the ring while the key is held.
  3. With the mute off, hold the key and click mute: you are cut at once and the ring goes. (Your own button keeps showing an open microphone until the key comes up; that part is not changed here.) Release and press again: you are heard again.
  4. Click mute, hold the key, then click deafen while still holding: you are cut at once.
  5. Deafen, then hold the key and talk: you are heard, in both kinds of call, and the others see you deafened and not muted while the key is down.

A mute, or a deafen, pauses speaking detection, and nothing ended that
pause when the push-to-talk key was pressed with the mute still on. The
key opens the microphone whatever the mute flag says, so:

- In a voice channel the gate, closed by the pause, stayed closed:
  silence was sent while the button showed an open microphone and the
  others saw the mute lifted.
- In a direct call the voice was sent, and neither side saw the ring.

A stop resets the pause, so after a rebuild of the pipeline, or in a call
joined with the mute already on, the key did work: what it did depended
on whether the mute had been clicked since the pipeline was built.

The key press now ends the pause. The release is unchanged: the raw track
is disabled, the detector hears silence and says "not speaking" by
itself, and a voice channel's producer is paused as after any release.

With detection running under the flag, two places that left the
microphone open under it now close it:

- A deafen switched on while the key holds the microphone open under the
  mute flag closes the track, pauses the producer and pauses detection,
  as a deafen with no mute flag does. Left open, a direct call went on
  sending the voice, and a voice channel showed a ring for a voice the
  server no longer forwarded.
- A voice channel's connection restart under the mute flag closes the raw
  track, as a socket reconnect does: the new producer starts paused under
  the flag, here and on the server, so a ring would show for a voice
  nobody hears. The key pressed again opens it. (A secure channel's
  restart is a new join, which already closed it.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant