Fix/playback history sync#780
Open
adam-adrian wants to merge 10 commits into
Open
Conversation
…layback history sync
…egalStateException
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.
Pull Request
Summary
Fix YouTube Music playback history not syncing for third-party clients. The root cause was twofold: (1) player requests lacked valid BotGuard PoToken and signatureTimestamp, causing YouTube to return "decoy" tracking URLs that accept requests but don't record history; (2) the metadata player request gated cookie sending on
dataSyncIdavailability, meaning unauthenticated requests produced invalid tracking URLs. The fix adds a WebView-based BotGuard PoToken generator, passes PoToken + signatureTimestamp to all metadata player requests, and ensures cookies are always sent regardless of login state.Linked Work
Change Type
Affected Surfaces
:app:innertube:betterlyrics:kugou:lrclib:lastfm:simpmusic:paxsenix:unison:canvas:shazamkit:spotifycoreserverfastlane.githubScreenshots / Recordings
Behavior Notes
s.youtube.com/api/stats/playbackendpoint.onRenderProcessGoneis handled gracefully — the app survives WebView renderer OOM kills instead of crashing.Architecture Checklist
Loading,Success,Refreshing,Empty, andErrorwhere this PR introduces or changes screen state.runBlockingis introduced in app execution paths. (BotGuardTokenGenerator.mintTokenis a suspend function.)Compose / Material Checklist
collectAsStateWithLifecycle().@Immutableor@Stable. (No new UI models)keyvalues and explicitcontentType.derivedStateOfwhere appropriate. (No new rapidly changing inputs)stringResource()and duplicated visible strings on the same screen are avoided.WindowInsetscorrectly.Concurrency / Performance Checklist
viewModelScopeor an existing lifecycle-owned scope.Dispatchers.IO.Data / Persistence Checklist
app/schemas. (No schema changes)Playback / Integration Checklist
Localization / Assets Checklist
Privacy / Security Checklist
Verification
Reviewer Focus
BotGuardTokenGenerator.kt— WebView-based PoToken generation. Pay attention to:YTPlayerUtils.kt— Player request changes:setLogin = trueon all metadata requests (previously gated ondataSyncId)poTokenandsignatureTimestamppassed to player requestssessionId = authState.visitorData(always visitorData, not dataSyncId)InnerTube.kt—parameterIfMissing→parameterinregisterPlaybackHistoryScreen.kt— Silent remote history refresh with retry backoffRelease Notes
YouTube Music playback history now syncs correctly when songs are played for 30+ seconds. Previously, songs appeared in local history but never in YouTube Music history.