keep microphone always on when running Snap! locally

otherwise users need to re-allow microphone usage every time the block is eveluated again later
pull/89/head
jmoenig 2019-03-06 17:06:49 +01:00
rodzic ea25dad812
commit 63a0f343a6
2 zmienionych plików z 3 dodań i 1 usunięć

Wyświetl plik

@ -52,6 +52,7 @@
* AudioComp lib: support Safari
* removed "loudness / microphone" block from AudioComp lib (turned into primitive)
* new "microphone" reporter in Sensing for getting volume, signals and frequencies
* Objects: keep microphone always on when running Snap! locally
### 2019-03-05
* GUI: added "globe" icon to language menu item

Wyświetl plik

@ -8885,6 +8885,7 @@ function Microphone() {
this.isReady = false;
// idling control:
this.isAutoStop = (location.protocol !== 'file:');
this.lastTime = Date.now();
}
@ -8971,7 +8972,7 @@ Microphone.prototype.stepAudio = function (event) {
freqBufLength = this.analyser.frequencyBinCount,
dataArray = new Uint8Array(freqBufLength);
if ((Date.now() - this.lastTime) > 5000) {
if (this.isAutoStop && ((Date.now() - this.lastTime) > 5000)) {
this.stop();
return;
}