Repository navigation
Reduce playback gaps after disconnects - #84
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to reduce audible playback gaps during transient WebSocket disconnects by allowing already-buffered/decoded audio to continue playing before performing a hard playback reset.
Changes:
- Defer
SendspinPlayer’s disconnect reset until the locally buffered playback runway is exhausted (with a small grace window). - Add
AudioProcessor.measureBufferedPlaybackRunwaySec()to quantify remaining scheduled + queued audio. - Introduce a refill timer in
AudioProcessorto keep scheduling from already-decoded queued audio without relying on new network packets.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/index.ts | Schedules a delayed playback reset on socket close based on buffered runway, and cancels it on reconnect/intentional disconnect. |
| src/audio-processor.ts | Adds buffered-runway measurement and a refill timer to keep scheduling queued decoded audio ahead. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
balloob
pushed a commit
that referenced
this pull request
Apr 13, 2026
Port two upstream bug fixes into the modular Core/Scheduler architecture: - #83 Reduce scheduling horizon on Cast: Add CAST_SCHEDULE_HORIZON_* constants and isCastRuntime parameter to AudioScheduler. Cast receivers now use shorter horizons (1.5s/1s/0.5s) to reduce stuttering. - #84 Reduce playback gaps after disconnects: Add measureBufferedPlaybackRunwaySec() and refill scheduling to AudioScheduler. SendspinPlayer defers playback reset on disconnect until buffered audio is exhausted, using new onConnectionOpen/ onConnectionClose events from Core. https://claude.ai/code/session_018UYYEXUZVuQ2Z4Texa7W6m
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.
Keep locally buffered audio running WebSocket connection drops instead of clearing playback immediately:
SendspinPlayernow defers the hard reset until the buffered runway is exhaustedAudioProcessorkeeps small scheduling horizons from already-decoded audio so queued data continues to play while reconnecting