[mediacapture-depth] Change depth to MediaTrackConstraints

huningxin has just created a new issue for 
https://github.com/w3c/mediacapture-depth:

== Change depth to MediaTrackConstraints ==
Current spec defines the depth as a new media type in 
`MediaStreamConstraints`

```
partial dictionary MediaStreamConstraints {
    (boolean or MediaTrackConstraints) depth = false;
};
```

However actually the depth camera is a kind of video capture device, 
it shares most of characteristics of a color camera. The major 
difference with a color camera is the pixel format and the meta data 
describing the pixel value (depth value).

So I propose to change the depth to the `MediaTrackConstraints`. To 
accommodate more kinds of video capture device, it would introduce the
 `videoKind` constrainable property:

```
partial dictionary MediaTrackConstraintSet {
             ConstrainDOMString videoKind;
};

enum VideoDeviceKindEnum {
    "color",
    "depth",
    "infrared",
    "fisheye"
};
```

The example of requesting a single depth track:
```
navigator.mediaDevices.getUserMedia({
  video: {videoKind: {exact: "depth"}}
}).then(function (stream) {
  // Render the depth video.
  var video = document.querySelector('#depth-video');
  video.srcObject = stream;
  video.play()
});
```

The example of requesting the color and depth tracks from one 3D 
camera by setting the `groupId` of the 3D camera.
```
navigator.mediaDevices.getUserMedia({
  video: {groupId: {exact: id}}
}).then(function (stream) {
  // Render the color video.
  var video = document.querySelector('#color-video');
  video.srcObject = stream;
  video.play()
});

navigator.mediaDevices.getUserMedia({
  video: {videoKind: {exact: "depth"}, groupId: {exact: id}}
}).then(function (stream) {
  // Render the depth video.
  var video = document.querySelector('#depth-video');
  video.srcObject = stream;
  video.play()
});
```

@robman @anssiko @fluffy @astojilj,  WDYT?

Please view or discuss this issue at 
https://github.com/w3c/mediacapture-depth/issues/143 using your GitHub
 account

Received on Tuesday, 15 November 2016 01:56:37 UTC