A private by default, faster and cleaner YouTube embed component for React applications
Private, performant YouTube embeds for React. Under 5KB gzipped.
Complete guides, live examples, and API reference
YouTube's standard iframe embed adds over 500KB and makes dozens of network requests before the user even clicks play. This component fixes that:
npm install react-lite-youtube-embed
import LiteYouTubeEmbed from 'react-lite-youtube-embed';
import 'react-lite-youtube-embed/dist/LiteYouTubeEmbed.css';
export default function App() {
return (
<LiteYouTubeEmbed
id="dQw4w9WgXcQ"
title="Rick Astley - Never Gonna Give You Up"
/>
);
}
That's it! You now have a performant, private YouTube embed.
<LiteYouTubeEmbed
id="VIDEO_ID"
title="Video Title"
lazyLoad={true}
/>
Defers loading offscreen thumbnails, reducing bandwidth and improving mobile performance.
<LiteYouTubeEmbed
id="VIDEO_ID"
title="Video Title"
seo={{
name: "Full Video Title",
description: "Video description for search engines",
uploadDate: "2024-01-15T08:00:00Z",
duration: "PT3M33S"
}}
/>
Enables JSON-LD VideoObject structured data for Google Rich Results.
<LiteYouTubeEmbed
id="VIDEO_ID"
title="Video Title"
enableJsApi
onPlay={() => console.log('Video started')}
onPause={() => console.log('Video paused')}
onEnd={() => console.log('Video finished')}
/>
React to player state changes for analytics, auto-advancing playlists, and more.
<LiteYouTubeEmbed
id="VIDEO_ID"
title="Video Title"
poster="maxresdefault"
/>
Use maxresdefault for hero sections and featured content.
📚 Visit the full documentation →
We welcome contributions! See CONTRIBUTING.md for guidelines.
# Install dependencies
npm install
# Run tests
npm test
# Build
npm run build
This package includes:
Verify package authenticity:
npm audit signatures
See .github/SLSA.md for more details.
MIT © Ibrahim Cesar
See LICENSE for full details.
Made with 🧩 in Brazil 🇧🇷