view src/app/playback-control/playback-control.component.ts @ 49:92c139e16b51

Disable button whilst extracting (for now) - quick fix to stop multiple process requests being sent (as they aren't queued / no request-response matching is done / process requests are synchronous)
author Lucas Thompson <dev@lucas.im>
date Tue, 06 Dec 2016 11:12:56 +0000
parents 933c64ebcd13
children 16d19c12e42f
line wrap: on
line source
import {Component, OnInit} from '@angular/core';
import {AudioPlayerService} from "../services/audio-player/audio-player.service";
import {FeatureExtractionService} from "../services/feature-extraction/feature-extraction.service";

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

  constructor(private audioService: AudioPlayerService,
              private featureExtractionService: FeatureExtractionService) {
  }

  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();
  }
}