docusaurus/v2/website/pages/youtube.js
Yangshun Tay 13a21b2374 feat(v2): rewrite docs loading strategy (#1092)
* feat(v2): rewrite docs loading strategy

* Prettify

* Lint

* Allow resolving from library root

* minor changes, refactor

* copyright header
2018-11-07 16:39:47 +08:00

39 lines
903 B
JavaScript

/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable */
import React from 'react';
import Head from '@docusaurus/head';
import YouTube from 'react-youtube';
export default class Player extends React.Component {
render() {
const opts = {
height: '390',
width: '640',
playerVars: {
autoplay: 1,
},
};
return (
<div>
<Head>
<title>My Youtube</title>
</Head>
<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();
}
}