Repository navigation
Add support to advertise player timing capabilities - #116
Merged
Merged
Conversation
The spec marks both as always required for players; without them a server cannot compute per-player send-ahead. Default to 250ms each, configurable via SendspinCoreConfig and updatable at runtime via setRequiredLeadTimeMs / setMinBufferMs.
There was a problem hiding this comment.
Pull request overview
Adds support for advertising per-player buffer timing requirements (required_lead_time_ms, min_buffer_ms) to the Sendspin server via client/state, with new SDK configuration knobs and runtime setters, plus updates to the sample player UI and documentation.
Changes:
- Extend
client/statepayload and protocol handler to reportrequired_lead_time_msandmin_buffer_ms(with defaults). - Add runtime setters on
SendspinCore/SendspinPlayerto update these values. - Update README and sample player UI to configure and adjust buffer timing.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types.ts | Adds new timing fields to ClientState and new config options to SendspinCoreConfig. |
| src/index.ts | Adds SendspinPlayer runtime setters for timing fields. |
| src/core/protocol-handler.ts | Stores timing values, adds setters, and includes values in client/state. |
| src/core/core.ts | Forwards new config fields into the protocol handler and exposes core-level setters. |
| README.md | Documents new config options and runtime setters. |
| public/app.js | Adds sample UI persistence and runtime application of timing parameters. |
| index.html | Adds inputs/buttons to control the new timing parameters in the sample UI. |
Comments suppressed due to low confidence (1)
public/app.js:618
- The sample player passes requiredLeadTimeMs/minBufferMs into the SendspinPlayer constructor, but those values are currently not forwarded into SendspinCore (so they won't be reported to the server unless runtime setters are invoked). As a workaround (and to keep the sample behavior aligned with the README), apply the runtime setters after connecting.
player = new SendspinPlayer({
playerId: getPlayerId(),
baseUrl: serverUrl,
clientName: "Sendspin Sample Player",
syncDelay: sanitizedSyncDelay,
requiredLeadTimeMs,
minBufferMs,
correctionMode: savedCorrectionMode,
correctionThresholds,
reconnect: {
onReconnecting: (attempt) =>
showToast(`Reconnecting (attempt ${attempt})`, "info"),
onReconnected: () => showToast("Reconnected", "success"),
onExhausted: () => showToast("Reconnect failed", "error"),
},
onStateChange,
});
await player.connect();
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
SendspinPlayer dropped requiredLeadTimeMs/minBufferMs at construction, so the documented options never reached client/state. Forward them and reject non-finite or negative values in the setters and constructor.
maximmaxim345
added a commit
that referenced
this pull request
Jun 4, 2026
…st a real aiosendspin server. (#93) Adds a vitest test suite covering the SDK and an end-to-end run against a real aiosendspin server. No changes to `src/`. ## Unit tests (13 files, `tests/unit/`) clock-source, codec-support, core, decoder, decoder-codecs, output-latency-tracker, protocol-handler, recorrection-monitor, scheduler, state-manager, time-filter, time-sync-manager, websocket-manager. ## E2E (1 file, `tests/e2e/`) `sendspin-core.e2e.test.ts` drives a real aiosendspin Python server through a line-based stdin/stdout control protocol implemented by `tests/helpers/sendspin-server.py`. The Node side spawns and controls the subprocess via `tests/helpers/aiosendspin-server.ts`. ## Stats 234 tests across 14 files. `yarn test` ~32s locally. ## Bugs already caught and fixed Added a couple more tests which were able to flag bugs in this library. Each of them was already fixed in a separate PR before this one so all tests pass: - #116 - #117 - #118 - #119 - #121 - #122 --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Maxim Raznatovski <[email protected]>
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.
Servers need each player's
required_lead_time_msandmin_buffer_msto compute per-player send-ahead since Sendspin/spec#69 got merged.The SDK now makes both of them configurable via
SendspinCoreConfig(default 250ms each, matches Music Assistants internal default).Both can also be updated during runtime with
setRequiredLeadTimeMs/setMinBufferMs, matching the spec which allows clients to update these at any time.The sample player gains inputs for both values, and the README documents the config options and runtime setters.