Created
March 6, 2017 18:22
-
-
Save sidhantpanda/f3ab1baae26e7c0cd2aff8cf8c90242c to your computer and use it in GitHub Desktop.
React implementation for Selz/Plyr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { PropTypes } from 'react'; | |
import ReactDOM from 'react-dom'; | |
export default class PlyrComponent extends React.Component { | |
static propTypes = { | |
'options': PropTypes.object, | |
'youtubeKey': PropTypes.string, | |
} | |
componentDidMount() { | |
const { options } = this.props; | |
const plyr = require('plyr'); | |
this.player = plyr.setup(ReactDOM.findDOMNode(this), options)[0]; | |
} | |
render() { | |
require('plyr/dist/plyr.css'); | |
const { youtubeKey } = this.props; | |
return ( | |
<div> | |
<div data-type="youtube" data-video-id={youtubeKey} className="js-plyr plyr"> | |
</div> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Did you ever get this player to work? I am trying and the set up doesn't return anything?