reusing canvas, passing imageBitmap instead

This commit is contained in:
2019-01-22 18:53:21 +01:00
parent abd29d2999
commit a8bced5b9e
22 changed files with 346 additions and 80 deletions

View File

@@ -18,8 +18,8 @@ export default class ToBlob extends Node {
console.log(last(devices));
const stream = await navigator.mediaDevices.getUserMedia({
video: {
width: { min: 1024, ideal: 1920, max: 1920 },
height: { min: 776, ideal: 1080, max: 1080 },
width: { min: 1024, ideal: 1280, max: 1920 },
height: { min: 776, ideal: 720, max: 1080 },
deviceId: last(devices).deviceId
},
});
@@ -32,8 +32,9 @@ export default class ToBlob extends Node {
video.play();
let lastFrameTime = null;
const feedLoop = () => {
if (lastFrameTime !== video.currentTime) {
lastFrameTime = video.currentTime;
const currentTime = video.currentTime;
if (lastFrameTime !== currentTime) {
lastFrameTime = currentTime;
this.out.image.value = video;
}
requestAnimationFrame(feedLoop);