feat(mobile): add playback speed and quality settings to the player - #2026
Open
Ur-imazing wants to merge 8 commits into
Open
feat(mobile): add playback speed and quality settings to the player#2026Ur-imazing wants to merge 8 commits into
Ur-imazing wants to merge 8 commits into
Conversation
Reconciles this PR's quality-swap resume latch with #2022's error recovery. The shared mock now loads one item per settled swap, which exposed the superseded-item hazard: the latch now consumes only the load of the currently requested source (recoverPlayback's fail-open payload rule), so a queued re-pick cannot land the final item at 0:00. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
The mobile watch player now has viewer-controlled playback speed and stream quality. A gear button beside the AirPlay and Cast buttons opens a YouTube-style two-level sheet; a quality pick reloads the same Mux stream under a resolution constraint and resumes where the viewer was, and a speed pick applies at once — locally, and to the cast receiver while casting.
Session-settled decisions carried from planning: quality switches by reloading a constrained stream URL (user-directed, over a native expo-video patch — keeps delivery over-the-air); tiers map to a 480p cap, a 720p cap, and a 1080p floor (user-directed); speed-only while casting (user-directed); the sheet is component state, not a route (user-approved — a routed sheet cannot present over the fullscreen player); a quality reload holds the frame and never re-arms the opening veil (user-approved).
Design decisions
applyQualityConstraintto the resolved source URL and hands only the adapter the constrained URL. Host bookkeeping stays on raw URLs, and every swap — dub changes included — inherits the active tier.sameStreamSource/isSameMuxAssetcompare by Mux playback id, so raw-vs-constrained URLs still match in the admission fallback.sourceLoadlatch owns seek, rate, and play-state restore, because a seek atreplaceAsyncresolution is silently dropped.revertTier), and one namespaced log line records it. A no-op revert (the viewer already re-picked the revert tier) clears the latch outright instead of re-arming a timer-less one.videoIdmid-playback, so an id-shaped key would falsely reset).resetForre-keys on takeover; session endings (dismissed/abandoned/replaced) reset to defaults. A stored tier applies only when its key matches the current content, so a stale tier can never constrain the next video's first load.setCastPlaybackRatelives in the cast facade (SDK imports stay undersrc/lib/cast/); the sheet's pick while casting is fire-and-forget with a logged failure, andMediaLoadRequest.playbackRatecarries the session speed so a starting session inherits it.file://) and non-Mux streams hide the quality row (supportsQualityConstraintshares the parser withapplyQualityConstraint, so the menu and the effect cannot disagree). The gear renders only where the chrome threads its callback, so the autostart veil's button row never shows it.New concepts
Mux playback modifiers. Mux honors playback-behavior parameters directly on the public HLS URL:
stream.mux.com/<id>.m3u8?max_resolution=720pcaps the renditions the manifest offers, andmin_resolution=1080pfloors them; the stream still adapts inside the allowed band. This is why quality control needed no player API and ships over-the-air: the "setting" is a URL, and switching quality is an ordinary source swap. The trade-off is a visible reload on change (a native track-selection patch would switch seamlessly, but costs a two-platform patch on every SDK upgrade). Do not use modifiers on signed Mux URLs — there they must be JWT claims, not query params; current production streams are unsigned.Testing
2478 tests green (162 suites), typecheck and eslint clean. Each unit landed proof-first (red observed before implementation), including a guard-falsification pair proving the new constraint comparison in the swap admission is load-bearing. Guard suites (player ownership, cast import boundary, Android compositing, suppression) extended, not bypassed. The change is OTA-shippable: no native module, config plugin, or
app.jsonchange.Code review:
ce-code-review(full roster + in-process adversarial; the cross-model pass did not run — the cursor-agent CLI was unauthenticated in its detached context, and no content egressed). Verdict "Ready with fixes"; all three actionable findings were applied here (the resume latch now takes the same cast and foreground vetoes as every siblingplay()path; two edge-path tests pin the cross-asset invalidation and the replaced pause-skip; a no-op revert clears the latch). A fourth, P1-rated finding (a settings de-key cascade on replacement) was refuted by the independent validation pass — the interleaving is unreachable becausereconcileSessionends the old session synchronously inside the request-store commit — and verified empirically.Known residuals (informational)
replacedreset's safety rests on that synchronous in-commit ordering; it is load-bearing and implicit.PlaybackHost.tsxgrew 1243 to 1456 lines; extracting auseQualityTierResumehook is the structural follow-up.error_count(a failed reload is a real viewer-visible error; left as a deliberate telemetry choice).replaceAsyncon the dying player during the exit animation (accepted).Per-itemResolved in the merge withsourceLoadmultiplicity on rapid re-picks was only checkable on a device.main: fix(mobile): recover wedged Android playback and correct picture-in-picture resume #2022's realistic mock exposed it, and the latch now consumes only the load of the currently requested source (recoverPlayback's fail-open payload rule), pinned by the U2 suite.Outstanding device verification (owner: Urim)
birth-of-jesus: quality change resumes within ±2s at the selected speed (include one rapid re-pick), speed survives a mini-player round trip, gear present in portrait and fullscreen, sheet variants (cast / offline / non-Mux), and the dev-launch timing comparison for the page-load convention.Post-Deploy Monitoring & Validation
player_settings.quality_swap_released(release_reason=timeout|load_error) — a spike means constrained URLs are failing on real assets;cast.command_failedwithcast_command=set_playback_rate.video.qoeerror_count/rebuffer_countdistributions andvideo.resume_failedshould stay flat.quality_swap_releasednear zero; QoE unchanged.eas update:rollbackon the channel removes the feature — no schema or native surface.Work Loop
ce:plandonece:workdonece:reviewdonece:compounddoneNotes
docs/plans/2026-08-25-1454-feat-mobile-player-video-settings-plan.md(left uncommitted in the worktree by request-scope rules; say the word and it ships in a follow-up commit).ce-code-reviewrun20260825-195258-f3a1.