sound on finishing time

This commit is contained in:
2024-11-16 19:51:16 +01:00
parent 4e3431e7a7
commit a168fa31c0
2 changed files with 8 additions and 2 deletions

View File

@@ -17,12 +17,15 @@ export class FocusPage implements OnInit, OnDestroy {
private timerStarted: number | null = null; private timerStarted: number | null = null;
state: FocusState = FocusState.STOPPED; state: FocusState = FocusState.STOPPED;
private endOfTimerChime: HTMLAudioElement;
pathD: string = 'M100 10 A90 90 0 1 1 0 0'; pathD: string = 'M100 10 A90 90 0 1 1 0 0';
dashOffset = 0; dashOffset = 0;
constructor(private renderer: Renderer2) {} constructor(private renderer: Renderer2) {
this.endOfTimerChime = new Audio('../../../assets/race-start-beeps-125125.mp3');
}
ngOnInit() { ngOnInit() {
this.updateTimeDisplay(this.duration * 60, 0, 1); this.updateTimeDisplay(this.duration * 60, 0, 1);
@@ -55,6 +58,9 @@ export class FocusPage implements OnInit, OnDestroy {
if (progress >= 1) { if (progress >= 1) {
progress = 1; progress = 1;
this.endOfTimerChime.play().catch(error => {
console.error('Error playing audio:', error);
});
clearInterval(this.interval); clearInterval(this.interval);
} }
@@ -96,7 +102,7 @@ export class FocusPage implements OnInit, OnDestroy {
reload() { reload() {
this.state = FocusState.SHORT_BREAK; this.state = FocusState.SHORT_BREAK;
this.startTimer(5); this.startTimer(0.5);
} }
recharge() { recharge() {

Binary file not shown.