Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api.MediaStreamTrackProcessor - constructor not available on Safari 18 #24569

Closed
allsey87 opened this issue Sep 28, 2024 · 13 comments
Closed

api.MediaStreamTrackProcessor - constructor not available on Safari 18 #24569

allsey87 opened this issue Sep 28, 2024 · 13 comments
Labels
data:api 🐇 Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API

Comments

@allsey87
Copy link

allsey87 commented Sep 28, 2024

What type of issue is this?

Incorrect support data (example: BrowserX says "86" but support was added in "40")

What information was incorrect, unhelpful, or incomplete?

I believe this entry is incorrect. When I try to create a new instance of a MediaStreamTrackProcessor, I am hit with:

ReferenceError: Can't find variable: MediaStreamTrackProcessor

What browsers does this problem apply to, if applicable?

Safari

What did you expect to see?

The constructor run correctly and no exception

Did you test this? If so, how?

In the Javascript console of Safari: new MediaStreamTrackProcessor() - this should fail since I have not provided any arguments, but it should not throw a reference error exception.

Can you link to any release notes, bugs, pull requests, or MDN pages related to this?

#23367

Do you have anything more you want to share?

No response

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrackProcessor

MDN metadata

MDN page report details
  • Query: api.MediaStreamTrackProcessor
  • Report started: 2024-09-28T11:35:55.380Z
@queengooborg queengooborg added the data:api 🐇 Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API label Sep 28, 2024
@skyclouds2001

This comment was marked as resolved.

@allsey87
Copy link
Author

allsey87 commented Sep 30, 2024

@skyclouds2001 did you try and get a different result? I tested on 18.0, perhaps this is fixed in 18.1 but in either case the data is still wrong.

Any idea what is happening @Elchi3?

@ludovit-as
Copy link

I can confirm that on Safari 18.0.1, the MediaStreamTrackProcessor is NOT available.

@skyclouds2001
Copy link
Contributor

skyclouds2001 commented Oct 11, 2024

I can see the interface is included in source code yet, but can't found the commit in release refs, maybe it has not added to release yet?

image

see source, commit and commit, bug and bug

see also spec

@skyclouds2001
Copy link
Contributor

But safari release note says it is supported, see https://developer.apple.com/documentation/safari-release-notes/safari-18-release-notes#WebRTC

@allsey87
Copy link
Author

But safari release note says it is supported, see https://developer.apple.com/documentation/safari-release-notes/safari-18-release-notes#WebRTC

Perhaps it is only partially implemented? Those release notes do not specifically mention MediaStreamTrackProcessor...

@skyclouds2001
Copy link
Contributor

But safari release note says it is supported, see https://developer.apple.com/documentation/safari-release-notes/safari-18-release-notes#WebRTC

Perhaps it is only partially implemented? Those release notes do not specifically mention MediaStreamTrackProcessor...

I think this item says MediaStreamTrackProcessor is supported.

image

@ludovit-as
Copy link

I think this item says MediaStreamTrackProcessor is supported.

Did you test it?

@linusbrolin
Copy link

I have been looking at this aswell.
Safari 18 have implemented both MediaStreamTrackProcessor and VideoTrackGenerator, but only in dedicated workers, just like their release notes say.

So they are not available in the main thread, you must create a Worker to use them.

Example for testing their availability:

// somewhere in the main code
console.log('main', `MediaStreamTrackProcessor: ${'MediaStreamTrackProcessor' in globalThis}, VideoTrackGenerator: ${'VideoTrackGenerator' in globalThis}, TransformStream: ${'TransformStream' in globalThis}`);

const worker = new Worker('worker.js');

worker.onmessage = ({ data }) => { console.log('worker', data); };
worker.postMessage('');

// worker.js file
addEventListener('message', ({ data }) => {
  postMessage(`MediaStreamTrackProcessor: ${'MediaStreamTrackProcessor' in globalThis}, VideoTrackGenerator: ${'VideoTrackGenerator' in globalThis}, TransformStream: ${'TransformStream' in globalThis}`);
});

// console log results
main MediaStreamTrackProcessor: false, VideoTrackGenerator: false, TransformStream: true
worker MediaStreamTrackProcessor: true, VideoTrackGenerator: true, TransformStream: true

@skyclouds2001
Copy link
Contributor

skyclouds2001 commented Oct 15, 2024

I think this item says MediaStreamTrackProcessor is supported.

I mean, I think this item indicate the support of MediaStreamTrackProcessor

Safari 18 have implemented both MediaStreamTrackProcessor and VideoTrackGenerator, but only in dedicated workers, just like their release notes say.

Yes, this is correct, this is also how the spec defines.

image

@allsey87
Copy link
Author

allsey87 commented Oct 15, 2024

Out of interest, what is the intended workflow then if you start with getUserMedia (not available in workers) and want to use it with MediaStreamTrackProcessor (only available in workers)? Which object and at what point are you supposed to send stuff to the worker via postMessage?

At the moment I am doing: getUserMedia -> getTracks -> MediaStreamTrackProcessor -> readable which gives me a ReadableStream that I transfer to the worker.

...Ok, apparently MediaStreamTrack as returned by getTracks is transferable according to this merged PR?

@linusbrolin
Copy link

The WebRTC repo has an example here that might help:
https://github.com/webrtc/samples/blob/gh-pages/src/content/capture/worker-process/js/main.js

Even more fun though is that Chromium only supports MediaStreamTrackProcessor in window, so not in workers, so it'll be "fun" making a solution that works in both.

@allsey87
Copy link
Author

I haven't tested this in a worker yet, but will close since the data seems to be correct after all.

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
Projects
None yet
Development

No branches or pull requests

5 participants