husseinelsaadi commited on
Commit
8255e28
·
1 Parent(s): eb3d745
Files changed (1) hide show
  1. backend/templates/interview.html +8 -2
backend/templates/interview.html CHANGED
@@ -761,6 +761,12 @@
761
 
762
  // Create blob from audio chunks
763
  const audioBlob = new Blob(this.audioChunks, { type: 'audio/webm' });
 
 
 
 
 
 
764
  formData.append('audio', audioBlob, 'recording.webm');
765
 
766
  console.log('Created audio blob:', audioBlob.size, 'bytes');
@@ -771,8 +777,8 @@
771
  return;
772
  }
773
 
774
- const formData = new FormData();
775
- formData.append('audio', audioBlob, 'recording.webm');
776
 
777
  console.log('Sending audio for transcription...');
778
  const response = await fetch('/api/transcribe_audio', {
 
761
 
762
  // Create blob from audio chunks
763
  const audioBlob = new Blob(this.audioChunks, { type: 'audio/webm' });
764
+
765
+ // Initialise a new FormData instance AFTER creating the blob
766
+ // and append the audio. Previously a call to `formData.append` was
767
+ // made before the variable was declared, causing a reference
768
+ // error and triggering the generic "Error processing audio" message.
769
+ const formData = new FormData();
770
  formData.append('audio', audioBlob, 'recording.webm');
771
 
772
  console.log('Created audio blob:', audioBlob.size, 'bytes');
 
777
  return;
778
  }
779
 
780
+ // formData has already been created and the audio appended above.
781
+ // Do not recreate or re-append here.
782
 
783
  console.log('Sending audio for transcription...');
784
  const response = await fetch('/api/transcribe_audio', {