diff options
| author | ilotterytea <iltsu@alright.party> | 2024-06-16 13:35:36 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-06-16 13:35:36 +0500 |
| commit | 6014ce1bcffa14111dbb00f5b143510d753dc5a1 (patch) | |
| tree | 670717884dcc5d0e4ce67323ad4bee281bbda049 | |
| parent | 1257782012bc5a1f7e5d2b8e3025543b2899d499 (diff) | |
fix: handle "volumeHtml is null"
| -rw-r--r-- | scripts/microphone.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/microphone.js b/scripts/microphone.js index ebf648f..5f58245 100644 --- a/scripts/microphone.js +++ b/scripts/microphone.js @@ -30,7 +30,9 @@ if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { const decibels = 20 * Math.log10(volume / 255); - volumeHtml.innerText = `${decibels.toFixed(2)} dB`; + if (volumeHtml) { + volumeHtml.innerText = `${decibels.toFixed(2)} dB`; + } const muted = localStorage.getItem("muted_img"); const speak = localStorage.getItem("speak_img"); |
