- From: Marcos Cáceres <notifications@github.com>
- Date: Mon, 11 Jul 2016 20:02:34 -0700
- To: w3c/permissions <permissions@noreply.github.com>
- Cc:
Received on Tuesday, 12 July 2016 03:03:56 UTC
> - deviceId: devices[0].deviceId})
> - })
> - .then(function(result) {
> - console.log('Camera permission to first camera is ' + result.state);
> - }
> - .catch(err => console.log('Bad things happened: ' + err.name));
> - </script>
> +navigator.mediaDevices
> + .enumerateDevices()
> + // filter out just video inputs
> + .then(
> + devices => devices.filter(({ kind }) => kind === "videoinput")
> + )
> + // get the deviceId of first camera, create query object
> + .then(
> + ([{ deviceId }]) => ({ name: "camera", deviceId })
Yep, good suggestion. Can do basically, filter, and then map to query object, and then map to promise there... and promise.all() for the cameras.
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/permissions/pull/101/files/470ed130ca7c83f19116181ac87726635a43802b#r70371103
Received on Tuesday, 12 July 2016 03:03:56 UTC