Skip to content

HTMLMediaElement.captureStream - add notes#29165

Open
hamishwillee wants to merge 1 commit intomdn:mainfrom
hamishwillee:ff149_captureStream_notes
Open

HTMLMediaElement.captureStream - add notes#29165
hamishwillee wants to merge 1 commit intomdn:mainfrom
hamishwillee:ff149_captureStream_notes

Conversation

@hamishwillee
Copy link
Contributor

FF149 adds support for HTMLElement.captureStream() in https://bugzilla.mozilla.org/show_bug.cgi?id=2017708 - and this was recoreded in #29135.

Previously only a non-standards-compliant version mozCaptureSttream() was defined. The docs contained notes about the compliance issues. This attempts to move those to BCD, where they belong.

Related work for this can be tracked in mdn/content#43215

@github-actions github-actions bot added data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API size:s [PR only] 7-24 LoC changed labels Mar 3, 2026
Comment on lines +498 to +504
"version_added": "15",
"notes": [
"From version 51 to version 148, if the source changes from a `MediaStream` after capture starts, the captured stream data cannot be updated until you switch the source back to a `MediaStream`.",
"From version 51 to version 148, if `mozCaptureMediaStream()` is called on a media element with a `MediaStream` source, the returned object only contains tracks while the element is playing a `MediaStream`.",
"From version 51 to version 148, if `mozCaptureMediaStream()` is called on a media element with no source media, its compatibility mode is be based on the first source that's added; and the stream will only work with that kind of stream from then on.",
"Prior to version 51, `mozCaptureMediaStream()` could not be used on a media element whose source is itself a `MediaStream` (such as a `<video>` element presenting a stream being received over an `RTCPeerConnection`)."
]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, the text stripped out of the docs is:

Firefox-specific notes

Prior to Firefox 51, you couldn't use captureStream() on a media element whose source is, itself, a {{domxref("MediaStream")}} (like a {{HTMLElement("video")}} element which is presenting a stream being received over a {{domxref("RTCPeerConnection")}}).
From Firefox 51 you can capture a stream from the video element and use {{domxref("MediaRecorder")}} to record it.

Prior to Firefox 149 captureStream() was prefixed as mozCaptureStream() on Firefox, with the following implementation quirks:

  • The Firefox implementation only matches the specification when the media element's source is, itself, a {{domxref("MediaStream")}}.
  • For other source types the behavior is incompatible.
    If the source changes after starting capture, the output capture stream can't accept the new source data, so no {{domxref("MediaStreamTrack")}}s from the new source MediaStream are added to the captured stream, resulting in output that doesn't capture the updated source.
  • Switching the source back to a MediaStream adds tracks back to the stream and it works again as expected.
  • Calling mozCaptureMediaStream() on an element with a MediaStream source returns a stream that only contains tracks while the element is playing a MediaStream.
  • If you call mozCaptureMediaStream() on a media element with no source media, its compatibility mode will be based on the first source that's added; for example, if it's a MediaStream, then the capture stream will only work with MediaStream sources from then on.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

Tip: Review these changes grouped by change (recommended for most PRs), or grouped by feature (for large PRs).

Copy link
Contributor

@ddbeck ddbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @hamishwillee, we discussed this PR during PR triage on today's BCD call. I've left you some suggestions in line comments. Thank you!

{
"prefix": "moz",
"version_added": "15"
"version_added": "15",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, I'd suggest breaking this support statement in two, for a total of three support statements:

  • Unprefixed, added 149 (no notes)
  • Prefixed, added 149 (no notes)
  • Prefixed, partially implemented, added 15, removed 149, with notes from the diff here.

Then I would apply the changes I propose to the notes below.

Comment on lines +500 to +502
"From version 51 to version 148, if the source changes from a `MediaStream` after capture starts, the captured stream data cannot be updated until you switch the source back to a `MediaStream`.",
"From version 51 to version 148, if `mozCaptureMediaStream()` is called on a media element with a `MediaStream` source, the returned object only contains tracks while the element is playing a `MediaStream`.",
"From version 51 to version 148, if `mozCaptureMediaStream()` is called on a media element with no source media, its compatibility mode is be based on the first source that's added; and the stream will only work with that kind of stream from then on.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When this is broken into a partial_implementation support statement, these notes will start with:

From Firefox 51, if …

"From version 51 to version 148, if the source changes from a `MediaStream` after capture starts, the captured stream data cannot be updated until you switch the source back to a `MediaStream`.",
"From version 51 to version 148, if `mozCaptureMediaStream()` is called on a media element with a `MediaStream` source, the returned object only contains tracks while the element is playing a `MediaStream`.",
"From version 51 to version 148, if `mozCaptureMediaStream()` is called on a media element with no source media, its compatibility mode is be based on the first source that's added; and the stream will only work with that kind of stream from then on.",
"Prior to version 51, `mozCaptureMediaStream()` could not be used on a media element whose source is itself a `MediaStream` (such as a `<video>` element presenting a stream being received over an `RTCPeerConnection`)."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This note will start with "Before Firefox 51"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API size:s [PR only] 7-24 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants