Repository navigation
feat: room devices — see what's connected and hand the speaker around - #75
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
GET /rooms/{id}/devices). Shows the room's paired screens, then every signed-in browser with the room open. Browsers reportkind(computer/phone) andnameon 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 newdevices.updatedevent fires when a browser opens or closes the room.PUT /rooms/{id}/devices/{deviceId}/speaker). Sendsdevice.command {action: speak}to that one device, which then claims the room itself through the usualPUT /player. A box starts playing on its own. Other screens and computers show the existing tap/OK button if their browser blocks autoplay.device_is_phone).DELETE …/speaker). Sendsstopfirst, 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.Tests
devices_test.gocovers 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.go test -race ./...passes, andgolangci-lintis clean.devices.test.tscovers device kind detection, row details, and command handler order. Two newtv-audiotests cover a remote speak and a remote stop.Not tried yet in a real browser or on a box.