You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.0 KiB

  1. import ImmutablePropTypes from 'react-immutable-proptypes';
  2. import PureRenderMixin from 'react-addons-pure-render-mixin';
  3. import IconButton from './icon_button';
  4. const VideoPlayer = React.createClass({
  5. propTypes: {
  6. media: ImmutablePropTypes.map.isRequired
  7. },
  8. getInitialState () {
  9. return {
  10. muted: true
  11. };
  12. },
  13. mixins: [PureRenderMixin],
  14. handleClick () {
  15. this.setState({ muted: !this.state.muted });
  16. },
  17. render () {
  18. return (
  19. <div style={{ cursor: 'default', marginTop: '8px', overflow: 'hidden', width: '196px', height: '110px', boxSizing: 'border-box', background: '#000', position: 'relative' }}>
  20. <div style={{ position: 'absolute', top: '10px', left: '10px', opacity: '0.8' }}><IconButton title='Toggle sound' icon={this.state.muted ? 'volume-up' : 'volume-off'} onClick={this.handleClick} /></div>
  21. <video src={this.props.media.get('url')} autoPlay='true' loop={true} muted={this.state.muted} style={{ width: '100%', height: '100%' }} />
  22. </div>
  23. );
  24. }
  25. });
  26. export default VideoPlayer;