diff --git a/app.js b/app.js index 1d9f0fb..b54af9d 100644 --- a/app.js +++ b/app.js @@ -1,8 +1,6 @@ navigator.mediaDevices.getUserMedia({ - audio: true, - video: true -}) - .then(function(stream) { + audio: true +}).then((stream) => { const audioContext = new AudioContext(); const analyser = audioContext.createAnalyser(); const microphone = audioContext.createMediaStreamSource(stream); @@ -14,7 +12,7 @@ navigator.mediaDevices.getUserMedia({ microphone.connect(analyser); analyser.connect(scriptProcessor); scriptProcessor.connect(audioContext.destination); - scriptProcessor.onaudioprocess = function() { + scriptProcessor.onaudioprocess = () => { const array = new Uint8Array(analyser.frequencyBinCount); analyser.getByteFrequencyData(array); const arraySum = array.reduce((a, value) => a + value, 0); @@ -23,7 +21,7 @@ navigator.mediaDevices.getUserMedia({ // colorPids(average); }; }) - .catch(function(err) { + .catch((err) => { /* handle the error */ console.error(err); });