Skip to content

Ignore Windows pause commands so they can't stop the office speakers - #110

Merged
RichKelsey merged 1 commit into
mainfrom
fix/ignore-windows-pause
Oct 15, 2026
Merged

RichKelsey merged 1 commit into
mainfrom
fix/ignore-windows-pause

Conversation

@RichKelsey

Copy link
Copy Markdown
Contributor

Problem

#109 tried to tell Teams' automatic pause apart from a real one by checking whether the mic was open. It still pauses: on the first test call after updating to 1.0.48, no SmtcPauseIgnored event was logged, so the pause didn't arrive while the mic was open. The likely cause is Bluetooth headsets, which send pause when they connect, switch into call mode, turn off or are taken off. Windows passes those on exactly like a media-key press, so there's no way to filter them.

Fix

On Windows, pause commands from the OS no longer reach Sonos:

  • Native SMTC addon (main.ts): the pause action is ignored and logged (SmtcPauseIgnored telemetry event).
  • Chromium media session (useMediaSession.ts): the pause handler does nothing on Windows. It's a no-op rather than null so Chromium doesn't apply its own default.

Still works from Windows: play, next, previous. Pausing from the app's player controls and the taskbar thumbnail buttons is unchanged. macOS keeps its existing media-session pause behaviour.

The pause button in the Windows media flyout is still shown but does nothing. Hiding it would need a native addon change.

Removes the now-unused mic-in-use module from #109.

Testing

  • npm run typecheck, npm run test:run and ESLint pass.
  • Not yet tested in a real Teams call or with Bluetooth headphones.

🤖 Generated with Claude Code

The mic-in-use check from #109 didn't stop the pauses: Bluetooth headsets
send pause when they connect, switch to call mode or come off, which
doesn't line up with the mic opening. Windows can't tell those apart from
a deliberate media-key pause, so pause commands from SMTC and Chromium's
media session are now ignored on Windows. Play, next and previous still
work, and pausing from the app and its taskbar buttons is unchanged.

Removes the now-unused mic-in-use module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 70.5% 2144 / 3041
🔵 Statements 67.47% 2458 / 3643
🔵 Functions 61.78% 679 / 1099
🔵 Branches 62.44% 2308 / 3696
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
renderer/src/hooks/useMediaSession.ts 34.93% 49.25% 30.76% 34.78% 38-55, 62-70, 76, 89-94, 100, 106-112, 124-147
Generated in workflow #161 for commit 8bbe212 by the Vitest Coverage Report Action

@RichKelsey
RichKelsey merged commit f472b12 into main Oct 15, 2026
3 checks passed
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