Standards Compliant Screen Capture in Chrome 72
Chrome 72 was rolled out yesterday with support for navigator.MediaDevices.getDisplayMedia()
turned ON by default.
You’re now able to capture and record/broadcast the screen of a user, a running app or a Chrome tab, plugin free, with Chrome 72.
For a quick demo use this demo/sample.
The code is as simple as pasting this in your console:
navigator.MediaDevices.getDisplayMedia({
video: true
}).then(
stream => {
//attach the stream to a video element console.log("Awesome");
},
error => {
console.log("Unable to acquire screen capture", error);
});
We’ve covered the topic in more detail back in November when the feature was introduced in Chrome 70 behind a flag. Here’s a quick recap:
- Use
navigator.MediaDevices.getDisplayMedia()
as per the new standard, NOTnavigator.getDisplayMedia()
- Edge, the 1st to support the function, uses **
navigator.getDisplayMedia()
**as per the older standard - Firefox 66 will also support the new function as per the bug report
- With Chrome you can capture the entire screen, an application window or a Chrome tab
- Desktop audio capture is not supported yet
- Capturing DRM content will not work (Netflix in the browser)