@airplanegobrr/camera-capture
This is a "fork" of a fork Please see below
The base of the code is bassed off of cancerberoSgx/camera-capture
There is a fork that adds a "getDevicesList" from zjffun/camera-capture#feat-get-devices-list
This repo was made because the format of BOTH the above is... messy.
Both projects are dead! I plan to use this as this is supper nice, not sure why its not used/updated more.
A rewrite will happen as I want to make a better API/layout of everything, and CJS.
Once this is rewritten I'll change the package name so its not stupid and drops the @airplanegobrr/
part
Using
- Install.
pnpm add @airplanegobrr/camera-capture
- Use it.
const { VideoCapture } = require("@airplanegobrr/camera-capture");
(async () => {
const videoCapture = new VideoCapture({
video: true,
mime: "image/png",
});
await videoCapture.initialize();
const devicesList = await videoCapture.getDevicesList();
const videoDevices = devicesList.filter(v => v.kind === "videoinput")
await videoCapture.startCamera({
video: {
deviceId: videoDevices[0].deviceId
}
})
let frame = await videoCapture.readFrame() // Extracts frame one by one. (AKA, Take picture)
console.log(frame)
})();
If building
If your building this make sure to copy src/assets
to dist/src/assets
TODO / Road map
performance
misc
low priority
ideas
- use a desktop GUI library like node-gui to render a node.js canvas - target users: people using jsdom / node canvas for testing canvas based apps headless have the possibility to render it (not just a screenshot but as actual stream of frames natively in the desktop)idea for for a project node-gui : a jsdom-node-canvas renderer: use jsdom+node-canvas to real-time render the canvas element in a view.