From 3318b144576b17f4cf03a8888ecd3d29b85ef01f Mon Sep 17 00:00:00 2001 From: Florrie <9948030+towerofnix@users.noreply.github.com> Date: Thu, 4 Jan 2018 08:31:09 -0400 Subject: [PATCH] Don't use mediaStream property ..which is missing on Firefox. Fixes #67. --- src/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 501452f..81d7875 100644 --- a/src/index.js +++ b/src/index.js @@ -263,6 +263,7 @@ class AudioEngine { if (!this.mic && !this.connectingToMic) { this.connectingToMic = true; // prevent multiple connection attempts navigator.mediaDevices.getUserMedia({audio: true}).then(stream => { + this.audioStream = stream; this.mic = this.audioContext.createMediaStreamSource(stream); this.analyser = this.audioContext.createAnalyser(); this.mic.connect(this.analyser); @@ -274,7 +275,7 @@ class AudioEngine { } // If the microphone is set up and active, measure the loudness - if (this.mic && this.mic.mediaStream.active) { + if (this.mic && this.audioStream.active) { this.analyser.getFloatTimeDomainData(this.micDataArray); let sum = 0; // compute the RMS of the sound