Skip to content

Follow the spec rules for player state and commands - #196

Merged
maximmaxim345 merged 2 commits into
mainfrom
fix/player-state-commands
Oct 26, 2026
Merged

maximmaxim345 merged 2 commits into
mainfrom
fix/player-state-commands

Conversation

@maximmaxim345

Copy link
Copy Markdown
Member

What does this implement/fix?

The player's client/state still used the old static_delay_ms key and only listed set_static_delay, so servers following the current spec couldn't read the player's output delay or change it.
It also sent partial updates, and could send player state before server/activate.

Each client/state now carries the full player object with output_delay_ms, lists volume, mute and set_output_delay as supported commands, and is only sent after the first server/activate and when something changed.
The player handles set_output_delay and ignores commands it doesn't list, and stream/end no longer sends a client/state.

Breaking changes:

  • ClientState player static_delay_ms is renamed to output_delay_ms, and required_lead_time_ms, min_buffer_ms and supported_commands are now required
  • ServerCommand set_static_delay and static_delay_ms are renamed to set_output_delay and output_delay_ms
  • Servers that only send set_static_delay can no longer change the output delay

Related issue or spec PR (if applicable):

Types of changes

  • Bugfix (non-breaking change which fixes an issue): bugfix
  • New feature (non-breaking change which adds functionality): new-feature
  • Enhancement to an existing feature: enhancement
  • Breaking change (changes the public API or the protocol in a way that is not backwards compatible): breaking-change
  • Refactor (no behavior change): refactor
  • Documentation only: documentation
  • Maintenance / chore: maintenance
  • CI / workflow change: ci
  • Dependencies bump: dependencies

@maximmaxim345
maximmaxim345 requested a balanced review from Copilot October 23, 2026 15:22
@github-actions github-actions Bot added the breaking-change Changes the public API or the protocol in a way that is not backwards compatible label Oct 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The ciphertext-mutation test needs a guaranteed outbound frame to avoid timing-dependent failures introduced by state deduplication.

1 open issue
What changed in this PR

This PR aligns the SDK’s player state and command handling with the current Sendspin protocol.

Changes:

  • Send complete player state only after activation and when state changes; stop sending state on stream/end.
  • Replace legacy delay fields and commands with output_delay_ms and set_output_delay, and advertise volume and mute support.
  • Update protocol tests, resolved compliance gaps, and output-delay terminology.
File Description
tests/​unit/​protocol-handler.test.ts Update state, activation, and command assertions.
tests/​unit/​core.test.ts Verify output-delay reporting and persistence.
tests/​helpers/​known-violations.ts Remove resolved player-state compliance gaps.
tests/​e2e/​sendspin-security.e2e.test.ts Enable the exact player-state integration assertion.
src/​types.ts Update protocol types and delay documentation.
src/​index.ts Rename delay terminology in a comment.
src/​core/​static-delay-store.ts Update the persistence description.
src/​core/​protocol-handler.ts Implement full-state deduplication and current commands.
public/​app.js Update a storage-key comment without changing the key.
index.html Update the delay control’s help text.
CLAUDE.md Update configuration terminology.

Review effort: Balanced

Comment thread src/core/protocol-handler.ts Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

Static review identified no unresolved blocking issues in the protocol changes, public types, or updated regression coverage.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@maximmaxim345
maximmaxim345 merged commit 2b8f790 into main Oct 26, 2026
4 checks passed
@maximmaxim345
maximmaxim345 deleted the fix/player-state-commands branch October 26, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Changes the public API or the protocol in a way that is not backwards compatible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants