Home  >  Article  >  Web Front-end  >  Code based on HTML5 cool camera (HTML5 webcam) camera function implementation code_html5 tutorial skills

Code based on HTML5 cool camera (HTML5 webcam) camera function implementation code_html5 tutorial skills

WBOY
WBOYOriginal
2016-05-16 15:50:421629browse

photobooth demo - gbin1.com

WebRTC may be the most watched HTML5 standard next year. Mozilla has developed a set of APIs to help you control hardware, such as cameras, microphones, or accelerometers. You can call the native hardware devices you need without relying on other plug-ins.

In today’s article, we will introduce Photobooth.js developed by Wolfram Hempel. Using this class library can help you quickly call the camera function, and you can easily add the camera function to the website. And it quickly helps you take photos. You can use this function to take photos of users. Isn’t it great?

Main Features:
    Contrast setting color setting brightness setting hue setting photo button supports the latest chrome, firefox, opera and other browsers supports jQuery plug-in method and javascript code method

浏览器支持 - gbin1.com

After using Chrome to open the online demo, please confirm to allow the browser to call your camera, as follows:

基于HTML5实现的超酷摄像头(HTML5 webcam)拍照功能 - photobooth.js

Javascript code:

Copy code
The code is as follows:

$('#webcam' ).photobooth().on("image",function( event, dataUrl ){
$('.nopic').hide();
$( "#pictures" ).prepend( '< img src="' dataUrl '" >');
});

The above code will pass the generated image data to the tag with id=picture. Please refer to the relevant API for specific instructions.
Source code download

We hope you all like this online demonstration and demo we provide. If you have any questions, please leave us a message, thank you!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn