ngx-scandoc 15.1.8 → 15.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -128,7 +128,8 @@ class BaseComponent {
128
128
  }
129
129
 
130
130
  class NgxScandocCameraProvider {
131
- constructor() {
131
+ constructor(platform) {
132
+ this.platform = platform;
132
133
  this.selfie$ = new Subject();
133
134
  this.rectPosition = {
134
135
  l: 0,
@@ -160,9 +161,12 @@ class NgxScandocCameraProvider {
160
161
  }
161
162
  preloadVideo() {
162
163
  return from(navigator.mediaDevices.getUserMedia({ video: true })).pipe(map((mediaStream) => {
163
- mediaStream.getTracks().forEach((track) => {
164
- track.stop();
165
- });
164
+ console.warn(mediaStream);
165
+ if (!this.platform.FIREFOX) {
166
+ mediaStream.getTracks().forEach((track) => {
167
+ track.stop();
168
+ });
169
+ }
166
170
  }));
167
171
  }
168
172
  setup() {
@@ -196,14 +200,14 @@ class NgxScandocCameraProvider {
196
200
  return this.switchCamera.asObservable();
197
201
  }
198
202
  }
199
- NgxScandocCameraProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocCameraProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
203
+ NgxScandocCameraProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocCameraProvider, deps: [{ token: i2.Platform }], target: i0.ɵɵFactoryTarget.Injectable });
200
204
  NgxScandocCameraProvider.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocCameraProvider, providedIn: 'root' });
201
205
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocCameraProvider, decorators: [{
202
206
  type: Injectable,
203
207
  args: [{
204
208
  providedIn: 'root',
205
209
  }]
206
- }], ctorParameters: function () { return []; } });
210
+ }], ctorParameters: function () { return [{ type: i2.Platform }]; } });
207
211
 
208
212
  class WebcamComponent extends BaseComponent {
209
213
  onResize() {
@@ -334,6 +338,10 @@ class WebcamComponent extends BaseComponent {
334
338
  //console.warn(t.getConstraints());
335
339
  if (!this.isMobile) {
336
340
  try {
341
+ if (!t.getCapabilities) {
342
+ this.setDeviceId(stream);
343
+ return;
344
+ }
337
345
  const settings = t.getSettings();
338
346
  const cap = t.getCapabilities();
339
347
  const con = t.getConstraints();
@@ -579,13 +587,19 @@ class WebcamComponent extends BaseComponent {
579
587
  if (this.mediaStream && this.mediaStream.getTracks) {
580
588
  // getTracks() returns all media tracks (video+audio)
581
589
  this.mediaStream.getTracks().forEach((track) => {
590
+ // console.log(track);
591
+ track.enabled = false;
592
+ this.cd.detectChanges();
582
593
  track.stop();
583
594
  this.video.srcObject.removeTrack(track);
584
595
  this.mediaStream.removeTrack(track);
596
+ this.cd.detectChanges();
585
597
  });
586
598
  this.video.srcObject = null;
599
+ // this.video.src = null;
587
600
  this.video.load();
588
601
  }
602
+ // this.__subs(this.stopVideoTracks()).subscribe()
589
603
  }
590
604
  drawRectangle() {
591
605
  this.zone.run(() => {
@@ -745,7 +759,7 @@ class ScanProvider {
745
759
  this.injector = injector;
746
760
  // enableVerification = true;
747
761
  this.config = this.injector.get(SCAN_CONFIG_TOKEN);
748
- this.canStoreImages = this.config.development;
762
+ this.canStoreImages = this.config.canStoreImages;
749
763
  }
750
764
  genderList() {
751
765
  return {
@@ -3022,7 +3036,7 @@ class ScanComponent extends BaseComponent {
3022
3036
  }
3023
3037
  use() {
3024
3038
  // save images??
3025
- if (this.scanProvider.canStoreImages) {
3039
+ if (this.scanProvider.config.sendLog) {
3026
3040
  this.logData.ExpectedOutput = JSON.parse(JSON.stringify(this.model));
3027
3041
  if (this.logData.ExpectedOutput?._avatar) {
3028
3042
  delete this.logData.ExpectedOutput._avatar;