-
Notifications
You must be signed in to change notification settings - Fork 142
Open
Description
CldVideoPlayer loads scripts immediately on mount, impacting performance for videos below the fold. , video player has no lazy loading support.
Solution
Add loading="lazy" prop using Intersection Observer to defer script loading until video enters viewport.
Usage
<CldVideoPlayer
src="my-video"
width={1920}
height={1080}
loading="lazy" // New prop (default: "eager")
/>Acceptance Criteria
- Add
loadingprop:"eager"(default) |"lazy" - Use Intersection Observer for viewport detection
- Show placeholder/poster while lazy loading
- No breaking changes (backward compatible)
- Add tests for lazy loading behavior
- Update TypeScript types and documentation
Benefits
~50-200KB savings per lazy-loaded player + improved LCP/TBT
Checklist
- I am willing to raise a PR for this feature
- I have read the Contributing Guidelines
Metadata
Metadata
Assignees
Labels
No labels