Repository navigation
feat(playback): sync playback state across devices - #14825
Open
dylanjeffers wants to merge 1 commit into
Open
dylanjeffers wants to merge 1 commit into
dylanjeffers wants to merge 1 commit into
Conversation
Publishes this device's playback snapshot (queue, index, position, shuffle/repeat, rate) to the API on playback changes and on a heartbeat while playing, and restores the latest snapshot on startup and on focus/foreground when nothing is playing locally. A restored queue is cued up paused; pressing play loads the track at the saved position. Shared saga covers web, desktop and native mobile. Gated behind the playback_state_sync feature flag (off in production). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
This branch has not been deployed
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.
Summary
Client side of cross-device playback sync: play on desktop/web, open the app on your phone (or vice versa) and the same track and queue are cued up, ready to resume where you left off.
Depends on AudiusProject/api#1089 (the
playback-stateendpoints). Everything is behind a newplayback_state_syncfeature flag — off in production, on in development — so this is safe to merge before the API ships. The flag still needs creating in Optimizely.How it works
common/store/playback/snapshot.ts): versioned wire format with queue (hash ids, source/collection/behavior carried through), index, position, playing flag, shuffle (incl. original order so un-shuffle works on the other device), repeat and rate. Anything read from the server is validated and rejected wholesale if malformed.web/src/common/store/playback/syncSagas.ts, shared by web, desktop and native): debounced on playback/queue changes plus a 30s heartbeat while playing. Stable per-install device id in local storage.resumefield on the playback slice. A bareplaywith a pending resume loads the cued track at the saved position; skipping, picking another track, etc. clears it.Not in this PR
Testing
common), publish + restore saga behavior (web).webandmobile; lint clean on changed files.🤖 Generated with Claude Code