fix: fixing hls videos

This commit is contained in:
Chubby Granny Chaser
2025-11-30 03:41:41 +00:00
parent b135087ffe
commit e9de8264e2
3 changed files with 18 additions and 4 deletions

View File

@@ -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 `<track>` 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 `<track kind="captions" />` 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<T>`** for array types

View File

@@ -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;
}

View File

@@ -46,7 +46,9 @@ export function VideoPlayer({
muted={muted}
autoPlay={autoplay}
tabIndex={tabIndex}
/>
>
<track kind="captions" />
</video>
);
}
@@ -62,7 +64,7 @@ export function VideoPlayer({
tabIndex={tabIndex}
>
{videoSrc && <source src={videoSrc} type={videoType} />}
<track kind="captions" />
</video>
);
}