-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: camera choice #41
Comments
I'm afraid I don't know how to provide a way to select the camera from inside the library. The way it works is that WebcamJS just asks for generic "camera" access, and the browser itself handles asking the user which camera. This is implementation dependent, as all browsers and HTML5 / Flash do it differently. Sorry! |
Hi. If your idea is not to use Flash, maybe you can try this (Fork of webcamJS): Allows to choose a camera device. In the "init" function we try to list and store on array "cameraIDs" all IDs of video devices, in your code you can check the length of this array and select one camera ID by "cameraID" variable before call "attach" function. Something like that: // webcam set, as usual // selecting camera device // attach, as usual If you use this, please, some feedback will be great ;) Best regards. |
Following code gives me an error because cameraID is undefined. // selecting camera device |
@rafverhaert you have to use the fork version of the code which has the cameraid's array https://github.com/carvilsi/webcamjs/blob/master/webcam.js#L72 |
You can change camera by set value for capture attribute. At https://github.com/jhuckaby/webcamjs/blob/master/webcam.js#L367 See more capture options at: https://www.w3.org/TR/html-media-capture/ Ex: var input = document.createElement('input')
input.id = this.container.id + '-ios_input'
input.setAttribute('type', 'file')
input.setAttribute('accept', 'image/*')
input.setAttribute('capture', 'user') => Open front-camera |
I was hoping if i could use this library on a mobile website and it would open up the rear camera/front camera according to users choice, it would be great. Then i wont be required to use jquery mobile library.
The text was updated successfully, but these errors were encountered: