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

MediaStreamTrack.stop() should be async #36

Open
sonntag-philipp opened this issue Aug 30, 2021 · 4 comments
Open

MediaStreamTrack.stop() should be async #36

sonntag-philipp opened this issue Aug 30, 2021 · 4 comments
Assignees

Comments

@sonntag-philipp
Copy link

Hello there,

I'm currently working with the mediacapture api in different browsers. While working on the MediaStreamTracks, I've noticed that the stop method doesn't provide a way to get notified when the track is actually stopped by the underlying user agent.

This can cause issues in platforms, where a camera can only be opened once by the browser api.

My proposal for a solution would be to make the .stop() method async by returning a promise.
The promise should be resolved when the user agent made sure, that the media track is stopped.

The described method in the RFC.

@fippo
Copy link

fippo commented Aug 30, 2021

does that require an API change or should the user agent ensure pending closes are done before attempting to open a device?

@sonntag-philipp
Copy link
Author

Yes, I think it would require an api change as the method signature of MediaStreamTrack.stop() would change to return a promise.
Anyway, this wouldn't affect existing uses of the method. They could just ignore the return value.

@guidou
Copy link

guidou commented Aug 30, 2021

I agree that returning a promise would be useful and allow more flexibility for implementation.

@alvestrand alvestrand transferred this issue from w3c/mediacapture-main Sep 2, 2021
@alvestrand
Copy link
Contributor

Changing the API does not seem like a good option, given that this is a rather old and stable spec by now.
Moving it to mediacapture-extensions in order to figure out how to solve the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants