Accessing Multiple camera javascript getusermedia

You can create two different streams, one for each camera, and show them simultaneously in two <video> tags. The list of available devices is available using navigator.mediaDevices.enumerateDevices(). After filtering the resulting list for only videoinputs, you have access to the deviceIds without needing permission from the user. With getUserMedia you can then request a stream … Read more

Is it possible to control the camera light on a phone via a website?

Here is a little “torch-app” for a website: Edit 1: I also made a jsfiddle //Test browser support const SUPPORTS_MEDIA_DEVICES = ‘mediaDevices’ in navigator; if (SUPPORTS_MEDIA_DEVICES) { //Get the environment camera (usually the second one) navigator.mediaDevices.enumerateDevices().then(devices => { const cameras = devices.filter((device) => device.kind === ‘videoinput’); if (cameras.length === 0) { throw ‘No camera found … Read more

getUserMedia() in chrome 47 without using https

getUserMedia allows you to listen in to the private conversations of the user. If it were enabled over unencrypted HTTP, this would allow an attacker to inject code that listens in and sends the conversations to the attacker. For example, if you if you are in a private conference room of a hotel with unencrypted … Read more

GetUserMedia – facingmode

Update: facingMode is now available in Chrome for Android through the adapter.js polyfill! facingMode is not yet implemented in Chrome for Android, but works natively in Firefox for Android. You must use standard constraints however: (use https fiddle for Chrome): var gum = mode => navigator.mediaDevices.getUserMedia({video: {facingMode: {exact: mode}}}) .then(stream => (video.srcObject = stream)) .catch(e … Read more

Stop/Close webcam stream which is opened by navigator.mediaDevices.getUserMedia [closed]

EDIT Since this answer has been originally posted the browser API has changed. .stop() is no longer available on the stream that gets passed to the callback. The developer will have to access the tracks that make up the stream (audio or video) and stop each of them individually. More info here: https://developers.google.com/web/updates/2015/07/mediastream-deprecations?hl=en#stop-ended-and-active Example (from … Read more