JPLTedCas commited on
Commit
096eac5
1 Parent(s): 6f3ebe1

Delete static/index.html

Browse files
Files changed (1) hide show
  1. static/index.html +0 -63
static/index.html DELETED
@@ -1,63 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <title>Web Speech Recorder</title>
6
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
7
- </head>
8
- <body>
9
- <p>
10
- <button id="startRecording">Start recording</button>
11
- <button id="stopRecording" disabled>Stop recording</button>
12
- </p>
13
- </body>
14
- <script>
15
- navigator
16
- .mediaDevices
17
- .getUserMedia({ audio: true })
18
- .then(stream => { handlerFunction(stream) });
19
-
20
- function handlerFunction(stream) {
21
- rec = new MediaRecorder(stream);
22
- rec.ondataavailable = e => {
23
- audioChunks.push(e.data);
24
- if (rec.state == "inactive") {
25
- let blob = new Blob(audioChunks, { type: 'audio/mpeg-3' });
26
- sendData(blob);
27
- }
28
- }
29
- }
30
-
31
- function sendData(data) {
32
- var form = new FormData();
33
- form.append('file', data, 'data.mp3');
34
- form.append('title', 'data.mp3');
35
- //Chrome inspector shows that the post data includes a file and a title.
36
- $.ajax({
37
- type: 'POST',
38
- url: '/save-record',
39
- data: form,
40
- cache: false,
41
- processData: false,
42
- contentType: false
43
- }).done(function (data) {
44
- console.log(data);
45
- });
46
- }
47
-
48
- startRecording.onclick = e => {
49
- console.log('Recording are started..');
50
- startRecording.disabled = true;
51
- stopRecording.disabled = false;
52
- audioChunks = [];
53
- rec.start();
54
- };
55
-
56
- stopRecording.onclick = e => {
57
- console.log("Recording are stopped.");
58
- startRecording.disabled = false;
59
- stopRecording.disabled = true;
60
- rec.stop();
61
- };
62
- </script>
63
- </html>