React component to embed Youtube video on web page (v1.2.1
).
Simply install and import component like below code:
yarn add youtube-embed-video
import React from 'react';
import ReactDOM from 'react-dom';
import YoutubeEmbedVideo from 'youtube-embed-video';
ReactDOM.render(<YoutubeEmbedVideo videoId="RnDC9MXSqCY" suggestions={false} />, document.getElementById('app'));
Above code will load a Youtube video from LEGO® Red Can Break It Down.
Props are same as Youtube options for embedding a video.
Youtube video ID parameter, it's RnDC9MXSqCY
in this Youtube link. Required
.
Make an embedded video play automatically. Default: false
Show suggested videos when the video finishes. Default: true
Show player controls. Default: true
Show video title and player actions. Default: true
Enable privacy-enhanced mode. Default: false
Player width in px. Default: 560
Player height in px. Default: 315
Pre-defined video sizes same as Youtube options. size
will override width
and height
values. Available size values are small
, medium
, large
, and largest
.
- Run
yarn start
fromexamples
folder - Visit
http://localhost:8080
Predefined video sizes- Delay load video
Copyright © 2019 Tien Do ([email protected]).
MIT License.