-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
46 lines (40 loc) · 1.42 KB
/
index.html
File metadata and controls
46 lines (40 loc) · 1.42 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no">
<title>IOS 17 Video Stream Jump Issue</title>
<style>
html, body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<h1>Cam Feed</h1>
<div style="background-color: yellow; width:90%; height: 80%">
<video id="videoElement" autoplay playsinline style="background-color: red; width:100%; height: 100%; object-fit: cover;"></video>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
const videoElement = document.getElementById('videoElement');
// Function to set up camera feed
const setupCamera = async () => {
try {
// Request access to the user's camera
const stream = await navigator.mediaDevices.getUserMedia({ video: true });
// Set the obtained stream as the srcObject of the video element
videoElement.srcObject = stream;
} catch (error) {
console.error('Error accessing camera:', error);
}
};
// Call the setupCamera function to initiate camera access and video setup
setupCamera();
});
</script>
</body>
</html>