npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mutinywallet/barcode-scanner

v5.0.0-beta.3

Published

A fast and efficient (QR) barcode scanner for Capacitor

Downloads

1

Readme

Table of Contents

Maintainers

| Maintainer | GitHub | Active | | ---------- | ------------------------------------- | ------ | | thegnuu | thegnuu | yes | | tafelnl | tafelnl | no |

About

Supported barcodes

This libaray makes use of ML-Kit. This means this list of barcodes should be supported.

Note on supported Capacitor versions

v5.x supports Capacitor v5.x

v4.x supports Capacitor v4.x (not based on ML-Kit)

v3.x supports Capacitor v4.x (not based on ML-Kit)

v2.x supports Capacitor v3.x (not based on ML-Kit)

v1.x supports Capacitor v2.x (not based on ML-Kit)

All releases of this package can be found on npm and on GitHub Releases

Installation

npm install @capacitor-community/barcode-scanner
npx cap sync

iOS

For iOS you need to set a usage description in your info.plist file.

This can be done by either adding it to the Source Code directly or by using Xcode Property List inspector.

Adding it to the source code directly

  1. Open up the Info.plist (in Xcode right-click > Open As > Source Code)
  2. With <dict></dict> change the following
<dict>
+  <key>NSCameraUsageDescription</key>
+  <string>To be able to scan barcodes</string>
</dict>

NOTE: "To be able to scan barcodes" can be substituted for anything you like.

Adding it by using Xcode Property List inspector

  1. Open up the Info.plist in Xcode (right-click > Open As > Property List)
  2. Next to "Information Property List" click on the tiny + button.
  3. Under key, type "Privacy - Camera Usage Description"
  4. Under value, type "To be able to scan barcodes"

NOTE: "To be able to scan barcodes" can be substituted for anything you like.

More info here: https://developer.apple.com/documentation/bundleresources/information_property_list/nscamerausagedescription

Android

Within your AndroidManifest.xml file, change the following:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

+  <uses-permission android:name="android.permission.CAMERA" />
+  <uses-permission android:name="android.permission.VIBRATE" />

</manifest>

Usage

The complete API can be found here.

Scanning a (QR) barcode can be as simple as:

import { BarcodeScanner } from '@capacitor-community/barcode-scanner';

export class BarcodeExample {
  public async startScan() {
  await BarcodeScanner.requestPermission();
  BarcodeScanner.start({}, (result) => {
    console.log('barcode scanned', result);
  });
};
}

Opacity of the WebView

The camera view will always be rendered behind the webview. You need to make sure that your viewport is transparent to see the camera.

If you are using Ionic you need to set some css variables as well, check here

If you still cannot see the camera view, check here

Permissions

This part of the readme will soon be updated.

Troubleshooting

Ionic CSS variables

Ionic will add additional CSS variables which will prevent the scanner from showing up. To fix this issue add the following snippet at the end of your global css.

body.scanner-active {
  --background: transparent;
  --ion-background-color: transparent;
}

Once this is done, you need to add this class to the body before using the scanner.

document.querySelector('body').classList.add('scanner-active');

After your done with your scanning work, you can simply remove this class.

document.querySelector('body').classList.remove('scanner-active');

I have a Error: Plugin BarcodeScanner does not respond to method call error message on iOS

In Xcode click on Product > Clean Build Folder and try to build again.

I have a Cannot resolve symbol BarcodeScanner error message in Android Studio

In Android Studio click File > Sync Project with Gradle Files and try to build again.

The scanner view does not show up

If you cannot see the scanner in your viewport, please follow these steps:

  1. Check if camera permissions are granted properly
  2. Check if some DOM elements are rendered on top of the scanner
    • Search which element is causing the issue #7
    • Play with javascript #26

It doesn't appear

It could mean that you have missed a step by the plugin configuration.

I did the configuration correctly

please open an issue