youtube-embedded-component
v1.0.8
Published
A React component for embedding YouTube videos.
Downloads
11
Maintainers
Readme
Documentation for Youtube Embedded Component
Introduction
Youtube Embedded Component is a simple project to take a Youtube video and embed it in a way that it can be responsive.
Built following Projectbook specifications:
https://projectbook.code.brettchalupa.com/web-components/responsive-youtube-embed.html
Installation
You can install the component from npm using the following command:
npm install youtube-embedded-component
Usage
Once installed, you can use the component in your React application as follows:
jsx
import YoutubeEmbed from 'youtube-embedded-component';
function App() {
return (
<div className="App">
<h1>Title</h1>
<YoutubeEmbed
id="dQw4w9WgXcQ"
startTime={30}
privacyEnhanced={true}
maxWidth="600px"
width="100%"
/>
</div>
);
}
Props
The component accepts the following props:
Required
id: The YouTube video ID, Full YouTube URL, or YouTube Embed URL.
Optional
startTime: The start time of the video in seconds.
privacyEnhanced: true / false
maxWidth: Control the maximum width of the video container. Default 100%.
width (optional): Set the exact width of the container. Default 100%.
License
This package is open-source and released under the MIT License.
Contact
For questions or support, please email me at [email protected]