fix(player): stop plyr sprite xhr from crashing the page#2906
Conversation
Plyr's sprite loader throws new Error(xhr.status) from the XHR error listener, outside its own try/catch. Any network-layer failure fetching the icon sprite (offline, ad-block, flaky connection) escapes uncaught as Error: 0 and escalates to the full-page error screen. Disable loadSprite so icons reference the same-origin sprite via <use> instead. Fixes #2387 Fixes #2803 Fixes #2819 Fixes #2879
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a recurring issue where network-layer failures during Plyr's sprite loading process caused unhandled exceptions, leading to full-page error screens for users. By disabling the automatic sprite loading and refining the global error handling logic to ignore third-party player script errors, the application is now more resilient to transient network conditions. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses uncaught network-layer errors thrown by Plyr by setting loadSprite: false in YoutubePlayerProvider.svelte and ignoring errors originating from cdn.plyr.io in ErrorProvider.svelte. The reviewer suggested making the error filtering more robust and environment-independent by also checking for plyr.js in the stack trace, which covers cases where Plyr is self-hosted or loaded from other CDNs.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
|
Overall Grade |
Security Reliability Complexity Hygiene Coverage |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| JavaScript | Jul 14, 2026 6:05p.m. | Review ↗ | |
| Code coverage | Jul 14, 2026 6:05p.m. | Review ↗ |
Code Coverage Summary
| Language | Line Coverage (Overall) |
|---|---|
| Aggregate | 65.5% |
| Javascript | 65.5% |
➟ Additional coverage metrics may have been reported. See full coverage report ↗
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
Sentry wraps XMLHttpRequest and injects an app-origin stack frame, so the hostname-based external-noise filter fails to drop errors thrown from cdn.plyr.io. Treat plyr-originated errors as external noise so a network hiccup in the player never triggers the full-page error screen.
78a1483 to
35e057c
Compare
|
@gemini-code-assist addressed: widened the filter to also match |
|
Thanks for the update, @seferturan. That sounds like a solid improvement to ensure broader coverage for self-hosted or bundled instances of Plyr. The changes look good and address the issue effectively. |
🎶 Notes 🎶
Error: 0fromcdn.plyr.io/3.8.3/plyr.js.new Error(xhr.status)from the XHRerrorlistener, outside its own try/catch. Any network blip (offline, ad-block, flaky connection) escapes uncaught asError: 0..catch()never sees it, it lands in the globalonerrorinErrorProviderinstead.XMLHttpRequestand injects anapp.trakt.tvframe, so the hostname check passes and it escalates to the error screen.loadSprite: falseso icons reference the same-origin sprite via<use>instead of being XHR-fetched. Throwing path never runs.cdn.plyr.ioframes inErrorProvideras a safety net.<use>now instead of inlined sprite. Fine locally, worth a glance on prod.