// Create controller and start capture
const controller = new CaptureController();
videoElem.srcObject = await navigator.mediaDevices.getDisplayMedia({
controller,
});
// ...
incBtn.addEventListener("click", increaseZoom);
async function increaseZoom() {
try {
await controller.increaseZoomLevel();
} catch (e) {
console.log(e);
}
}CaptureController: increaseZoomLevel() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.