Skip to content

Commit

Permalink
Move audioContext.resume() on user button callback.
Browse files Browse the repository at this point in the history
  • Loading branch information
sonph committed Apr 12, 2020
1 parent 87b22ba commit 6191e0c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/js/metronome.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class Metronome {
/** @type {!audio.Audio} */
this.audio = audio;
this.audioContext = this.audio.getAudioContext();
this.audioContext.resume();

this.viz = viz;

Expand Down Expand Up @@ -128,6 +127,9 @@ class Metronome {
/** Starts the metronome. */
start() {
if (!this.isPlaying) {
// Must resume audio context after a user gesture on the page.
// https://goo.gl/7K7W
this.audioContext.resume();
this.isPlaying = true;
this.current16thNote = 0;
this.uiData.curMeasure = 1;
Expand Down

0 comments on commit 6191e0c

Please sign in to comment.