Skip to content

Commit c9e6a7a

Browse files
committed
fix(player): stop plyr sprite xhr from crashing the page
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
1 parent 26c3d51 commit c9e6a7a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

projects/client/src/lib/features/player/YoutubePlayerProvider.svelte

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
const options: Plyr.Options = {
1616
controls: ["play", "progress", "current-time", "mute", "fullscreen"],
1717
iconUrl: asset("/plyr/plyr.svg"),
18+
/**
19+
* Reference the icon sprite via an external `<use>` instead of letting
20+
* Plyr XHR-fetch and inline it. Plyr's sprite loader throws
21+
* `new Error(xhr.status)` from the XHR `error` listener (uncaught, outside
22+
* its own try/catch), so any network-layer failure surfaces as an
23+
* uncaught `Error: 0` and escalates to the full-page error screen.
24+
*/
25+
loadSprite: false,
1826
autoplay,
1927
fullscreen: {
2028
enabled: true,

0 commit comments

Comments
 (0)