Fix SABR backoff stalling playback & improve error logging - #2
Merged
Conversation
- src/hooks/json-stringify.ts: rebuild holder chain with spread to bypass YouTube's property locker for isInlinePlaybackNoAd. Direct assignment silently failed against non-writable/non-configurable descriptors, causing the flag to never reach the request and triggering the server-side SABR backoff that stalled playback. - src/playback-error-handler.ts: replace [object Object] log with a formatted string including video ID/title, active player state flags, and human-readable video element error code names. - src/player_api/yt-api.ts: expose title field on VideoData interface.
Copilot
AI
changed the title
[WIP] Fix inline playback no ad flag to prevent silent failures
Fix SABR backoff stalling playback & improve error logging
Jul 2, 2026
henrycity
marked this pull request as ready for review
July 2, 2026 12:43
Copilot stopped work on behalf of
henrycity due to an error
July 2, 2026 12:48
Copilot stopped work on behalf of
henrycity due to an error
July 2, 2026 12:48
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.
YouTube's "locker" script defines
isInlinePlaybackNoAdas non-writable/non-configurable, so direct assignment silently fails — the flag never reaches the request, triggering server-side SABR backoff that stalls playback after ~30 seconds. Error logs were also emitting[object Object]instead of readable output.Changes
src/hooks/json-stringify.ts— bypass property lockerInstead of mutating YouTube's object in place, rebuild the
holder → playbackContext → contentPlaybackContextchain with fresh plain objects via spread.JSON.stringifyonly serializes own enumerable properties, so the spread drops locked descriptors and lets the flag stick.src/playback-error-handler.ts— readable error logsUse
JSON.stringifyon logged objects so the output is inspectable JSON rather than[object Object].handlePlaybackErrornow includesvideoId,title, fullplayerState, andvideoErrorin one structured line.src/player_api/yt-api.tsAdded
titleto theVideoDatainterface to surface it in error logs.