-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
34 lines (31 loc) · 1.02 KB
/
index.js
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
const ASMEditor = import('./pkg/webcam_stream_wasm');
ASMEditor.then((mod) => {
console.log("initiated...");
console.log(mod);
window.mod = mod;
})
if (navigator.mediaDevices) {
console.log('getUserMedia supported.');
var constraints = { video: true };
var chunks = [];
// navigator.mediaDevices.getUserMedia(constraints)
// .then(function (stream) {
// var canvas = document.getElementById("video-src");
// var track = stream.getVideoTracks()[0];
// let imageCapture = new ImageCapture(track);
// setInterval(function () {
// imageCapture.grabFrame()
// .then(function (bmpImage) {
// canvas.width = bmpImage.width;
// canvas.height = bmpImage.height;
// canvas.getContext("2d").drawImage(bmpImage, 0, 0);
// })
// .catch(function (err) {
// console.log(err);
// });
// }, 100);
// })
// .catch(function (err) {
// console.log('The following error occurred: ' + err);
// })
}