mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-23 05:57:05 +02:00
32 lines
701 B
JavaScript
32 lines
701 B
JavaScript
import React from 'react';
|
|
import Helmet from 'react-helmet';
|
|
import YouTube from 'react-youtube';
|
|
|
|
export default class Player extends React.Component {
|
|
render() {
|
|
const opts = {
|
|
height: '390',
|
|
width: '640',
|
|
playerVars: {
|
|
autoplay: 1,
|
|
},
|
|
};
|
|
|
|
return (
|
|
<div>
|
|
<Helmet>
|
|
<title>My Youtube</title>
|
|
</Helmet>
|
|
<div align="center">
|
|
{/* this is a React-youtube component */}
|
|
<YouTube videoId="d9IxdwEFk1c" opts={opts} onReady={this._onReady} />
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
_onReady(event) {
|
|
// access to player in all event handlers via event.target
|
|
event.target.playVideo();
|
|
}
|
|
}
|