Skip to content

Add per-player delay configuration#52

Merged
maximmaxim345 merged 8 commits intomainfrom
feat/delay-config
Apr 9, 2026
Merged

Add per-player delay configuration#52
maximmaxim345 merged 8 commits intomainfrom
feat/delay-config

Conversation

@maximmaxim345
Copy link
Copy Markdown
Member

@maximmaxim345 maximmaxim345 commented Mar 17, 2026

Implements per-player delay configuration from Sendspin spec PR #67.

The sender page gets a delay input (0-5000ms, default 330) that persists to localStorage and sends updates to the receiver via Cast custom messages. The receiver passes the delay to sendspin-js as syncDelay (sign-negated at the boundary).

When the server changes the delay via set_static_delay, the receiver forwards the new value back to the sender page through onDelayCommand, keeping the slider and localStorage in sync.

@maximmaxim345 maximmaxim345 requested a review from Copilot March 17, 2026 15:25
@maximmaxim345 maximmaxim345 added the new-feature Request or implement a new feature label Mar 17, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds per-player delay configuration to the Cast sender/receiver flow so the sender UI can set a delay value and the receiver forwards it into SendspinPlayer (with sign inversion at the boundary), plus forwards server-driven delay updates back to the sender.

Changes:

  • Sender page: add a delay control (0–5000ms, default 330), persist to localStorage, and send updates to the receiver via custom messages.
  • Receiver: apply syncDelay (negated) when constructing/updating SendspinPlayer, and forward server-driven delay changes back to the sender via onDelayCommand.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
src/js/main.ts Applies syncDelay updates (negated) and forwards delay updates back to sender via onDelayCommand.
src/index.html Adds/persists delay input and sends/receives delay config messages to keep UI in sync.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/js/main.ts Outdated
Comment thread src/js/main.ts Outdated
Comment thread src/js/main.ts Outdated
Comment thread src/index.html Outdated
Comment thread src/index.html
Comment thread src/js/main.ts Outdated
… flip

sendspin-js now uses positive = play earlier (matching the protocol),
so the receiver no longer needs to negate at the boundary.
maximmaxim345 added a commit to maximmaxim345/cast that referenced this pull request Mar 30, 2026
Squash merge of feat/delay-config
@maximmaxim345 maximmaxim345 marked this pull request as ready for review April 9, 2026 10:12
@maximmaxim345 maximmaxim345 requested a review from Copilot April 9, 2026 10:12
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements per-player/static delay configuration across the Cast sender page and receiver, including persistence and bidirectional sync of delay updates, and updates the Sendspin JS SDK dependency to support delay commands.

Changes:

  • Add sender-side delay control (0–5000ms, default 330), persist it to localStorage, and send updates to the receiver via Cast custom messages.
  • Add receiver handling to forward server-issued delay changes back to the sender via onDelayCommand.
  • Bump @sendspin/sendspin-js to 3.0.0 and update docs/lockfile accordingly.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/index.html Adds delay input + persistence + sender↔receiver message handling for delay updates.
src/js/main.ts Hooks onDelayCommand to forward receiver/server delay changes back to sender.
README.md Updates protocol documentation for new syncDelay semantics/range.
package.json Updates @sendspin/sendspin-js dependency to 3.0.0.
yarn.lock Lockfile updates for dependency bump and registry/resolution changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/js/main.ts
Comment on lines +534 to +541
onDelayCommand: (delayMs: number) => {
providedSyncDelay = delayMs;
if (castContext) {
castContext.sendCustomMessage(CAST_NAMESPACE, undefined, {
type: "config",
syncDelay: delayMs,
});
}
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

PR description mentions the receiver passes the delay to sendspin-js with a sign negation at the boundary, but here delayMs is forwarded to the sender and stored as-is. Please reconcile the sign convention between (a) UI/README (“positive = play earlier”), (b) values coming from onDelayCommand, and (c) what sendspin-js expects, so the sender slider doesn’t display the opposite of the actual playback adjustment.

Copilot uses AI. Check for mistakes.
Comment thread src/index.html
Comment thread src/index.html
Comment thread src/index.html
@maximmaxim345 maximmaxim345 merged commit 7c7a9d0 into main Apr 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature Request or implement a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants