2023-10-31 19:44:06 +01:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<link rel="stylesheet" href="/css/style.css">
|
|
|
|
<title>LOLED - Camera</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1>LOLED</h1>
|
2023-10-31 20:56:20 +01:00
|
|
|
<button id="stream-camera">Use rear Camera</button>
|
|
|
|
<button id="stream-front-camera">Use front Camera</button>
|
2023-10-31 19:44:06 +01:00
|
|
|
<script type="module">
|
|
|
|
import {connectSomeStream} from "/js/rtc.js"
|
|
|
|
|
|
|
|
document.getElementById("stream-camera")
|
|
|
|
.addEventListener("click", async () => {
|
|
|
|
let stream = await navigator.mediaDevices.getUserMedia({
|
2023-10-31 20:56:20 +01:00
|
|
|
video: {
|
|
|
|
facingMode: 'environment'
|
|
|
|
}
|
|
|
|
})
|
|
|
|
await connectSomeStream(stream)
|
|
|
|
})
|
|
|
|
|
|
|
|
document.getElementById("stream-front-camera")
|
|
|
|
.addEventListener("click", async () => {
|
|
|
|
let stream = await navigator.mediaDevices.getUserMedia({
|
|
|
|
video: {
|
|
|
|
facingMode: 'user'
|
|
|
|
}
|
2023-10-31 19:44:06 +01:00
|
|
|
})
|
|
|
|
await connectSomeStream(stream)
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|