ngx-scandoc 15.1.8 → 15.1.9
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.
- package/esm2020/core/components/webcam/webcam/webcam.component.mjs +11 -1
- package/esm2020/providers/camera.provider.mjs +12 -7
- package/fesm2015/ngx-scandoc.mjs +20 -6
- package/fesm2015/ngx-scandoc.mjs.map +1 -1
- package/fesm2020/ngx-scandoc.mjs +20 -6
- package/fesm2020/ngx-scandoc.mjs.map +1 -1
- package/package.json +1 -1
- package/providers/camera.provider.d.ts +3 -1
package/fesm2020/ngx-scandoc.mjs
CHANGED
|
@@ -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
|
-
|
|
164
|
-
|
|
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(() => {
|