0

How do I access the properties of depth stream tracks through getUserMedia()? The properties I'm trying to get are principalPointX, principalPointY, focalLengthX, focalLengthY from media tracks

The documentation says I need to set depth to true, so when I do that, I get an error that forces me to set a video:

(index):20 Uncaught TypeError: Failed to execute 'getUserMedia' on 'Navigator': At least one of audio and video must be requested

When I try to do this:

navigator.mediaDevices.getUserMedia({video: true, depth: true})
   .then(stream => {

   video.srcObject = stream;
   console.log(stream);

}).catch(console.error)

stream doesn't return any of the properties I am trying to get like principalPointX. Any help would be appreciated.

RJK
  • 226
  • 1
  • 6
  • 22
  • These properties have been removed from the specs: https://w3c.github.io/mediacapture-depth/#mediatracksettings-dictionary Also, while I can't test because I haven't access to a depth camera myself, I think it would be in `stream.getVideoTracks()[0].getSettings()` that you should retrieve this enum (which should only have `videoKind: 'depth'` if my understanding of the specs is correct. – Kaiido Mar 20 '19 at 06:29
  • Does this mean these are properties that I will not be able to use since it's been deprecated? – RJK Mar 20 '19 at 14:42
  • Well at least Chromium just removed it https://bugs.chromium.org/p/chromium/issues/detail?id=939722 now, do you even have access to such a DepthTrack? At the end of [this issue](https://bugs.chromium.org/p/chromium/issues/detail?id=616098) they say it's still under a startup flag. – Kaiido Mar 20 '19 at 15:06
  • I was hoping to create my own depth track from my phone camera through `getUserMedia()` and then access the depth track which would ideally have the properties like `focalLengthX`. Perhaps that's not how it works. I tried `stream.getVideoTracks()[0].getSettings()` and `stream.getTracks()[0].getSettings()` and both return an object like: ```{aspectRatio: 1.33333333333 deviceId: "2fcbe5cbbbf21e05a5c63602f63f7aa367e76ad5164de04f323be2d" frameRate: 30.0000305175 groupId: "1597b58064afe71b4204d0f41b6f5b28fb79bb11d098030cd744d3" height: 480 resizeMode: "none" width: 640}``` – RJK Mar 20 '19 at 15:32

0 Answers0