GithubHelp home page GithubHelp logo

gaearon / react-youtube Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tjallingt/react-youtube

6.0 2.0 1.0 329 KB

react.js powered YouTube player component

Home Page: http://troybetz.com/react-youtube/

License: MIT License

Makefile 2.16% JavaScript 87.29% CSS 10.54%

react-youtube's Introduction

react-youtube player component

Simple React component acting as a thin layer over the YouTube JS Player API

Features

  • url playback
  • playback event bindings
  • lazy API loading

Installation

$ npm install react-youtube

Usage

<YouTube 
  url={string}         // required
  id={string}          // defaults -> 'react-yt-player'
  autoplay={bool}      // defaults -> false
  onPlayerReady={func} // defaults -> noop
  onVideoReady={func}  // defaults -> noop
  onPlay={func}        // defaults -> noop
  onPause={func}       // defaults -> noop
  onEnd={func}         // defaults -> noop
/> 

Example

var React = require('react');
var YouTube = require('react-youtube');

var Example = React.createClass({
  _onPlay: function() {
    console.log('PLAYING');
  },

  render: function() {
    return (
      <YouTube url={'http://www.youtube.com/watch?v=2g811Eo7K8U'} 
               onPlay={this._onPlay} />
    );
  }
});

Caveat

Programmatic control of the player as outlined in the API docs isn't included.

If decide to take control of it, be aware that the react-youtube uses loadVideoById, cueVideoById, addEventListener and removeEventListener internally.

Using these methods outside the component may cause problems.

License

MIT

react-youtube's People

Contributors

troybetz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

rubythonode

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.