Moved portAdded support for rear and front camera

This commit is contained in:
EpicKiwi 2023-10-31 20:56:20 +01:00
parent 8af2650aca
commit e854cdf234
Signed by: epickiwi
GPG Key ID: C4B28FD2729941CE

View File

@ -8,14 +8,27 @@
</head>
<body>
<h1>LOLED</h1>
<button id="stream-camera">Use your Camera</button>
<button id="stream-camera">Use rear Camera</button>
<button id="stream-front-camera">Use front Camera</button>
<script type="module">
import {connectSomeStream} from "/js/rtc.js"
document.getElementById("stream-camera")
.addEventListener("click", async () => {
let stream = await navigator.mediaDevices.getUserMedia({
video: true
video: {
facingMode: 'environment'
}
})
await connectSomeStream(stream)
})
document.getElementById("stream-front-camera")
.addEventListener("click", async () => {
let stream = await navigator.mediaDevices.getUserMedia({
video: {
facingMode: 'user'
}
})
await connectSomeStream(stream)
})