Mercurial > hg > ugly-duckling
diff src/app/waveform/waveform.component.ts @ 337:097d93b11445
Remove internal flag for playing and just use the method provided by the audio service. Performance seems to be the same.
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Fri, 19 May 2017 14:28:47 +0100 |
parents | 9f6131d22bec |
children | 46435d5208e9 684619d3fad5 |
line wrap: on
line diff
--- a/src/app/waveform/waveform.component.ts Fri May 19 14:14:33 2017 +0100 +++ b/src/app/waveform/waveform.component.ts Fri May 19 14:28:47 2017 +0100 @@ -145,22 +145,18 @@ } this.seekedSubscription = this.audioService.seeked$.subscribe(() => { - if (!this.isPlaying) { + if (!this.audioService.isPlaying()) { this.animate(); } }); this.playingStateSubscription = this.audioService.playingStateChange$.subscribe( isPlaying => { - this.isPlaying = isPlaying; - if (this.isPlaying) { + if (isPlaying) { this.animate(); } }); } else { - if (this.isPlaying) { - this.isPlaying = false; - } if (this.playingStateSubscription) { this.playingStateSubscription.unsubscribe(); } @@ -197,7 +193,6 @@ private playingStateSubscription: Subscription; private seekedSubscription: Subscription; private onAudioDataSubscription: Subscription; - private isPlaying: boolean; private zoomOnMouseDown: number; private offsetOnMouseDown: number; private hasShot: boolean; @@ -227,7 +222,6 @@ this.timeline = undefined; this.cursorLayer = undefined; this.highlightLayer = undefined; - this.isPlaying = this.audioService.isPlaying(); this.isLoading = true; } @@ -916,7 +910,7 @@ this.timeline.tracks.update(); } - if (this.isPlaying) { + if (this.audioService.isPlaying()) { requestAnimationFrame(updateSeekingCursor); } };