screenshot
getDisplayMedia()
=> MediaRecorder()
=> VP8 - WebM JavaScript Decoder => ImageData
Usage
(async _ => {
try {
const screenshots = await screenshot();
for (const screenshot of screenshots) {
// do stuff with ImageData
console.log(screenshot);
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
canvas.width = screenshot.width;
canvas.height = screenshot.height;
ctx.putImageData(screenshot, 0, 0);
document.body.appendChild(canvas);
}
} catch(e) {
throw e;
}
})()
.catch(e => {
console.error(e);
console.trace();
});
Tested at Firefox 82, Nightly 84, Chromium 88.
TODO: Programmatically hide screen capture notification.