File size: 1,852 Bytes
26ab438
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #textarea2{
            overflow: hidden;
        }
    </style>
</head>
<body>
    <h1>test</h1>
    <pre>
https://5173-01hm8s5jycsmrc8k2gbqz5e1wf.cloudspaces.litng.ai/test.html

    </pre>
    <textarea id="textarea1" name="testtextarea" id="testtextarea " cols="30" rows="10"></textarea> <br>
    <textarea id="textarea2" name="testtextarea" id="testtextarea " cols="300" rows="10"></textarea> <br>

    <input id="input1" type="text" placeholder="input1"> <br>
    <input id="input2" type="number" placeholder="input2" > <br>

    <input id="fileinput" type="file" /> <br>
    <br><button id="start">start</button>
    <button id="stop">stop</button>

</body>


<script src="./index.js"></script>
<script src="./test.js"></script>
<script>
    let startButton=document.querySelector('#start');
    let stopButton=document.querySelector('#stop');

    let rec=new Recorder();


    document.querySelector('#start').addEventListener('click',async ()=>{

        console.log('start');
        let blob=await rec.startRecording(stopButton)
        
//        rec.startRecording(document.body,playAudioBlob)    
  //      rec.startRecording(document.body,blobToBase64)    

        console.log('got blob',blob)
        playAudioBlob(blob)
        console.log(await blobToBase64(blob) );
        sendAudioToLeptonWhisperApi(blob);
        //let transcribe=await whisperjaxws(blob);

    })


    
    document.querySelector('#stop').addEventListener('click',()=>{
        rec.stopRecording();

    })

    document.body.addEventListener('focus',()=>{
        console.log('focus');
    })

</script>
</html>