Calling the camera using Getusermedia

Source: Internet
Author: User

A fun API in HTML5 that allows you to call your computer's webcam, combine <video> tags and Canvas to take photos in your browser.

Here's what to note:

Because of security issues, Chrome has disabled many features (beginning with file:///) for local files. So if you just drag the HTML file into Chrome you can't see the effect (Getusermedia failed). This question puzzled me for a long time.

Workaround:

1. Use the IDE to see the effects, such as Webstorm.

2. Cooperate with the HTTP server. Like Python simplehttpserver. or Apache and so on.

3. Close all chrome windows (otherwise the parameter is invalid). Add the following parameters to the command line to start Chrome.

Chrome--allow-file-access-from-files

An example

<! DOCTYPE html>

Code reference from http://davidwalsh.name/demo/camera.php

Calling the camera using Getusermedia

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.