Giter Club home page Giter Club logo

angular2-qrscanner's People

Contributors

goergch avatar k-adam avatar kevstessens avatar moshmage avatar tulkaseldarion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

angular2-qrscanner's Issues

Uncaught exception in case of No camera found on device

What is this?
This behavior was, is and will be unacceptable in any case.
The script failed to handle the scenario of a system not having camera device attached to it.
The stopScanning() function attempts to blindly turn off the tracks acquired by stream without confirming if the stream is not null or undefined.

Pondering about switching the library I have been using since last few days.
Thanks for rigorous support in helping me solve the issues about the library.

Animation

How could I add the animation of the red bar that runs through the reader, something like the whatsapp reader?

Event not trigger : (onRead)="decodedOutput($event)"

OnRead event not triggering,
<qr-scanner [debug]="true" [mirror]="true" (onRead)="decodedOutput($event)"></qr-scanner>
debug,mirror and other canvas size attributes are working, but onRead not working.
In my-component.ts
`ngOnInit() {

}
decodedOutput($event: string) {
alert();
console.log('Decoded', $event);
}`

Selecting back camera on iOS and Chrome/Android does not work

The current logic to switch camera's on mobile devices works very well for Android but not for iOS. The reason is that Safari only supports the 'new' way of switching camera's on mobile devices.

I have a nice workaround that works with this library. Below is an example way of selecting another camera. The magic is inside the facingMode constraint. 'setStream' is private in the library so I'm casting to to circumvent this restriction. Sorry for this hack ;-)

I guess it would be fairly easy to integrate this logic into this library.

changeDevice(event: MatSelectChange) {
    const device = this.availableVideoDevices.filter(device => device.deviceId === event.value)[0];
    if (navigator.platform && (navigator.platform.toLowerCase().includes('ipad') || navigator.platform.toLowerCase().includes('iphone'))) {
      if (device.label.toLowerCase().includes('back')) {
        navigator.mediaDevices.getUserMedia({ audio: false, video: { facingMode: { exact: "environment" } } }).then(stream => {
          (<any>this.qrScannerComponent).setStream(stream);
        });
      } else {
        navigator.mediaDevices.getUserMedia({ audio: false, video: { facingMode: "user" }}).then(stream => {
          (<any>this.qrScannerComponent).setStream(stream);
        });
      }
    } else {
      this.qrScannerComponent.chooseCamera.next(device);
    }

Method `buildVersions` used before its declaration

Hello,
I'm trying to import QrScannerModule into my Angular-CLI app, and when I do, I get the following ERROR in /Users/Garve/projects/ticketsurge-client/node_modules/angular2-qrscanner/src/qrdecode/version.ts (173,28): Block-scoped variable 'buildVersions' used before its declaration. I haven't imported it into an Angular module yet, just imported into the file and I get this error in the build system.

Info

OS: Mac
CLI: 1.4.3
@angular/*: 4.3.1
typescript: 2.2.2
node: v8.2.1
yarn: 1.2.0

I can provide more detail if needed. Thank you!

[stopAfterScan]="false" only performs two scans

If I specify [stopAfterScan]="false" on the component and provide the default [updateTime]="500", the onRead callback only fires twice and then nothing happens. Nothing more is scanned.

I also tried various update times both> 500 and < 500 and sometimes I got one scan, sometimes two, but never more than two.

In the case of the update time being 500, I did some debugging in qrcode.js inside of the node module, and it looks like after the second scan, both the process and decode methods stop firing.

Perhaps this is a weird setTimeout issue?

Thanks!

Not working on ios

Thanks for this library.

I am trying it from a ios 11.2 safari browser. Somehow, it is not able to open the camera. Once I allow the camera, It is showing black screen.

ERROR in Error: Metadata version mismatch for module <Angular4.3-AppPath>/node_modules/angular2-qrscanner/angular2-qrscanner.d.ts, found version 4, expected 3, resolving symbol <Module_Name>in <Angular4.3-AppPath>/src/app/modules/manage/device/device.module.ts, resolving symbol <Module_Name>in <Angular4.3-AppPath>/src/app/<Module_Path>.ts

We get Metadata error which is hindering our deployments. As it does not allow ng build. Below is the configuration ; followed by full error trace.
Kindly help us.

angular2-qrscanner version: 1.0.7
Angular CLI: 1.5.0
Node: 8.10.0
OS: win32 x64
Angular: 4.3.2
... common, compiler, compiler-cli, core, forms, http
... platform-browser, platform-browser-dynamic, router

@angular/animations: 4.4.0-RC.0
@angular/cdk: 2.0.0-beta.10
@angular/cli: 1.5.0
@angular/flex-layout: 2.0.0-beta.8
@angular/material: 2.0.0-beta.10
@angular-devkit/build-optimizer: 0.0.33
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.35
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.3
typescript: 2.6.1
webpack: 3.8.1

ERROR in Error: Metadata version mismatch for module <Angular4.3-AppPath>/node_modules/angular2-qrscanner/angular2-qrscanner.d.ts, found version 4, expected 3, resolving symbol <Module_Name>in <Angular4.3-AppPath>/src/app/modules/manage/device/device.module.ts, resolving symbol <Module_Name>in <Angular4.3-AppPath>/src/app/<Module_Path>.ts
at syntaxError (<Angular4.3-AppPath>\node_modules@angular\compiler\bundles\compiler.umd.js:1725:34)
at simplifyInContext (<Angular4.3-AppPath>\node_modules@angular\compiler\bundles\compiler.umd.js:24953:23)
at StaticReflector.simplify (<Angular4.3-AppPath>\node_modules@angular\compiler\bundles\compiler.umd.js:24965:13)
at StaticReflector.annotations (<Angular4.3-AppPath>\node_modules@angular\compiler\bundles\compiler.umd.js:24395:41)
at _getNgModuleMetadata (<Angular4.3-AppPath>\node_modules@angular\compiler-cli\src\ngtools_impl.js:138:31)
at _extractLazyRoutesFromStaticModule (<Angular4.3-AppPath>\node_modules@angular\compiler-cli\src\ngtools_impl.js:109:26)
at <Angular4.3-AppPath>\node_modules@angular\compiler-cli\src\ngtools_impl.js:129:27
at Array.reduce ()
at _extractLazyRoutesFromStaticModule (<Angular4.3-AppPath>\node_modules@angular\compiler-cli\src\ngtools_impl.js:128:10)
at Object.listLazyRoutesOfModule (<Angular4.3-AppPath>\node_modules@angular\compiler-cli\src\ngtools_impl.js:53:22)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (<Angular4.3-AppPath>\node_modules@angular\compiler-cli\src\ngtools_api.js:91:39)
at AotPlugin._getLazyRoutesFromNgtools (<Angular4.3-AppPath>\node_modules@ngtools\webpack\src\plugin.js:241:66)
at _donePromise.Promise.resolve.then.then.then.then.then (<Angular4.3-AppPath>\node_modules@ngtools\webpack\src\plugin.js:495:24)
at
at process._tickCallback (internal/process/next_tick.js:188:7)

webpack: Failed to compile.

can't build with prod or aot flag ... Compatibility flaw with Angular 5

Hello Everyone,

since i've updated to Angular 5, when i get to build with --aot or --prod flag i get this error :

ERROR in ./node_modules/angular2-qrscanner/src/qrscanner.component.ngfactory.ts
Module build failed: Error: D:\Workplace\dancematik\node_modules\angular2-qrscanner\src\qrscanner.component.ngfactory.ts is missing from the TypeScript compilation. Please make sure
it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).
at AngularCompilerPlugin.getCompiledFile (D:\Workplace\dancematik\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:662:23)
at plugin.done.then (D:\Workplace\dancematik\node_modules@ngtools\webpack\src\loader.js:467:39)
at
@ ./src/app/leggiticket/leggiticket.component.ngfactory.js 8:0-97
@ ./src/app/app.module.ngfactory.js
@ ./src/main.ts
@ multi ./src/main.ts

As far as you know... there is some issue with this component and Angular 5 ?

i've tried also the vNext branch... but i get the same issue...

angular2-qrscanner is not asking for permission to use camera

This is my package.json

  "name": "ara.web-app",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@amcharts/amcharts3-angular": "^1.5.0",
    "@angular/animations": "^5.2.11",
    "@angular/common": "^5.2.11",
    "@angular/compiler": "^5.2.11",
    "@angular/core": "^5.2.11",
    "@angular/forms": "^5.2.11",
    "@angular/http": "^5.2.11",
    "@angular/platform-browser": "^5.2.11",
    "@angular/platform-browser-dynamic": "^5.2.11",
    "@angular/router": "^5.2.11",
    "@angular/service-worker": "^5.2.11",
    "@ngx-translate/core": "^9.1.1",
    "@ngx-translate/http-loader": "^3.0.1",
    "adal-angular": "=1.0.15",
    "adal-angular4": "^2.0.13",
    "ang-jsoneditor": "^1.8.4",
    "angular2-csv": "^0.2.5",
    "angular2-qrscanner": "^1.0.7",
    "bootstrap": "^3.4.1",
    "core-js": "^2.6.10",
    "expose-loader": "^0.7.5",
    "file-saver": "^2.0.2",
    "font-awesome": "^4.7.0",
    "jquery": "^3.4.1",
    "jsoneditor": "^8.0.0",
    "jspdf": "^1.4.1",
    "jszip": "^3.2.2",
    "moment": "^2.24.0",
    "moment-timezone": "^0.5.27",
    "ng-click-outside": "^3.2.0",
    "ng2-pagination": "^2.0.2",
    "ng2-people-picker": "^1.2.0",
    "ngx-lightbox": "^1.2.0",
    "ngx-pagination": "^3.3.1",
    "ngx-popover": "0.0.16",
    "ngx-translate-multi-http-loader": "^3.0.0",
    "popper.js": "^1.16.0",
    "primeng": "^5.2.7",
    "rxjs": "^5.5.12",
    "xlsx": "^0.13.1",
    "zone.js": "^0.8.29"
  },
  "devDependencies": {
    "@angular/cli": "^1.7.4",
    "@angular/compiler-cli": "^5.2.11",
    "@angular/language-service": "^5.2.11",
    "@types/jasmine": "^2.8.16",
    "@types/jasminewd2": "^2.0.8",
    "@types/node": "^6.0.118",
    "codelyzer": "^4.5.0",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^2.0.5",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^1.4.3",
    "karma-jasmine": "^1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "~2.5.3"
  }
}```

It was working earlier, but after some changes in application it stopped asking for permission.

Works in development, errors when built with webpack using AOT for production with universal

This angular2-qrscanner works great when running in development via localhost, but when I build and deploy for production I get the following line in the console log:

"QR Scanner init, facing undefined"

followed by error:

"vendor.js:8 ERROR TypeError: Cannot read property 'style' of null
at t.initCanvas..

I am using angular 4 with universal for Server Side Rendering.

I've tried excluding angular2-qrscanner from tree-shaking, tried gating with <div *ngIf="isBrowser"> tags, tried moving the imports from main app.module to the app.module.browser, but none of this seems to work.

Anyone have any ideas?

Error: Cannot find module '@angular-devkit/core'

Hi,

A mere few minutes ago, I downloaded this package but this error was showed.

Another question: inside the 'dist' folder, I didn't see any index.html; how should I run this project at a public server?

Best regards.

Errors after upgrading to v1.0.1

Hi!

First of all, thank you for this great library.

After upgrading to v1.0.1 I'm getting errors:

Error: Metadata version mismatch for module C:/my-demo-app/node_modules/angular2-qrscanner/angular2-qrscanner.d.ts, found version 4, expected 3

I think it's because of the use of Angular 5. Is there any way to get it back to Angular 4?

Not supported with Angular 9 ? ( Ivy )

ERROR in node_modules/angular2-qrscanner/qr-scanner.module.d.ts:2:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (angular2-qrscanner) which declares NgQrScannerModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

2 export declare class NgQrScannerModule {

Any fast solution please ?

cant use with angular2

I am using angular2. when I import modules and run ng build then ng serve getting error saying

@angular/core/index"' has no exported member 'Renderer2'

I googled and came to know Renderer2 is in angular4.

any workaround to get this working?

Thanks In advance

Error in metadata version mismatch

I'm using this module for an angular 4 application,
'angular/cli: 1.3.2'
'angular/compiler-cli: 4.3.6 '
The module is working fine unless I do a AOT build, and exactly as a result of AOT build, the build fails with an error "metadata version mismatch for module angular2-qrscanner found version 4, expected 3". Seems like, the module was built with angular 5+ as it introduced the metadata version 4.
Please assist in this scenario or at least suggest the lower version to which I can safely downgrade the module to without breaking my functionality.

Functionality

Hi, this is not an issue but I don't know other way to ask questions

I'm new on Angular 2, maybe it's a stupid question, but I'm trying to import the 'QrScannerComponent' doing:

import * as qr from 'angular2-qrscanner\src\qrscanner.component'
OR
import * as qr from 'angular2-qrscanner\dist\src\qrscanner.component'

with both, my code doesn't show errors, but when I test in browser, it says that can't find the 'qrscanner.component.js', so I tried importing from 'angular2-qrscanner\src\qrscanner.component.js' and get another Not found error, that would require to update the library.

I think I'm missing something on the importation, but I can't find any suggestion that works.

I hope that make sense, english is not my native language

Thanks

Issue with production builds in angular

I'm getting this error below when trying to compile in production mode, using the npm published version (which seems go come from fork?)

ERROR in d:/a/1/s/src/$$_gendir/node_modules/angular2-qrscanner/src/qrscanner.component.ngfactory.ts (62,31): Property 'supported' is private and only accessible within class 'QrScannerComponent'.

I found that I could make this public and get around the issue locally, but if using a build server it's going to need to this property changed in the source.

Importing ?

Hey guys,
Can you give pointers regarding how we use the package ?
I suppose we need to import something ...

Thanks ! :-)

facingMode allways "environment"

The input property "facing" is never used. The facingMode is hardcoded to "environment" in qrscanner.component.ts line 164:
options={'deviceId': {'exact':device.deviceId}, 'facingMode':'environment'} ;

canvasWidth and canvasHeight don't work

I can adjust width and height via canvasWidth and canvasHeight. I am using it in Chrome Version 61.0.3163.79 (Official Build) (64-bit) and @angular/cli: 1.4.2

Does it work for anyone?

only scans once?

So, I get the subscription from onRead but then the scanner stops and I can't re-initialize it via Viewchild.load() (it initializes, but it doesn't start the scanner for some reason)

destroy produces error if no video device available

If you have no video device the function "stopScanning" called in ngOnDestroy produces an error at line 44:
this.stream.getTracks()[0].stop();

Testing if this.stream and if this.stream.getTracks() exists should prevent these errors.

Fresh install of component doesn't work

I try the component but it's seem that something is wrong when try to read variable : "reader.DataByte" in qrcode.js

Tested in :
Desktop ( HP Envy )
Chrome Browser

Application show correctly the image from camera and when QR appear into video it did something.... but it's seem that it is not able to read "reader.DataByte"

i did the following step :

  1. Just create a fresh Angular project with NG NEW qrcode
  2. install component : npm install angular2-qrscanner --save
  3. Edited App.module.ts as following :
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { QrScannerModule } from 'angular2-qrscanner';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    QrScannerModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

  • Edited app.component.html as following :
<!--The whole content below can be removed with the new code.-->
<div style="text-align:center">
  <qr-scanner [debug]="true" (onRead)="decodedOutput($event)"></qr-scanner>

</div>

  • Edited app.component.ts as following :
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'app';


decodedOutput(Evento) {

  console.log('Ho fatto qualcosa ') ;
  console.log(Evento) ;
}

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.