mirror of
https://github.com/scratchfoundation/scratch-audio.git
synced 2024-12-22 14:02:29 -05:00
Merge pull request #70 from towerofnix/fix-firefox-loudness
Don't use mediaStream property, which is missing on Firefox
This commit is contained in:
commit
84fdf5c76a
1 changed files with 2 additions and 1 deletions
|
@ -271,6 +271,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);
|
||||
|
@ -282,7 +283,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
|
||||
|
|
Loading…
Reference in a new issue