vakodiya commited on
Commit
9375644
1 Parent(s): 31f3c81

Delete mic_component.js

Browse files
Files changed (1) hide show
  1. mic_component.js +0 -34
mic_component.js DELETED
@@ -1,34 +0,0 @@
1
- const recordButton = document.getElementById("recordButton");
2
- const stopButton = document.getElementById("stopButton");
3
- const audioChunks = [];
4
-
5
- let mediaRecorder;
6
-
7
- navigator.mediaDevices.getUserMedia({ audio: true })
8
- .then(function(stream) {
9
- mediaRecorder = new MediaRecorder(stream);
10
-
11
- recordButton.onclick = function() {
12
- mediaRecorder.start();
13
- console.log("Recording started...");
14
- };
15
-
16
- stopButton.onclick = function() {
17
- mediaRecorder.stop();
18
- console.log("Recording stopped...");
19
- };
20
-
21
- mediaRecorder.ondataavailable = function(e) {
22
- audioChunks.push(e.data);
23
- };
24
-
25
- mediaRecorder.onstop = function(e) {
26
- const audioBlob = new Blob(audioChunks, { type: "audio/wav" });
27
- const reader = new FileReader();
28
- reader.readAsDataURL(audioBlob);
29
- reader.onloadend = function() {
30
- const base64data = reader.result.split(',')[1];
31
- Streamlit.setComponentValue(base64data);
32
- };
33
- };
34
- });