diff --git a/index.html b/index.html index 903eedc..17c2cc1 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@

Female Voice Conversion

- +
Recording...
@@ -28,7 +28,7 @@

Female Voice Conversion

- +
diff --git a/main.js b/main.js index 1a1c6d0..7179722 100644 --- a/main.js +++ b/main.js @@ -20,23 +20,24 @@ const responseAudioDiv = document.getElementById('response-audio'); const uploadInput = document.getElementById('upload-input'); recordButton.addEventListener('click', async () => { - if (recordButton.textContent === 'Record Audio') { - startRecording(); - await new Promise(res => setTimeout(res, 10000)); - stopRecording(); - } else { - stopRecording(); + if (!recordButton.disabled) { + recordButton.disabled = true; + recordButton.style.backgroundColor = 'gray'; + if (recordButton.textContent === 'Record Audio') { + startRecording(); + await new Promise(res => setTimeout(res, 10000)); + stopRecording(); + } else { + stopRecording(); + } + recordButton.disabled = false; + recordButton.style.backgroundColor = ''; } }); function startRecording() { - navigator.mediaDevices.enumerateDevices() - .then(devices => { - const audioDevices = devices.filter(device => device.kind === 'audioinput'); - const restMicrophones = audioDevices.filter(device => device.label.toLowerCase().includes('bottom') || device.label.toLowerCase().includes('rest')); - const constraints = restMicrophones.length > 0 ? { audio: { deviceId: { exact: restMicrophones[0].deviceId } } } : { audio: true }; - - return navigator.mediaDevices.getUserMedia(constraints); + navigator.mediaDevices.getUserMedia({ + audio: true }) .then(function(stream) { mediaRecorder = new MediaRecorder(stream); @@ -100,4 +101,4 @@ uploadInput.addEventListener('change', (event) => { function err() { alert("An Error Occured, Check console") -} +} \ No newline at end of file diff --git a/style.css b/style.css index 07f46da..693f95a 100644 --- a/style.css +++ b/style.css @@ -60,7 +60,6 @@ body { } .audio-player { - width: 100%; max-width: 400px; margin: 0 auto; background: #fff; @@ -121,10 +120,10 @@ body { display: none; } -.audio-player { - width: 100%; -} - footer { color: #B1B2B6; +} + +.butt { + transition: background-color 0.3s ease; } \ No newline at end of file