Skip to content

Keep volume and mute across reloads and disconnects - #215

Merged
maximmaxim345 merged 3 commits into
mainfrom
fix/report-and-keep-volume
Oct 28, 2026
Merged

maximmaxim345 merged 3 commits into
mainfrom
fix/report-and-keep-volume

Conversation

@maximmaxim345

Copy link
Copy Markdown
Member

What does this implement/fix?

The player started at volume 100 and unmuted after every reload and every disconnect(), whatever the user or the server had set.

Volume and mute are now saved through storage, like the output delay, and restored when the player is created. SendspinPlayer uses localStorage when no storage is passed, so web apps that never set it now keep a muted player muted after a reload.

With useHardwareVolume, a volume change made on the device only reached the server with the next periodic state update, up to 5 seconds later. The docs now say to call setVolume and setMuted when the device volume changes, which reports it right away.

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

Volume started at 100 and unmuted after every reload and every
disconnect, whatever the user or server had set.
With hardware volume, a change made on the device reached the server
only with the next periodic state update, up to 5 seconds later.

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

No active review issues remain for the SDK volume and mute persistence changes.

No open issues 🎉

What changed in this PR

This PR moves volume and mute persistence into the SDK, preserving both settings across reloads and disconnects. It also documents how hardware-volume integrations can report device changes immediately.

Changes:

  • Add storage-backed volume and mute restoration, and preserve both during disconnect resets.
  • Simplify the sample player to rely on SDK persistence.
  • Update hardware-volume guidance and tests for persistence and disconnect behavior.
File Description
tests/​unit/​state-manager.test.ts Remove obsolete volume and mute reset expectations.
tests/​unit/​scheduler.test.ts Remove the obsolete gain-reset test.
tests/​unit/​core.test.ts Cover persistence, disconnect preservation, and hardware-volume reporting.
tests/​e2e/​sendspin-core.e2e.test.ts Expect volume and mute to survive disconnects.
src/​types.ts Document persisted settings and hardware-volume reporting.
src/​index.ts Clarify hardware-volume behavior in setter comments.
src/​core/​volume-store.ts Add storage helpers for volume and mute.
src/​core/​state-manager.ts Restore and save settings, preserving them during resets.
src/​core/​core.ts Connect the volume store to state management.
src/​audio/​scheduler.ts Stop refreshing gain when stopping playback.
README.md Explain persistence and hardware-volume integration.
public/​app.js Remove redundant sample-level persistence and restoration.
index.html Align the initial volume display with the SDK default.

Review effort: Balanced

@maximmaxim345
maximmaxim345 merged commit be4ff75 into main Oct 28, 2026
3 checks passed
@maximmaxim345
maximmaxim345 deleted the fix/report-and-keep-volume branch October 28, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants