< 默认情况下为私有的、更快速、更清洁的 YouTube 嵌入组件,适用于 React 应用程序 />
< 默认情况下为私有的、更快速、更清洁的 YouTube 嵌入组件,适用于 React 应用程序 />
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-embedimport LiteYouTubeEmbed from 'react-lite-youtube-embed';
import 'react-lite-youtube-embed/dist/LiteYouTubeEmbed.css';
export default function App() {
return (
);
}That's it! You now have a performant, private YouTube embed.
Defers loading offscreen thumbnails, reducing bandwidth and improving mobile performance.
Enables JSON-LD VideoObject structured data for Google Rich Results.
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.
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 buildThis package includes:
Verify package authenticity:
npm audit signaturesSee .github/SLSA.md for more details.
MIT © Ibrahim Cesar
See LICENSE for full details.
暂无开放 Issues,或尚未同步最近议题。