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

screw-scan-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

screw-scan-qrcode

Webcam-driven QR code scanner.

  • 1.0.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ScrewScanQrcode

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

安装

项目依赖方式

npm i screw-scan-qrcode -S

或者

yarn add screw-scan-qrcode -S

或者

pnpm add screw-scan-qrcode -S

外部引用方式

<script src="./dist/ScrewScanQrcode.js"></script>

使用

项目依赖方式

import ScrewScanQrcode from "screw-scan-qrcode"

直接引用方式

<script src="./dist/ScrewScanQrcode.js"></script>

demo

html 代码:

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

javascript:代码:


var allCameras = []
var activeCamera = null

var scanner = new ScrewScanQrcode.Scanner({
  video: document.getElementById("preview"),
  scanPeriod: 5,
  mirror: false, //不用镜像模式,镜像模式类似于镜子
})

scanner.addListener("scan", function (content, image) {
  console.log({ date: +Date.now(), content: content })
})

ScrewScanQrcode.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 24 Apr 2022

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