File size: 1,813 Bytes
7aec436
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html>
    <head>
        <title>Page title in index.html</title>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1" />
    </head>
    <body>
        <h1>It works!</h1>
        <button onclick="testDownload()">Test file download</button>
        <button onclick="testCamera()">Test camera</button>
        <button onclick="testMicrophone()">Test microphone</button>
        <button onclick="window.close()">window.close()</button>
        <script>

            const testDownload = async () => {

                const blob = new Blob([

                    new Uint8Array("Hello, world!".split("").map(i => i.charCodeAt(0)))

                ], {

                    type: "text/plain"

                });

                ExternalDownloadHelper.download("test.txt", blob);

            };

            

            const testCamera = async () => {

                const stream = await navigator.mediaDevices.getUserMedia({

                    video: true

                });

                const video = document.createElement("video");

                video.srcObject = stream;

                video.autoplay = true;

                video.controls = true;

                document.body.appendChild(video);

            };

            

            const testMicrophone = async () => {

                const stream = await navigator.mediaDevices.getUserMedia({

                    audio: true

                });

                const audio = document.createElement("audio");

                audio.srcObject = stream;

                audio.autoplay = true;

                audio.controls = true;

                document.body.appendChild(audio);

            };

        </script>
    </body>
</html>