🐛 easier video constrains

This commit is contained in:
2019-01-25 17:40:41 +01:00
parent d5c7ba2cd5
commit c07a74d3a2

View File

@@ -7,6 +7,12 @@ export default class ToBlob extends Node {
image: { image: {
type: 'Image' type: 'Image'
}, },
width: {
type: 'Number',
},
height: {
type: 'Number',
}
}); });
this.start(); this.start();
} }
@@ -18,8 +24,8 @@ export default class ToBlob extends Node {
console.log(last(devices)); console.log(last(devices));
const stream = await navigator.mediaDevices.getUserMedia({ const stream = await navigator.mediaDevices.getUserMedia({
video: { video: {
width: { min: 1024, ideal: 1920, max: 1920 }, width: { min: 480, ideal: 1920, max: 1920 },
height: { min: 776, ideal: 1080, max: 1080 }, height: { min: 320, ideal: 1080, max: 1080 },
deviceId: last(devices).deviceId deviceId: last(devices).deviceId
}, },
}); });
@@ -36,6 +42,8 @@ export default class ToBlob extends Node {
if (lastFrameTime !== currentTime) { if (lastFrameTime !== currentTime) {
lastFrameTime = currentTime; lastFrameTime = currentTime;
this.out.image.value = video; this.out.image.value = video;
this.out.width.value = video.videoWidth;
this.out.height.value = video.videoHeight;
} }
requestAnimationFrame(feedLoop); requestAnimationFrame(feedLoop);
}; };