# HG changeset patch # User Lucas Thompson # Date 1481214202 0 # Node ID 6ece58c968681ed995ef6fdf00a894067b60c017 # Parent 0ecfbef9d942b835c6ed13d7debd4c275c9756e7 Guard against playing when the HTMLMediaElement is not ready. diff -r 0ecfbef9d942 -r 6ece58c96868 src/app/services/audio-player/audio-player.service.ts --- a/src/app/services/audio-player/audio-player.service.ts Thu Dec 08 15:29:18 2016 +0000 +++ b/src/app/services/audio-player/audio-player.service.ts Thu Dec 08 16:23:22 2016 +0000 @@ -47,8 +47,10 @@ } togglePlaying(): void { - this.isPlaying() ? this.audioElement.pause() : this.audioElement.play(); - this.playingStateChange.next(this.isPlaying()); + if (this.audioElement.readyState >= 2) { + this.isPlaying() ? this.audioElement.pause() : this.audioElement.play(); + this.playingStateChange.next(this.isPlaying()); + } } setVolume(value: number): void {