Skip to content

Instantly share code, notes, and snippets.

@sidhantpanda
Created March 6, 2017 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sidhantpanda/f3ab1baae26e7c0cd2aff8cf8c90242c to your computer and use it in GitHub Desktop.
Save sidhantpanda/f3ab1baae26e7c0cd2aff8cf8c90242c to your computer and use it in GitHub Desktop.
React implementation for Selz/Plyr
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>
);
}
}
@AndrewStobie
Copy link

Did you ever get this player to work? I am trying and the set up doesn't return anything?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment