Spaces:
Running
Running
Update index.html
Browse files- index.html +28 -19
index.html
CHANGED
@@ -1,19 +1,28 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
|
4 |
+
<head>
|
5 |
+
<meta charset="UTF-8">
|
6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7 |
+
<title>Screen Sharing Web</title>
|
8 |
+
</head>
|
9 |
+
|
10 |
+
<body>
|
11 |
+
<video id="screenVideo" autoplay playsinline controls></video>
|
12 |
+
<script>
|
13 |
+
navigator.mediaDevices.getDisplayMedia({ video: true, audio: true })
|
14 |
+
.then(stream => {
|
15 |
+
const videoElement = document.getElementById("screenVideo");
|
16 |
+
videoElement.srcObject = stream;
|
17 |
+
stream.getVideoTracks()[0].onended = () => {
|
18 |
+
videoElement.srcObject = null;
|
19 |
+
};
|
20 |
+
})
|
21 |
+
.catch(error => {
|
22 |
+
alert("Screen sharing failed: " + error.message);
|
23 |
+
});
|
24 |
+
</script>
|
25 |
+
|
26 |
+
</body>
|
27 |
+
|
28 |
+
</html>
|