summaryrefslogtreecommitdiff
path: root/app/client/common/audioPlayer.component.js
blob: f10a5053d688dcf45657e35ab196ccbed5df2d0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { h, Component } from 'preact'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import * as liveActions from '../live/live.actions'

const audio = document.createElement('audio')

class AudioPlayer extends Component {
  constructor(props){
    super(props)
    this.handleClick = this.handleClick.bind(this)
  }
  handleClick(e){
    this.props.onClick && this.props.onClick()
  }
  render() {
    const { player={} } = this.props
    return (
      <div className='audioPlayer'>
        <span>{this.props.title}</span>
        <button
          onClick={this.handleClick}
        >
          {player.playing ? '>' : 'pause'}
        </button>
      </div>
    )
  }
}

const mapStateToProps = state => ({
  player: state.audioPlayer,
})

const mapDispatchToProps = (dispatch, ownProps) => ({
})

export default connect(mapStateToProps, mapDispatchToProps)(AudioPlayer)