Get to know MDN better
This feature is not Baseline because it does not work in some of the most widely-used browsers.
The captureStream() method of the HTMLMediaElement interface returns a MediaStream object that streams a real-time capture of the content being rendered in the media element.
This can be used, for example, as a source for a WebRTC RTCPeerConnection.
None.
A MediaStream object which can be used as a source for audio and/or video data by other media processing code, or as a source for WebRTC.
In this example, an event handler is established so that clicking a button starts capturing the contents of a media element with the ID "playback" into a MediaStream. The stream can then be used for other purposes, such as a WebRTC stream to share prerecorded videos with another person during a video call.
See Recording a media element for a longer and more intricate example and explanation.
| Media Capture from DOM Elements # dom-htmlmediaelement-capturestream |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Mar 6, 2026 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.