-
Notifications
You must be signed in to change notification settings - Fork 60
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.applyConstraints() should resolve the Promise with the applied constraints #462
Comments
@jan-ivar can you think of any reason why we couldn't do this? |
@yellowdoge What's the utility? You already have them, and they're synchronously available: await track.applyConstraints(constraints);
console.log(constraints == track.getConstraints()); // true |
@beaufortfrancois what was the rationale...? |
I'd like to know which constraints have been applied after each call as they might not be the ones currently set. track.applyConstraints(someConstraints).then(appliedConstraints => {
console.log(appliedConstraints + ' may be different from ' + track.getConstraints());
)};
track.applyConstraints(otherConstraints).then(appliedConstraints => {
console.log(appliedConstraints + ' may be different from ' + track.getConstraints());
)}; |
@beaufortfrancois That cannot happen. |
Chrome's implementation actually makes this happen. Go to https://beaufortfrancois.github.io/sandbox/image-capture/playground.html and execute JS code below in your console (webcam is expected): imageCapture.track.applyConstraints({advanced: [{brightness: 100}]}).then(_ => {
var appliedBrightness = imageCapture.track.getConstraints().advanced[0].brightness;
console.assert(appliedBrightness == 100, 'applied brightness should be 100');
});
imageCapture.track.applyConstraints({advanced: [{brightness: 200}]}).then(_ => {
var appliedBrightness = imageCapture.track.getConstraints().advanced[0].brightness;
console.assert(appliedBrightness == 200, 'applied brightness should be 200');
});
|
@beaufortfrancois : Chrome's implementation is not spec compliant and only works in a limited way for image capture. If applyConstraints is successful, getConstraints() should be the same (or equivalent) to the constraints that were requested. |
Isn't it also behind a flag still? |
It is not behind a flag after Chrome 59. |
We should close this. |
Closing. You can get the most recently applied constraints by getConstraints(), and the settings that resulted by getSettings() (and they don't mean the same thing). |
At https://w3c.github.io/mediacapture-main/#dom-constrainablepattern-applyconstraints(), instead of resolving with
void
, it'd be better to resolve with the applied constraints.The text was updated successfully, but these errors were encountered: