Skip to content

Add seek support to the controller role - #103

Merged
maximmaxim345 merged 1 commit into
mainfrom
add-controller-seek-support
Jun 16, 2026
Merged

maximmaxim345 merged 1 commit into
mainfrom
add-controller-seek-support

Conversation

@kahrendt

Copy link
Copy Markdown
Contributor

Adds optional seek commands to the controller role. Closes #99.

Changes

client/command controller object:

  • command gains 'seek' and 'seek_relative'
  • position_ms (absolute target, ms) and offset_ms (signed offset, ms)

server/state controller object:

  • supported_commands gains 'seek' and 'seek_relative', advertised independently
  • seek_max_ms — upper bound for absolute seeks; required when 'seek' is offered

Behaviour: seek is ignored if position_ms is outside 0..seek_max_ms; seek_relative is best-effort and clamps to the seekable range.

Notes

  • A server with an unknown seekable range (e.g. live streams) can offer 'seek_relative' without 'seek'.
  • No metadata-role dependency: seek_max_ms bounds absolute seek and relative seek is best-effort, so neither needs the client to know the current position.

@maximmaxim345 maximmaxim345 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Comment thread README.md Resolved
@maximmaxim345
maximmaxim345 merged commit f80ace5 into main Jun 16, 2026
maximmaxim345 added a commit to Sendspin/aiosendspin that referenced this pull request Jun 19, 2026
Implements Sendspin/spec#103.

Adds optional `seek` (absolute `position_ms`) and `seek_relative`
(signed `offset_ms`) controller commands.
For servers, new `ControllerSeekEvent`/`ControllerSeekRelativeEvent`
events carry the request. For clients, `send_group_command` forwards
`position_ms`/`offset_ms`.
@kahrendt
kahrendt deleted the add-controller-seek-support branch June 30, 2026 16:12
maximmaxim345 added a commit to Sendspin/aiosendspin that referenced this pull request Jul 14, 2026
A batch of protocol-conformance and correctness fixes. This PR doesn't
include changes to encryption/authentication, that will follow in a
later PR.

## Changes

- **Adopt client/state `available` boolean.** Replace the client state
enum with the spec's `available` boolean end to end: the SDK sends only
`available`, the server tracks a boolean and notifies roles via
`on_availability_changed`. A legacy `state` enum on the wire normalizes
to `available`, with only `external_source` treated as unavailable so a
client reporting an error is not ejected from its group. Spec:
[#115](Sendspin/spec#115),
[#113](Sendspin/spec#113).
- **Stamp `server_transmitted` on stream lifecycle messages.** Add
`server_transmitted` to `stream/start`, `stream/clear`, and
`stream/end`, stamped at actual send time, matching `server/time`. Spec:
[#106](Sendspin/spec#106).
- **Floor send-ahead at `min_buffer`.** Live streams floor at
`min_buffer + static` instead of extending to `required_lead` (which
added latency a realtime queue cannot recover); buffered streams keep
the `min_buffer` floor instead of dropping to `required_lead + static`.
Spec: [#107](Sendspin/spec#107).
- **Document `seek_relative` clamping** as the application's
responsibility. Spec: [#103](Sendspin/spec#103).
- **Track all unimplemented client roles**, not just spec-support
families (controller/metadata/color and wholly-unknown families), still
excluding `_`-prefixed custom roles. Spec:
[#113](Sendspin/spec#113).
- **Make server reconnect per-goodbye-reason and activity-aware.** Retry
a server-initiated connection only on restart or concurrent_attempt; on
a drop with no goodbye, assume restart when the connection was idle or
carried playback, else treat it as a session end. Spec:
[#113](Sendspin/spec#113),
[#116](Sendspin/spec#116).
- **Default the visualizer pitch feature off** (rides reserved binary
type 21; kept as an opt-in extension). Spec:
[#86](Sendspin/spec#86).
- **Mask the beat downbeat bit** unless the role tracks downbeats. Spec:
[#86](Sendspin/spec#86).
- **Remember visualizer request-format when no stream is active**
instead of starting a stream in response (which the spec forbids).
Mirrors player/artwork. Spec:
[#112](Sendspin/spec#112).
- **Note peak-cadence deviation from spec** with a TODO (peak onset
detection currently runs only at the periodic `rate_max` hop). Spec:
[#86](Sendspin/spec#86).
- **Hoist binary-type sets out of the per-frame dispatch path** (reuse
module-level frozensets instead of rebuilding per binary frame).
- **Reset `_stream_started` after the artwork deactivate stream/end**,
matching the other stream roles.
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.

Seek support

2 participants