From e9de8264e2ccb9d1d1dc1d34f577b20dea6a12fe Mon Sep 17 00:00:00 2001 From: Chubby Granny Chaser Date: Sun, 30 Nov 2025 03:41:41 +0000 Subject: [PATCH] fix: fixing hls videos --- .cursorrules | 13 +++++++++++++ src/renderer/src/hooks/use-hls-video.ts | 3 +-- .../game-details/gallery-slider/video-player.tsx | 6 ++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.cursorrules b/.cursorrules index 23aa8113..fedb8a3a 100644 --- a/.cursorrules +++ b/.cursorrules @@ -28,6 +28,19 @@ - Use async/await instead of promises when possible - Prefer named exports over default exports for utilities and services +## ESLint Issues + +- **Always try to fix ESLint errors properly before disabling rules** +- When encountering ESLint errors, explore these solutions in order: + 1. **Fix the code to comply with the rule** (e.g., add missing required elements, fix accessibility issues) + 2. **Use minimal markup to satisfy the rule** (e.g., add empty `` elements for videos without captions, add `role` attributes) + 3. **Only disable the rule as a last resort** when no reasonable solution exists +- When disabling a rule, always include a comment explaining why it's necessary +- Examples of proper fixes: + - For `jsx-a11y/media-has-caption`: Add `` even if no captions are available + - For `jsx-a11y/alt-text`: Add meaningful alt text or `alt=""` for decorative images + - For accessibility rules: Add appropriate ARIA attributes rather than disabling + ## TypeScript Array Syntax - **Always use `T[]` syntax instead of `Array`** for array types diff --git a/src/renderer/src/hooks/use-hls-video.ts b/src/renderer/src/hooks/use-hls-video.ts index c861d0cf..9de24314 100644 --- a/src/renderer/src/hooks/use-hls-video.ts +++ b/src/renderer/src/hooks/use-hls-video.ts @@ -76,7 +76,7 @@ export function useHlsVideo( logger.warn("Failed to autoplay HLS video:", err); }); } - + return () => { video.src = ""; }; @@ -99,4 +99,3 @@ export function useHlsVideo( return hlsRef.current; } - diff --git a/src/renderer/src/pages/game-details/gallery-slider/video-player.tsx b/src/renderer/src/pages/game-details/gallery-slider/video-player.tsx index 5e84883a..38a01d09 100644 --- a/src/renderer/src/pages/game-details/gallery-slider/video-player.tsx +++ b/src/renderer/src/pages/game-details/gallery-slider/video-player.tsx @@ -46,7 +46,9 @@ export function VideoPlayer({ muted={muted} autoPlay={autoplay} tabIndex={tabIndex} - /> + > + + ); } @@ -62,7 +64,7 @@ export function VideoPlayer({ tabIndex={tabIndex} > {videoSrc && } + ); } -