I have problem with this block of code.
ctx.drawImage(document.getElementById("videoScreen"), 0, 0);
imgData = ctx.getImageData(0, 0, ctx.canvas.width, ctx.canvas.height).data;
if (sendFullScreenshot || lastFrame == undefined) {
sendFullScreenshot = false;
croppedFrame = new Blob([electron.nativeImage.createFromDataURL(ctx.canvas.toDataURL()).toJpeg(100), new Uint8Array(6)]);
}
The error is:
Can someone help me?
There is no method: .toJpeg
if You check manual You'll see that it's toJPEG
image.toJPEG(quality)
- quality Integer (required) - Between 0 - 100.
Returns Buffer - A Buffer that contains the image's JPEG encoded data.
So fix:
croppedFrame = new Blob([
electron.nativeImage
.createFromDataURL(ctx.canvas.toDataURL())
.toJPEG(100),
new Uint8Array(6)
]);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.