-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenderer.js
More file actions
27 lines (24 loc) · 827 Bytes
/
renderer.js
File metadata and controls
27 lines (24 loc) · 827 Bytes
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
// eslint-disable-next-line no-undef
electron.receiveImage('image', (imageBase64) => {
const img = document.getElementById('live-image');
img.src = `data:image/png;base64,${imageBase64}`;
});
console.log("Renderer script running");
if (window.electron) {
console.log("Electron object is available");
} else {
console.log("Electron object is NOT available");
}
document.addEventListener("DOMContentLoaded", () => {
const video = document.getElementById("webcam");
if (navigator.mediaDevices.getUserMedia) {
navigator.mediaDevices
.getUserMedia({ video: true })
.then(function (stream) {
video.srcObject = stream;
})
.catch(function (error) {
console.log("Something went wrong!", error);
});
}
});