Improve examples a bit#154
Conversation
|
Marked as non-substantive for IPR from ash-nazg. |
|
Thanks @kenchris! (Fixes #57.) PTAL @astojilj @huningxin. |
|
(No need to worry about the build failure, it is a harmless warning of empty |
| body.appendChild(colorEl); | ||
| body.appendChild(depthEl); | ||
|
|
||
| // Assume that all our video inputs are depth stream capable. |
There was a problem hiding this comment.
We can use videoKind to avoid the need for this assumptions - usually there is an integrated camera and this approach (via navigator.mediaDevices.enumerateDevices()) didn't work. I guess counting the MediaDeviceInfo that are videoinput with the same groupId would give a closer match but it still looks like a hack.
We shouldn't need to use enumerateDevices - first use videoKind to get depth stream, then get groupId from the depthStream's track and then use videoKind: color + groupId to get corresponding color device.
I didn't try this yet - it depends on experimental MediaStreamTrack.getSettings() - https://crbug.com/681824. Maybe it is already available through MediaTrackCapabilities though.
The implementation for videoKind has recently been added to Chromium: https://crrev.com/2664673002/.
There was a problem hiding this comment.
Can you try to modify the example and test it there (I dont have the hardware), then I will update the example
| depthVideo.play(); | ||
| } | ||
| ); | ||
| const stream = await navigator.mediaDevices.getUserMedia(constraints); |
There was a problem hiding this comment.
I like await. Is it a problem that it looks different compared to original approach in main spec?
https://w3c.github.io/mediacapture-main/#examples
There was a problem hiding this comment.
I would say no. This spec is newer and thus will use newer platform features.
| }).catch(function (reason) { | ||
| // handle gUM error here | ||
| }); | ||
| </aside> |
There was a problem hiding this comment.
This approach is going to be deleted soon - reconstruction from split components is not supported.
We need to base the example on floats - like in https://software.intel.com/en-us/blogs/2017/02/10/depth-camera-capture-in-html5.
There was a problem hiding this comment.
Let's change it to your demo as example instead then.
There was a problem hiding this comment.
I can try to help simplify that as well but I cannot test here
|
Rebased, will have to look at this later... comments are of course always welcome |
Move to ES2017 and make the examples a bit easier to understand
Preview | Diff