Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

webscan-qrcode

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webscan-qrcode

Webcam-driven QR code scanner.

  • 1.0.2
  • unpublished
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

WebScanQrcode

基于instascan的扩展扫描类库。instascan在华为设备上有问题。这里做了一些合并和改造。类库采用umd方式进行打包,所以导入方式支持多种

安装

项目依赖方式

npm i webscan-qrcode -S

外部引用方式

<script src="./dist/WebscanQrcode.bundle.js"></script>

使用

项目依赖方式

import WebscanQrcode from "webscan-qrcode";

直接引用方式

html代码:

 <video id="preview" autoplay controls="true" webkit-playsinline="true" playsinline="true"></video>

javascript:代码:

var allCameras = [];
var activeCamera = null
var scanner = new WebscanQrcode.Scanner({
    video: document.getElementById('preview'),
    scanPeriod: 5,
    mirror:false,//不用镜像模式,镜像模式类似于镜子
});
scanner.addListener('scan', function (content, image) {
    console.log({ date: +Date.now(), content: content });
});
WebscanQrcode.Camera.getCameras()
    .then(function (cameras) {
        allCameras = cameras
        activeCamera = cameras[0]
        //开始扫描的方法
        scanner.start(activeCamera,'auto')
    })
    .catch(function (e) {
        alert('error message:'+e)
        console.error(e);
    });

Keywords

FAQs

Package last updated on 01 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc