Get started with instascan CDN

MIT licensed

Instascan is a library for real-time QR and barcode scanning in the browser using the users webcam.

Tags:
  • qr
  • code
  • quick
  • response
  • scan
  • scanner
  • webcam
  • realtime

Stable version

Copied!

How to start using instascan CDN


// Include Instascan library from CDN
const Instascan = require('https://cdn.cdnhub.io/instascan/1.0.0/instascan.min.js');

// Create a new Instascan scanner object
const scanner = new Instascan.Scanner({
  video: document.getElementById('preview'), // Replace with your video element ID
  scanInterval: 1000, // Set scan interval in milliseconds
});

// Set up a callback function for when a code is scanned
scanner.scan(function (data) {
  if (data) {
    console.log('Scanned code:', data.codeString);
  }
});

// Start scanning
scanner.start();
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions