Reputation: 626
How to choose between the front and rear camera in a webapp?
also usefull for: How to choose between multiple microphones?
Upvotes: 9
Views: 21239
Reputation: 626
There is a live example on:
https://webrtc.github.io/samples/src/content/devices/input-output/
(This webrtc-link is new, and should work on Chrome mobile)
Link is from this answer - https://stackoverflow.com/a/35480435/2414207, which is discussing MediaDevices.enumerateDevices()[new] vs MediaStreamTrack.getSources()[deprecated] in depth.
You can find further information (slightly outdated now, but usefull to get the big picture) about this on:
http://www.html5rocks.com/en/tutorials/getusermedia/intro/#toc-gettingstarted
Scroll down and skip:
until
For reference: my former live example (broken)
https://simpl.info/getusermedia/sources/
They are using MediaStreamTrack.getSources()[deprecated],this is not working on Chrome 45 and Firefox 39 anymore.
For the new function MediaDevices.enumerateDevices() - see https://stackoverflow.com/a/35480435/2414207
Upvotes: 22