Moved portAdded support for rear and front camera
This commit is contained in:
parent
8af2650aca
commit
e854cdf234
@ -8,14 +8,27 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>LOLED</h1>
|
<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">
|
<script type="module">
|
||||||
import {connectSomeStream} from "/js/rtc.js"
|
import {connectSomeStream} from "/js/rtc.js"
|
||||||
|
|
||||||
document.getElementById("stream-camera")
|
document.getElementById("stream-camera")
|
||||||
.addEventListener("click", async () => {
|
.addEventListener("click", async () => {
|
||||||
let stream = await navigator.mediaDevices.getUserMedia({
|
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)
|
await connectSomeStream(stream)
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user