Spaces:
Running
Running
Update index.js
Browse files
index.js
CHANGED
|
@@ -301,15 +301,18 @@ async function initMedia() {
|
|
| 301 |
};
|
| 302 |
mediaRecorder.onstop = () => {
|
| 303 |
// We process the audio here, and free the previous one, if any
|
|
|
|
| 304 |
const blob = new Blob(audioChunks, {type: 'audio/webm'});
|
|
|
|
| 305 |
if (audioUrl) window.URL.revokeObjectURL(audioUrl);
|
| 306 |
audioUrl = window.URL.createObjectURL(blob);
|
| 307 |
-
|
| 308 |
// HACK FOR TESTING
|
| 309 |
const audioElement = new Audio();
|
| 310 |
audioElement.src = audioUrl;
|
| 311 |
audioElement.play();
|
| 312 |
// HACK
|
|
|
|
| 313 |
sendQuery({audioSource: audioUrl});
|
| 314 |
};
|
| 315 |
} catch (error) {
|
|
|
|
| 301 |
};
|
| 302 |
mediaRecorder.onstop = () => {
|
| 303 |
// We process the audio here, and free the previous one, if any
|
| 304 |
+
console.log('Chunks: ', audioChunks);
|
| 305 |
const blob = new Blob(audioChunks, {type: 'audio/webm'});
|
| 306 |
+
console.log('Blob: ', blob);
|
| 307 |
if (audioUrl) window.URL.revokeObjectURL(audioUrl);
|
| 308 |
audioUrl = window.URL.createObjectURL(blob);
|
| 309 |
+
console.log('url: ', audioUrl);
|
| 310 |
// HACK FOR TESTING
|
| 311 |
const audioElement = new Audio();
|
| 312 |
audioElement.src = audioUrl;
|
| 313 |
audioElement.play();
|
| 314 |
// HACK
|
| 315 |
+
audioChunks = [];
|
| 316 |
sendQuery({audioSource: audioUrl});
|
| 317 |
};
|
| 318 |
} catch (error) {
|