-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVRPlayer.html
39 lines (37 loc) · 962 Bytes
/
VRPlayer.html
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
<!DOCTYPE html>
<html>
<head>
<style>
.container {
display: flex;
width: 100%;
}
.video {
flex: 1;
width: 50%;
}
</style>
</head>
<body>
<div class="container">
<video class="video" id="video1" autoplay playsinline></video>
<video class="video" id="video2" autoplay playsinline></video>
</div>
<script>
async function startCapture(displayMediaOptions) {
try {
const stream = await navigator.mediaDevices.getDisplayMedia(
displayMediaOptions
);
const video1 = document.getElementById("video1");
const video2 = document.getElementById("video2");
video1.srcObject = stream;
video2.srcObject = stream;
} catch (err) {
console.error("Error accessing screen:", err);
}
}
startCapture({ video: true, audio: false });
</script>
</body>
</html>