MCPcopy Index your code
hub / github.com/mebjas/html5-qrcode

github.com/mebjas/html5-qrcode @v2.3.8 sqlite

repository ↗ · DeepWiki ↗ · release v2.3.8 ↗
3,581 symbols 8,513 edges 40 files 608 documented · 17% 2 cross-repo links
README

Html5-QRCode

Lightweight & cross platform QR Code and Bar code scanning library for the web

Use this lightweight library to easily / quickly integrate QR code, bar code, and other common code scanning capabilities to your web application.

Key highlights

Supports two kinds of APIs

  • Html5QrcodeScanner — End-to-end scanner with UI, integrate with less than ten lines of code.

  • Html5Qrcode — Powerful set of APIs you can use to build your UI without worrying about camera setup, handling permissions, reading codes, etc.

Support for scanning local files on the device is a new addition and helpful for the web browser which does not support inline web-camera access in smartphones. Note: This doesn't upload files to any server — everything is done locally.

CircleCI GitHub issues GitHub tag (latest by date) GitHub Codacy Badge Gitter

GitHub all releases npm

Demo at scanapp.org Demo at qrcode.minhazav.dev - Scanning different types of codes

We need your help!

image Help incentivise feature development, bug fixing by supporting the sponsorhip goals of this project. See list of sponsered feature requests here.

ko-fi

Documentation

The documentation for this project has been moved to scanapp.org/html5-qrcode-docs.

Supported platforms

We are working continuously on adding support for more and more platforms. If you find a platform or a browser where the library is not working, please feel free to file an issue. Check the demo link to test it out.

Legends - Means full support — inline webcam and file based - Means partial support — only file based, webcam in progress

PC / Mac

| Firefox

Firefox | Chrome

Chrome | Safari

Safari | Opera

Opera | Edge

Edge | --------- | --------- | --------- | --------- | ------- | || | | |

Android

| Chrome

Chrome | Firefox

Firefox | Edge

Edge | Opera

Opera | Opera-Mini

Opera Mini | UC

UC | --------- | --------- | --------- | --------- | --------- | --------- | || | | | |

IOS

| Safari

Safari | Chrome

Chrome | Firefox

Firefox | Edge

Edge | --------- | --------- | --------- | --------- | || | |

* Supported for IOS versions >= 15.1

Before version 15.1, Webkit for IOS is used by Chrome, Firefox, and other browsers in IOS and they do not have webcam permissions yet. There is an ongoing issue on fixing the support for iOS - issue/14

Framework support

The library can be easily used with several other frameworks, I have been adding examples for a few of them and would continue to add more.

Html5 VueJs ElectronJs React Lit

Supported Code formats

Code scanning is dependent on Zxing-js library. We will be working on top of it to add support for more types of code scanning. If you feel a certain type of code would be helpful to have, please file a feature request.

Code Example
QR Code
AZTEC
CODE_39
CODE_93
CODE_128
ITF
EAN_13
EAN_8
PDF_417
UPC_A
UPC_E
DATA_MATRIX
MAXICODE*
RSS_14*
RSS_EXPANDED*

*Formats are not supported by our experimental integration with native BarcodeDetector API integration (Read more).

Description - View Demo

See an end to end scanner experience at scanapp.org.

This is a cross-platform JavaScript library to integrate QR code, bar codes & a few other types of code scanning capabilities to your applications running on HTML5 compatible browser.

Supports: - Querying camera on the device (with user permissions) - Rendering live camera feed, with easy to use user interface for scanning - Supports scanning a different kind of QR codes, bar codes and other formats - Supports selecting image files from the device for scanning codes

How to use

Find detailed guidelines on how to use this library on scanapp.org/html5-qrcode-docs.

Demo

Scan this image or visit blog.minhazav.dev/research/html5-qrcode.html

For more information

Check these articles on how to use this library:

Screenshots

screenshot

Figure: Screenshot from Google Chrome running on MacBook Pro

Documentation

Find the full API documentation at scanapp.org/html5-qrcode-docs/docs/apis.

Extra optional configuration in start() method

Configuration object that can be used to configure both the scanning behavior and the user interface (UI). Most of the fields have default properties that will be used unless a different value is provided. If you do not want to override anything, you can just pass in an empty object {}.

fps — Integer, Example = 10

A.K.A frame per second, the default value for this is 2, but it can be increased to get faster scanning. Increasing too high value could affect performance. Value >1000 will simply fail.

qrboxQrDimensions or QrDimensionFunction (Optional), Example = { width: 250, height: 250 }

Use this property to limit the region of the viewfinder you want to use for scanning. The rest of the viewfinder would be shaded. For example, by passing config { qrbox : { width: 250, height: 250 } }, the screen will look like:

This can be used to set a rectangular scanning area with config like:

let config = { qrbox : { width: 400, height: 150 } }

This config also accepts a function of type

/**
  * A function that takes in the width and height of the video stream 
* and returns QrDimensions.
* 
* Viewfinder refers to the video showing camera stream.
*/
type QrDimensionFunction =
    (viewfinderWidth: number, viewfinderHeight: number) => QrDimensions;

This allows y

Extension points exported contracts — how you extend this code

Camera (Interface)
(no doc) [7 implementers]
src/camera/core.ts
QrcodeDecoderAsync (Interface)
(no doc) [5 implementers]
src/core.ts
TorchButtonController (Interface)
Interface for controlling torch button. [2 implementers]
src/ui/scanner/torch-button.ts
StateManager (Interface)
(no doc) [3 implementers]
src/state-manager.ts
PersistedData (Interface)
* @fileoverview * Core storage related APIs. * * @author mebjas * * The word "QR Code" is re
src/storage.ts
BarcodeDetectorConfig (Interface)
Config for BarcodeDetector API.
src/native-bar-code-detector.ts
QrcodeRegionBounds (Interface)
@hidden
src/html5-qrcode.ts
ExperimentalFeaturesConfig (Interface)
(no doc)
src/experimental-features.ts

Core symbols most depended-on inside this repo

get
called by 163
third_party/zxing-js.umd.js
append
called by 139
third_party/zxing-js.umd.js
getY
called by 113
third_party/zxing-js.umd.js
getX
called by 109
third_party/zxing-js.umd.js
createElement
called by 98
src/ui/scanner/base.ts
getSize
called by 74
third_party/zxing-js.umd.js
max
called by 64
src/camera/core.ts
getHeight
called by 63
third_party/zxing-js.umd.js

Shape

Method 2,683
Class 799
Function 58
Interface 33
Enum 8

Languages

TypeScript100%

Modules by API surface

third_party/zxing-js.umd.js1,551 symbols
minified/html5-qrcode.min.js1,539 symbols
src/html5-qrcode.ts56 symbols
src/html5-qrcode-scanner.ts52 symbols
src/camera/core-impl.ts46 symbols
src/strings.ts45 symbols
src/core.ts43 symbols
src/state-manager.ts31 symbols
src/camera/core.ts27 symbols
src/ui/scanner/torch-button.ts26 symbols
src/ui.ts17 symbols
src/ui/scanner/file-selection-ui.ts15 symbols

Used by 2 indexed graphs manifest dependencies, hub-wide

Dependencies from manifests, versioned

@babel/cli7.10.5 · 1×
@babel/core7.11.4 · 1×
@babel/plugin-proposal-class-properties7.10.4 · 1×
@babel/preset-env7.11.0 · 1×
@types/chai4.3.0 · 1×
@types/mocha9.0.0 · 1×
babel-minify0.5.1 · 1×
chai4.3.4 · 1×
docusaurus-plugin-typedoc0.18.0 · 1×
expose-loader2.0.0 · 1×
jsdom20.0.2 · 1×
jsdom-global3.0.2 · 1×

For agents

$ claude mcp add html5-qrcode \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact