html5 qrcode.js,GitHub - dwa012/html5-qrcode: A cross platform HTML5 QR code reader.

这是一个用于HTML5兼容浏览器的跨平台jQuery库,实现二维码读取功能。依赖于LazarSoft的jsqrcode解码器。通过创建基本的div元素并设置宽度和高度,然后调用html5_qrcode函数来开始读取二维码。当完成使用相机时,调用html5_qrcode_stop()停止扫描并关闭视频流。提供了成功读取、读取错误和视频加载错误的回调函数。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

HTML5 QR Code Reader

Description

This is a cross platform jQuery library to create a QRcode reader for HTML5 compatible browser.

The decoder used for the QRcode reading is from LazarSoft

https://github.com/LazarSoft/jsqrcode

Demo

Usage

Include:

jQuery

The two supplied files in the lib directory; html5_qrcode.min.js, and jsqrcode-combined.min.js.

Create a basic

with a given width and height.

Presently width and height attributes must be set.

Then call the html5_qrcode function on the div.

$('#reader').html5_qrcode(function(data){

// do something when code is read

},

function(error){

//show read errors

}, function(videoError){

//the video stream could be opened

}

);

It takes three callbacks: a readSuccess, readError, and videoLoadError. The readError will be called quite often, it is really only useful for debugging.

videoError is called if the HTML5 video stream cannot be opened.

When you're done using the camera, call $('#reader').html5_qrcode_stop() to stop scanning for QR codes, close the stream, and relinquish permissions granted by the user.

(This will result in the "camera on" light on their device turning off)

Development

To create your own builds, you can use Grunt.

A gruntfile has been set up to create minified versions of html5-qrcode.js and jsqrcode-combined.js.

You will need npm (comes with node), and Grunt installed first.

Once installed, clone this repo and load the submodules by running: git submodule init then git submodule update. Then run npm install to download the node packages for Grunt.

Now, to build the minified versions just run grunt from the project directory in your terminal. If you're doing continuous development, you can run grunt watch to continuously watch javascript files in src\ and automatically build minified versions when they are modified.

MIT LICENSE

Copyright © 2013 Daniel Ward

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值