Re: [mediacapture-image] Add pan and tilt constraints

@jan-ivar, I contend that even if `getSettings()` returns the last configured value immediately, this is still a use case highlighting the rounding problem.

As you pointed out, if you don't specify `exact` then the constraint may not actually be applied. How would one check if it had been applied? The promise returned by `applyConstraints` resolves to `void` if successful, so it doesn't provide you the information you need. A logical way to check would be to use `getSettings()` to see if your ideal settings had been set. For example, I may want: `{pan: {ideal: pan}, tilt: {ideal: tilt}, width: {exact: 640}, height: {exact: 480}}`.

If applying those constraints does not cause the promise to reject then I can be sure width and height were fine, but I don't know if pan or tilt took. So I check them with `getSettings()` and change the UI accordingly if they were not accepted, and we're back to the float rounding problem with simple equality. My check may say they weren't applied when in actuality they were, just my equality check failed due to the rounding.

Sure, this can be avoided by writing the code differently, such as applying each constraint one at a time with `exact` so that it is clear when a constraint fails. There's always ways around shortcomings, if you know the shortcomings.

If we go with degrees over arc-seconds then I'll likely add a note to the spec warning about these rounding problems and simple equality checks, although most casual developers are not going to be reading the spec itself.

-- 
GitHub Notification of comment by dsanders11
Please view or discuss this issue at https://github.com/w3c/mediacapture-image/pull/182#issuecomment-310805756 using your GitHub account

Received on Saturday, 24 June 2017 01:45:23 UTC