To capture a tab, window, or screen from a regular Chrome web page, call navigator.mediaDevices.getDisplayMedia() in response to a user action, such as a button click. Chrome displays its own picker; the user chooses what to share, and your page receives a MediaStream that you can preview, record, or send through WebRTC. The page cannot silently choose a source or save permission for later.
Use getDisplayMedia() from a user action
Screen capture for an ordinary web app uses the Screen Capture API. It requires a secure context and transient user activation. In practice, call it directly from a click handler on a page served over HTTPS (localhost is generally treated as a secure development context). The browser prompts the user each time; there is no reusable silent permission grant. See MDN’s getDisplayMedia() reference and Screen Capture API overview.
This complete page provides a start button, local preview, stop control, and handling for the user ending capture from Chrome’s UI. Save it as an HTML file and serve it from a secure origin to try it in Chrome.
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Chrome screen capture demo</title>
<button id="start" type="button">Share a tab, window, or screen</button>
<button id="stop" type="button" disabled>Stop sharing</button>
<p id="status" role="status">Not sharing</p>
<video id="preview" autoplay muted playsinline controls></video>
<script>
const startButton = document.querySelector('#start');
const stopButton = document.querySelector('#stop');
const preview = document.querySelector('#preview');
const status = document.querySelector('#status');
let stream;
function stopSharing() {
if (stream) {
for (const track of stream.getTracks()) track.stop();
stream = undefined;
}
preview.srcObject = null;
startButton.disabled = false;
stopButton.disabled = true;
status.textContent = 'Not sharing';
}
startButton.addEventListener('click', async () => {
status.textContent = 'Waiting for your selection…';
try {
stream = await navigator.mediaDevices.getDisplayMedia({
video: true,
audio: false,
});
preview.srcObject = stream;
await preview.play();
startButton.disabled = true;
stopButton.disabled = false;
status.textContent = 'Sharing';
const [videoTrack] = stream.getVideoTracks();
videoTrack.addEventListener('ended', () => {
// Chrome's picker or browser UI ended the capture.
stopSharing();
}, { once: true });
} catch (error) {
stream = undefined;
preview.srcObject = null;
status.textContent = `${error.name}: ${error.message}`;
}
});
stopButton.addEventListener('click', stopSharing);
</script>
</html>
The code is an illustrative implementation of the documented API flow, not a claim of independent execution testing. Keep the call to getDisplayMedia() inside the click handler: delaying it until after unrelated asynchronous work can lose the user activation the browser requires.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
- 【1080P 60FPS Video Capture Card】 This HDMI game capture card is based on USB3.0 high speed transmission port, input resolution up to 4K@30HZ, output resolution up to 2K@30Hz or 1920×1080@60Hz. Type c and USB interface can meet most of the devices in daily life. Easily meet the online capture, real-time recording, online meetings, live gaming and other functions, so you have a better visual enjoyment. Note: For capture use only; requires capture software to function and is not intended for direct screen casting to a monitor or TV
- 【Ultra Low Latency Screen Sharing】 HDMI capture card is made of good quality aluminum alloy with strong heat dissipation, allowing you to enjoy ultra low latency while live gaming or video recording or live streaming, avoiding blue screens and lag. This HDMI to USBC capture card supports easy recording of good quality audio or HD video and transferring it to your computer or streaming platform, allowing you to record 60 fps HD video directly on your hard drive and real-time preview
- 【Plug and Play, Easy to Carry】 This HDMI 1080P video capture card does not require any additional drivers or external power supply, just plug and play for fast capture. The capture card is small and lightweight, so you can put it in your bag for emergencies, making it very portable for outdoor live streaming. It's also a great way to share content in game recording, video conference, video recorder and online teaching
- 【Wide Compatibility USB Capture Card】 Easily streams to Facebook, Youtube or Twitch. With the connection, this HDMI to USB C/3.0 video capture devices can be working on several Operating Systems and various software: Windows 7/ 8/ 10, Mac OS or above, Linux, Android, Laptop, Xbox One, PS3/PS4/PS5, Camera, DVDs, Set Top Box, Webcame, DSLR, Switch/Switch 2, TV BOX, HDTV, Potplayer/VLC, ZOOM, OBS Studio etc.
- 【Package Content & Note】 1x HD Audio Capture Card , 1x USB 3.0 to USB C Adapter (A-side 3.0, B-side 2.0), 1x user manual. Please note that you need to restart the OBS Studio software after the audio setup is complete, otherwise it will result in no sound output. When using an adapter, if the device is recognized as USB 2.0, try using the other side with the USB-C port. Simply flip the capture card and reconnect it to be recognized as USB 3.0
What Chrome asks the user to do
Chrome, not your page, presents the chooser for a tab, window, or entire screen. The user makes the selection, then the returned stream reflects that choice. Constraints and picker preferences can shape the experience, but they cannot preselect a specific tab, window, or monitor or bypass the chooser. Chrome documents these privacy controls in Privacy-preserving screen sharing controls.
Design the interface around that handoff: explain why sharing is needed before the click, show a clear active-sharing state, and let the user stop. Also handle the case where they dismiss the chooser or revoke sharing; do not assume a successful capture merely because the button was clicked.
Set picker and privacy preferences deliberately
Chrome supports options that influence available surfaces and picker behavior. They are preferences, not a way to override the user. Defaults can change, so set the behavior important to your product explicitly and verify it in the Chrome versions you support.
| Option | Effect | Considerations |
|---|---|---|
video.displaySurface |
Values "browser", "window", or "monitor" indicate a preference for a tab, window, or screen-type surface and can preselect the corresponding picker pane. |
Does not select a particular tab, window, or display. Choose a preference only when it fits the task. |
monitorTypeSurfaces |
"exclude" removes whole-screen sources; "include" permits them. Chrome documents "include" as the current default. |
Excluding monitors can reduce accidental exposure of unrelated apps. "exclude" conflicts with displaySurface: "monitor". |
selfBrowserSurface |
"exclude" can hide the current tab from the picker. Chrome documents this as the current default. |
Useful for a meeting or sharing interface to avoid users sharing the interface itself. Conflicts with preferCurrentTab: true. |
surfaceSwitching |
"include" lets Chrome offer a browser UI control for switching the shared tab during capture; "exclude" suppresses it. |
Decide whether users need to change tabs without stopping and restarting. Chrome recommends making the preference explicit. |
systemAudio |
"exclude" avoids offering system audio; Chrome may still offer relevant audio for tabs or windows. Chrome documents "include" as the current default. |
Excluding system audio can help prevent remote-call audio from being sent back into the same call. Audio availability depends on the selected surface and environment. |
For example, this request prefers a window, excludes entire-screen sources and the current tab, permits tab switching, and excludes system audio:
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →const stream = await navigator.mediaDevices.getDisplayMedia({
video: { displaySurface: "window" },
audio: true,
monitorTypeSurfaces: "exclude",
selfBrowserSurface: "exclude",
surfaceSwitching: "include",
systemAudio: "exclude",
});
The explicit exclusions matter: this example requests audio, but the browser still controls which audio choices are appropriate for the chosen source. Avoid contradictory combinations, notably excluding monitors while requesting displaySurface: "monitor", or excluding the current tab while setting preferCurrentTab: true. Check the current Chrome guidance and the actual browser/platform versions you support rather than assuming every option behaves identically everywhere.
Rank #2
- 【1080P HD High Quality】Capture resolution up to 1080p for video source and it is ideal for all HDMI devices such as PS4, PS3, Xbox One, Xbox 360, Wii U, DVDs, DSLR, Camera, Security Camera and set top box. Note: Video input supports 4K30/60Hz and 1080p120/144Hz. Does not support 4K120Hz/144Hz. Output supports up to 2K30Hz.
- 【Plug and Play】No driver or external power supply required, true PnP. Once plugged in, the device is identified automatically as a webcam. Detect input and adjust output automatically. Won't occupy CPU, optional audio capture. No freeze with correct setting.
- 【Compatible with Multiple Systems】suitable for Windows and Mac OS. High speed USB 3.0 technology and superior low latency technology makes it easier for you to transmit live streaming to Twitch, Youtube, Facebook, Twitter, OBS, Potplayer and VLC.
- 【HDMI LOOP-OUT】Based on the high-speed USB 3.0 technology, it can capture one single channel HD HDMI video signal. There is no delay when you are playing game live.
- 【Support Mic-in for Commentary】Rybozen capture card has microphone input and you can use it to add external commentary when playing a game. Please note: it only accepts 3.5mm TRS standard microphone headset.
Preview, record, or transmit the stream
The result is a MediaStream, not an image file. Attach it to a video element for local preview, pass it to MediaRecorder to record, or add its tracks to an RTCPeerConnection for a WebRTC call. The MediaStream interface is the common handoff point for those uses.
Stop capture and keep the UI in sync
There are two ways capture can end: the user stops it in Chrome’s browser UI, or your app stops the stream’s tracks. Listen for the video track’s ended event and reset preview, buttons, and any recording or call state. Your own stop control should call stop() on the tracks; clearing srcObject alone does not stop an active capture.
Recording and WebRTC
For recording, construct a MediaRecorder with the stream and collect its dataavailable events; choose a MIME type supported by the target browser rather than assuming a codec. For a call, add the stream’s tracks to the peer connection and apply your normal signaling and connection lifecycle. The capture API supplies the stream; recording storage, upload, signaling, and remote permissions remain application responsibilities.
Use extension APIs only for extension capture
A normal webpage should use getDisplayMedia(). Chrome extensions have separate APIs such as chrome.tabCapture and chrome.desktopCapture; those are not replacements to paste into a regular web app. See Chrome’s Audio recording and screen capture extension guide.
Extension lifecycle needs differ from webpage capture. Chrome says capture initiated in a content script ends when the user navigates to another page. For background recording across navigation, its guide describes using an offscreen document with the DISPLAY_MEDIA reason. Starting with Chrome 116, an extension can call tabCapture in a service worker after a user gesture and pass a stream ID to an offscreen document. These extension-specific patterns do not change the user-picker flow for a regular webpage.
Rank #3
- 【4K HDMI Input, 2K@30Hz Recording】Powered by a true USB 3.0 high-speed interface, the capture card supports up to 4K@30Hz HDMI input and records at 2K@30Hz or 1080P@60Hz. Perfect for gamers, streamers, and professionals who need crisp, smooth video for live streaming, gameplay recording, or online meetings.
- 【Ultra Low Latency Screen Sharing】Built with a premium aluminum alloy shell and advanced chipset for stable heat dissipation, ensuring ultra-low latency transmission. Capture high-quality video and dual-channel audio in real time—no lag, no frame drop—ideal for Twitch, YouTube, or OBS streaming.
- 【Easy Plug and Play, Compact & Portable】No driver or external power required—just plug and play via USB 3.0 or Type-C connection to your Windows or macOS computer. Lightweight and compact design makes it easy to carry for outdoor streaming, live shows, or mobile recording setups.
- 【Wide Compatibility & Multi-Device Support】Compatible with Windows 7 8 10 11, macOS, Linux,Android and supports most popular software such as OBS, Zoom, VLC, Twitch Studio, and more. Works seamlessly with PS4, PS5, Xbox, Switch, DSLR cameras, TV boxes, and other HDMI-output devices for streaming to YouTube, Twitch, etc.
- 【What You Get】Includes: HDMI Capture Card, USB 3.0 to USB-C Adapter, User Manual. Tips: Make sure your tablet’s OTG function is enabled before connecting. Test your HDMI device with a monitor first to confirm video and audio output, then connect to the Video Capture Card for recording.
Focus behavior, selected surface, and managed Chrome
Chrome’s Conditional Focus feature lets a web app influence whether the captured tab or window receives focus when capture starts. Chrome’s guide says Conditional Focus is available from Chrome 109; confirm compatibility against the versions you support. The same guide describes checking the captured track’s displaySurface setting to learn whether the user selected a tab, window, or screen. See Better screen sharing with Conditional Focus.
In managed environments, an administrator may disable or restrict capture. Chrome Enterprise documents a Screen video capture policy that controls whether websites may prompt users to stream a tab, window, or entire screen on ChromeOS and Chrome browser for Windows, Mac, and Linux. If the API is blocked on a work or school device, check with the administrator before treating it as an application defect. See Chrome policies for users or browsers.
Troubleshoot common capture failures
| Symptom | Likely cause | What to do |
|---|---|---|
navigator.mediaDevices or getDisplayMedia is unavailable |
The page is not running in a secure context, or the browser/environment does not expose the API. | Serve the app over HTTPS (or use localhost for development) and test in a supported Chrome version. |
The call rejects with InvalidStateError |
The request was not made with transient user activation, or the document is not in a suitable active state. | Call the method directly from a visible button click; do not trigger it on page load or after a workflow that loses the click activation. |
| The picker closes and no stream arrives | The user dismissed the chooser or did not approve a source. | Catch the rejection, restore the interface, and let the user initiate another attempt. Do not repeatedly reopen the picker without a new user action. |
| A requested constraint or picker preference is rejected | Options conflict or are not supported in the target Chrome version. | Check mutual exclusions, simplify the request, and test the exact supported browser versions. Do not use constraints to try to force a particular source. |
| Sharing ends unexpectedly | The user stopped sharing in Chrome, navigated away, or the source ended. | Handle the track’s ended event and reset local and remote state; provide a visible restart control. |
| Capture is blocked only on a managed device | An administrator policy may prohibit website screen capture. | Check the Screen video capture policy with the device administrator and distinguish policy restrictions from app errors. |
| Preview stays black or audio is missing | The selected source, browser audio choice, permission state, or playback setup may not match expectations. | Confirm srcObject is set, call play(), inspect track state and kind, and test with a source and audio option the user can share. Audio choices vary with the selected surface. |
Handle errors by their name for useful UI, but avoid promising that every failure has one universal fix: operating system, Chrome version, enterprise policy, and user selection can all affect the outcome. The official guides do not establish a browser-by-browser matrix for every audio and picker option, so verify the combinations relevant to your deployment.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Performance, reliability, and privacy trade-offs
Screen capture delivers a live media stream rather than a static screenshot. Processing and transmitting that stream consumes device and network resources; capture a tab or window rather than the entire screen when that is sufficient, and stop all tracks promptly when the task ends. For calls, avoid recapturing and retransmitting the call’s own audio if it can create feedback. Keep the browser’s source choice visible and explain what will be shared before prompting.
The API documentation does not establish a general capture-success rate or performance benchmark. Reliability therefore depends on the actual Chrome and operating-system versions, selected source, device policy, and how your app handles cancellation and ended tracks. Test those conditions on the platforms you support instead of presenting a single success figure.
Rank #4
- AV TO USB Converter: Capture videos and audios from VHS, VCR, Hi8, DV tapes to a PC, with the help of our USB Video Converter. Save room while digitizing your favorite old memories
- Quality Capture Card: Our USB Video Capture Card converting anolog RCA composite input into HD 720P USB output and capturing audio without any sound card. Advanced signal processing technology provides you with great precision, colors, resolutions, and details.
- Plug and Play: Automatically install the driver once you hook up this RCA to USB Converter to a PC. No external power is needed. User-friendly and easy to operate
- Wide Compatibility: The Video Capture Card can work with video devices with RCA connector or S-Video connector, such as VHS, VCR, Hi8, camcorder, compatible with Windows and Mac OS. Support video formats like NTSC, PAL, and support brightness, contrast, hue, and saturation control
- Note: The Video Converter is used with acquisition software. We recommend OBS Studio or PotPlayer for Windows, and QuickTime Player for Mac. They can be downloaded for free online. Please operate according to the steps in User Manual or contact us if you have any questions
Or skip the browser setup
If you need a server-generated screenshot of a webpage rather than an interactive screen-sharing stream, ScreenshotNeo is a different tool for that job. One GET request returns a PNG, JPEG, WebP, or PDF. Its clean-shot flow accepts cookie banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers indicate the page verdict and billing status. An MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients. This does not replace getDisplayMedia() when the user needs to choose and share a live tab, window, or monitor.
For example, this cURL request captures a webpage to a WebP file:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for the API details and parameter options. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for 1,000 free screenshots a month with no card.
Frequently Asked Questions
Can a webpage start Chrome screen capture automatically?
No. The user must initiate the request through a transient action and choose a source in Chrome’s picker.
Does getDisplayMedia() return a screenshot image?
No. It returns a MediaStream. Use a separate screenshot service or capture a frame from the stream if your application specifically needs a still image.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsCan I use ScreenshotNeo to share my current screen?
No. ScreenshotNeo captures webpages on its servers; Chrome’s Screen Capture API is the relevant choice when the user must select a live tab, window, or screen.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

