-
Notifications
You must be signed in to change notification settings - Fork 20
Improve examples a bit #154
base: gh-pages
Are you sure you want to change the base?
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kenchris Thanks for help on this.
body.appendChild(colorEl); | ||
body.appendChild(depthEl); | ||
|
||
// Assume that all our video inputs are depth stream capable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change it to your demo as example instead then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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