youtbe trailer npm

Solutions on MaxInterview for youtbe trailer npm by the best coders in the world

showing results for - "youtbe trailer npm"
Juan Pablo
19 Jan 2017
1$ npm install react-youtube
2
3//usage
4<YouTube
5  videoId={string}                  // defaults -> null
6  id={string}                       // defaults -> null
7  className={string}                // defaults -> null
8  containerClassName={string}       // defaults -> ''
9  opts={obj}                        // defaults -> {}
10  onReady={func}                    // defaults -> noop
11  onPlay={func}                     // defaults -> noop
12  onPause={func}                    // defaults -> noop
13  onEnd={func}                      // defaults -> noop
14  onError={func}                    // defaults -> noop
15  onStateChange={func}              // defaults -> noop
16  onPlaybackRateChange={func}       // defaults -> noop
17  onPlaybackQualityChange={func}    // defaults -> noop
18/>
19
20//example
21import React from 'react';
22import YouTube from 'react-youtube';
23 
24class Example extends React.Component {
25  render() {
26    const opts = {
27      height: '390',
28      width: '640',
29      playerVars: {
30        // https://developers.google.com/youtube/player_parameters
31        autoplay: 1,
32      },
33    };
34 
35    return <YouTube videoId="2g811Eo7K8U" opts={opts} onReady={this._onReady} />;
36  }
37 
38  _onReady(event) {
39    // access to player in all event handlers via event.target
40    event.target.pauseVideo();
41  }
42}