Based on WebcamJS 1.0 by Joseph Huckaby.
Docs for camera are available here.
An alternative concise and even nicer solution in jQuery can be found here. See more in Danny Markov's tutorial.
On oTree side, the solution is a bit primitive: we put the camera data into a TextField, and then process it decoding from Base64 back to image, and save it in a static folder with the name [photo]+[participant's code].
At the next page the player can delete or keep the photo on server.