/** * Created by jeremydejno on 2/4/17. */ import {IAudioTrack} from './audio-player-interfaces'; import {AudioPlayer} from './audio-player'; import {Component, Input} from '@angular/core'; /** * Renders a play/pause button that optionally displays a loading spinner * * @element audio-track-play * @parents audio-track * @export * @class AudioTrackPlayComponent */ @Component({ selector: 'audio-track-play', template:` ` }) export class AudioTrackPlayComponent { @Input() track: IAudioTrack; constructor(private _audioPlayer: AudioPlayer) {} toggle(event: Event){ if (this.track.isPlaying) { this._audioPlayer.pause(); } else { this._audioPlayer.play(this.track); } } }