@speechkit/speechkit-audio-player
Version:
A web player component that can play audio from https://speechkit.io
42 lines (32 loc) • 939 B
JavaScript
import { template, merge, pick }from 'lodash'
import { bindPropWithElement } from '../../utils'
import PlayerBase from '../PlayerBase'
import ViewTemplate from './view/view.html'
import { MAP_PROP_CS, MAP_PROPS_CS, UI_CONTROLS } from './constants'
//Assets
import podcastButton from '../images/podcast.svg'
import './styles/player.scss'
class MinimalPlayer extends PlayerBase {
constructor(options) {
super(options)
// Instance variables that will be set
UI_CONTROLS.forEach(control => {
this[control] = null
})
}
buildPlayerView(options) {
const compiled = template(ViewTemplate)
const allOptions = merge(options, {
podcastButton
})
return compiled(options)
}
setupUIBindings() {
bindPropWithElement(MAP_PROP_CS, this)
bindPropWithElement(MAP_PROPS_CS, this, true)
}
getCommonUIControls() {
return pick(this, UI_CONTROLS)
}
}
export default MinimalPlayer