Re: [mediacapture-image] [PTZ] Should pan, tilt, and zoom double constraints apply to getUserMedia? (#224)

> Web developers could have a priori knowledge of ranges (for instance if a user wants to resume a previously stopped video stream) in which case the site could issue
> 
> > ```js
> > await navigator.mediaDevices.getUserMedia({
> >   video: {
> >     deviceId: "...",
> >     pan: 1,
> >     tilt: 2,
> >     zoom: 3,
> >   }
> > });
> > ```

The PTZ camera device could have been placed somewhere else or pointed in another direction, so those values are not guaranteed to still be good.
I thought adding the boolean was to not alter PTZ values. If a video stream is stopped, we can safely assume that when a user wants to resume a previously stopped video stream, it will used its previous position, so no need to manually restore those values.

> Even without a priori knowledge, it might make sense to use `{video: {pan: 0, tilt: 0, zoom: 1}}`, for instance. If the user does not have a PTZ camera, pan/tilt/zoom constraints make no harm and if the user does have a PTZ camera, the constraints most probably reset the PTZ camera to a sensible state. For pan and tilt, the ranges is probably symmetric so 0 is in the middle. For zoom, the value 1 probably means no digital zoom or is less than or equal to the minimum of an optical zoom range resulting in widest possible optical zoom to be selected by media stream selection algorithms.
> 
> Resetting a PTZ camera to a sensible state might be quite important because the image quality of a PTZ camera may degrade drastically if a digital zoom level is high.

It seems to me that this is simply a shortcut of this code below.
```js
const stream = await navigator.mediaDevices.getUserMedia({
  video: { pan: true, tilt: true, zoom: true }
});
const videoTrack = videoStream.getVideoTracks()[0];
await videoTrack.applyConstraints({
  advanced: [{ pan: 0, tilt: 0, zoom: 1 }],
});
```

I think providing a "reset" button to users would be a nice way for websites to reset the camera to a sensible state if that's their wish instead of assuming that this is the case.

Note that on Android, the zoom property resets to "1" each time the camera is "opened"

One thing I've learnt while reading about PTZ is that we can't make guesses about the values of pan and tilt and their meanings. They are even sometimes off.

-- 
GitHub Notification of comment by beaufortfrancois
Please view or discuss this issue at https://github.com/w3c/mediacapture-image/issues/224#issuecomment-619973237 using your GitHub account

Received on Monday, 27 April 2020 13:05:43 UTC