UNPKG

@speechkit/speechkit-audio-player

Version:

A web player component that can play audio from https://speechkit.io

45 lines (33 loc) 980 B
import { template, merge, pick } from 'lodash' import { bindPropWithElement } from '../../utils' import PlayerBase from '../PlayerBase' import ViewTemplate from './view/view.html' import { UI_CONTROLS, MAP_PROP_CS, MAP_PROPS_CS } from './constants' //Assets import podcastButton from '../images/podcast.svg' import './styles/player.scss' import './styles/player-desktop.scss' class EmbeddedPlayer 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 EmbeddedPlayer