|
|
|
@ -77,6 +77,8 @@
|
|
|
|
this.running = true;
|
|
|
|
this.running = true;
|
|
|
|
this.intervalID = setInterval(()=>{
|
|
|
|
this.intervalID = setInterval(()=>{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(this.micLevel > -1){
|
|
|
|
|
|
|
|
|
|
|
|
const array = new Uint8Array(this.analyser.frequencyBinCount);
|
|
|
|
const array = new Uint8Array(this.analyser.frequencyBinCount);
|
|
|
|
this.analyser.getByteFrequencyData(array);
|
|
|
|
this.analyser.getByteFrequencyData(array);
|
|
|
|
const arraySum = array.reduce((a, value) => a + value, 0);
|
|
|
|
const arraySum = array.reduce((a, value) => a + value, 0);
|
|
|
|
@ -89,6 +91,8 @@
|
|
|
|
this.micThresholdExceeded = false;
|
|
|
|
this.micThresholdExceeded = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.totalSeconds = getAccumulatedSeconds(Date.now(), this.startTime) - this.secondsToSubtract + this.savedPreviousSeconds;
|
|
|
|
this.totalSeconds = getAccumulatedSeconds(Date.now(), this.startTime) - this.secondsToSubtract + this.savedPreviousSeconds;
|
|
|
|
window.localStorage.setItem('lastTotalSeconds', this.totalSeconds);
|
|
|
|
window.localStorage.setItem('lastTotalSeconds', this.totalSeconds);
|
|
|
|
|
|
|
|
|
|
|
|
@ -112,12 +116,10 @@
|
|
|
|
this.savedPreviousSeconds = this.totalSeconds;
|
|
|
|
this.savedPreviousSeconds = this.totalSeconds;
|
|
|
|
this.secondsToSubtract = 0;
|
|
|
|
this.secondsToSubtract = 0;
|
|
|
|
window.localStorage.setItem('lastTotalSeconds', this.totalSeconds);
|
|
|
|
window.localStorage.setItem('lastTotalSeconds', this.totalSeconds);
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
activateMic(){
|
|
|
|
axios.get(import.meta.env.VITE_PRACTICE_TRACKER_API_URL+'categories').then((response)=>{
|
|
|
|
|
|
|
|
this.categories = response.data
|
|
|
|
if(this.micThreshold > -1){
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
navigator.mediaDevices.getUserMedia({
|
|
|
|
navigator.mediaDevices.getUserMedia({
|
|
|
|
audio: true
|
|
|
|
audio: true
|
|
|
|
@ -141,6 +143,15 @@
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
|
|
|
|
axios.get(import.meta.env.VITE_PRACTICE_TRACKER_API_URL+'categories').then((response)=>{
|
|
|
|
|
|
|
|
this.categories = response.data
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
@ -150,7 +161,8 @@
|
|
|
|
<em>
|
|
|
|
<em>
|
|
|
|
{{formatTime(totalSeconds)}}
|
|
|
|
{{formatTime(totalSeconds)}}
|
|
|
|
</em>
|
|
|
|
</em>
|
|
|
|
Mic Threshold (current level: {{Math.round(micLevel)}}): <input type="number" v-model="micThreshold"/>
|
|
|
|
Mic Threshold (current level: {{Math.round(micLevel)}}):
|
|
|
|
|
|
|
|
<input type="number" @change="activateMic" v-model="micThreshold"/>
|
|
|
|
<button :disabled="running" @click="start">Start</button>
|
|
|
|
<button :disabled="running" @click="start">Start</button>
|
|
|
|
<button :disabled="!running" @click="stop">Stop</button>
|
|
|
|
<button :disabled="!running" @click="stop">Stop</button>
|
|
|
|
<button :disabled="running || totalSeconds === 0" @click="reset">Reset</button>
|
|
|
|
<button :disabled="running || totalSeconds === 0" @click="reset">Reset</button>
|
|
|
|
|