Retry transient Kick playback URL fetch failures#27
Conversation
|
fwiw, i had gemini write a userscript earlier that does a similar thing as this pr, but in a userscript, and proxies fetches of https://kick.com/api/v2/channels/<channel>/playback-url to GM_xmlhttpRequest, which is designed to handle cross-origin shenanigans, instead of retrying the fetch. https://gist.github.com/freedg/29636a398505e3f7ff145c1ffb3bc305. I haven't had an issue since installing it this morning. |
|
I tried adding the |
|
So the code in the above branch seems to work, but since it doesn't look like this will be merged, I've made a separate userscript to add the retry functionality at alembicq/kick-embed-playback-fix. |
To be transparent, I've been using GPT-5.5 to debug the "This embed seems to be misconfigured" error that keeps coming up. Eventually it came up with this solution, which seems to work for me. I've been running kickstiny with this code since Friday (2026-06-12) and I haven't had any misconfigured embed errors since then, and I've seen many chatters complaining about getting it since then. The rest of this PR description is generated by GPT-5.5.
Summary
This adds a small, targeted retry wrapper around
fetch()for Kick playback URL requests made by the embedded player.The Kick embed can intermittently replace an otherwise healthy live stream with the fallback message:
I have seen this most often after returning to a backgrounded tab. The stream is still live, and reloading the embed usually recovers it. The failures appear to come from transient network/CORS failures while refetching
https://kick.com/api/v2/channels/<channel>/playback-url.This PR retries that specific playback URL request before the failure reaches Kick's player code.
What Changed
installPlaybackFetchRetry(), which wrapswindow.fetch.GETrequests tohttps://kick.com/api/v2/channels/<channel>/playback-url.408,425,429, and5xx.100msand400ms.document-idletodocument-startso the wrapper is installed before Kick's initial playback request and later focus-triggered refetches.document-starteven ifdocument.headis not available yet.Why This Approach
The failure is intermittent and recoverable. A later request to the same playback URL generally succeeds, so a narrow retry at the fetch boundary prevents the embed from entering its misconfigured fallback state without changing Kickstiny's controls or player behavior.
The wrapper is intentionally scoped to one endpoint and one method. It preserves the original
fetchcall shape for all non-playback requests, and it only retries a bounded number of times.Testing
Automated checks run locally:
npm test npm run build npx prettier --check build.js dev/kickstiny-dummy.user.js package.json src/main.js src/utils/playbackFetchRetry.js test/playbackFetchRetry.test.js git diff --checkManual verification:
Notes For Reviewers
The main tradeoff is wrapping global
fetch, but the wrapper is deliberately conservative: