view src/app/playback-control/playback-control.component.ts @ 509:041468f553e1 tip master

Merge pull request #57 from LucasThompson/fix/session-stack-max-call-stack Fix accidental recursion in PersistentStack
author Lucas Thompson <LucasThompson@users.noreply.github.com>
date Mon, 27 Nov 2017 11:04:30 +0000
parents 53ea6406d601
children
line wrap: on
line source
import {Component, OnInit} from '@angular/core';
import {AudioPlayerService} from '../services/audio-player/audio-player.service';

@Component({
  selector: 'ugly-playback-control',
  templateUrl: './playback-control.component.html',
  styleUrls: ['./playback-control.component.css']
})
export class PlaybackControlComponent implements OnInit {

  constructor(private audioService: AudioPlayerService) {
  }

  ngOnInit() {}

  emitPlayPause() {
    this.audioService.togglePlaying();
  }

  emitFastForward() {
    this.audioService.seekBy(5); // TODO this should probably be some dynamic amount based on the zoom level ala Sonic Visualiser
  }

  emitFastForwardEnd() {
    this.audioService.seekToEnd();
  }

  emitFastRewind() {
    this.audioService.seekBy(-5);
  }

  emitFastRewindStart() {
    this.audioService.seekToStart();
  }

  emitVolumeChanged(value: number) {
    this.audioService.setVolume(value);
  }


  // TODO seems wrong to be repeating myself
  isPlaying(): boolean {
    return this.audioService.isPlaying();
  }
}