Skip to content

feat: room devices — see what's connected and hand the speaker around - #75

Merged
madeofpendletonwool merged 1 commit into
mainfrom
feat/room-devices
Oct 17, 2026
Merged

madeofpendletonwool merged 1 commit into
mainfrom
feat/room-devices

Conversation

@madeofpendletonwool

Copy link
Copy Markdown
Owner

Why

Only the device itself could become a room's speaker. Once a Syncphony box stopped being the speaker, the only way back was to pick up the TV remote and press "Play the audio here".

What

  • Devices list (GET /rooms/{id}/devices). Shows the room's paired screens, then every signed-in browser with the room open. Browsers report kind (computer/phone) and name on the room socket. A browser that doesn't report a kind is listed as a phone. Everything is kept in memory, so there's no migration. A new devices.updated event fires when a browser opens or closes the room.
  • Make speaker (PUT /rooms/{id}/devices/{deviceId}/speaker). Sends device.command {action: speak} to that one device, which then claims the room itself through the usual PUT /player. A box starts playing on its own. Other screens and computers show the existing tap/OK button if their browser blocks autoplay.
    • Screens: whoever may manage them, with audio on, while online.
    • Browsers: only your own, and never a phone (device_is_phone).
  • Stop (DELETE …/speaker). Sends stop first, then releases the device. The device goes quiet before it sees the room without a speaker, so it doesn't claim the room straight back, which is what used to happen after a remote release.
  • UI
    • A Devices sheet, opened from the room menu and from "Devices in the room" under the speaker panel. It offers Make speaker, Stop, and "Play here" for this browser.
    • The Big screen dialog's Screens list gets "Make it the speaker" / "Stop the speaker" for screens with audio.
  • ADR 0019 documents the design.

Tests

  • Go:
    • devices_test.go covers the list and its per-viewer permissions, joining and leaving, the make-speaker rules, and that the stop command reaches the device before the release.
    • Full go test -race ./... passes, and golangci-lint is clean.
  • Web:
    • devices.test.ts covers device kind detection, row details, and command handler order. Two new tv-audio tests cover a remote speak and a remote stop.
    • All 316 tests pass, and typecheck and lint are clean.

Not tried yet in a real browser or on a box.

A room now lists its paired screens and every signed-in browser with it
open. From any device, the speaker can be sent to a screen (a box starts
by itself) or another of your own computers, or stopped, without walking
over to it. The device claims the room itself when told to, over its
room socket. Phones are never sent the speaker; they still make
themselves the speaker with a tap.

ADR 0019.
@madeofpendletonwool
madeofpendletonwool merged commit f67da86 into main Oct 17, 2026
5 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