@capgo/camera-preview 8.13.2 → 8.14.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.
- package/README.md +40 -39
- package/android/src/main/java/app/capgo/capacitor/camera/preview/CameraPreview.java +15 -0
- package/android/src/main/java/app/capgo/capacitor/camera/preview/CameraXView.java +21 -0
- package/android/src/main/java/app/capgo/capacitor/camera/preview/VideoRecordingOptions.java +53 -0
- package/android/src/main/java/app/capgo/capacitor/camera/preview/model/CameraSessionConfiguration.java +9 -0
- package/android/src/test/java/app/capgo/capacitor/camera/preview/VideoRecordingOptionsTest.java +65 -0
- package/dist/docs.json +21 -1
- package/dist/esm/definitions.d.ts +9 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +3 -0
- package/dist/esm/web.js +23 -2
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +23 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +23 -1
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapgoCameraPreviewPlugin/CameraController.swift +125 -50
- package/ios/Sources/CapgoCameraPreviewPlugin/CaptureImageExifEncoder.swift +4 -20
- package/ios/Sources/CapgoCameraPreviewPlugin/CaptureLifecycleCoordination.swift +43 -0
- package/ios/Sources/CapgoCameraPreviewPlugin/ExifGpsMetadata.swift +44 -0
- package/ios/Sources/CapgoCameraPreviewPlugin/Plugin.swift +63 -4
- package/ios/Sources/CapgoCameraPreviewPlugin/VideoRecordingOptions.swift +56 -0
- package/ios/Tests/CameraPreviewPluginTests/CaptureImageExifEncoderTests.swift +168 -0
- package/ios/Tests/CameraPreviewPluginTests/CaptureLifecycleCoordinationTests.swift +62 -0
- package/ios/Tests/CameraPreviewPluginTests/ExifGpsMetadataTests.swift +187 -0
- package/ios/Tests/CameraPreviewPluginTests/VideoRecordingOptionsTests.swift +58 -0
- package/package.json +2 -2
package/dist/plugin.js
CHANGED
|
@@ -54,6 +54,7 @@ var capacitorCapacitorCameraView = (function (exports, core) {
|
|
|
54
54
|
this.orientationListenerBound = false;
|
|
55
55
|
this.mediaRecorder = null;
|
|
56
56
|
this.recordedChunks = [];
|
|
57
|
+
this.startVideoBitrate = null;
|
|
57
58
|
this.currentAspectRatio = '4:3';
|
|
58
59
|
this.barcodeDetector = null;
|
|
59
60
|
this.barcodeScannerTimer = null;
|
|
@@ -242,6 +243,7 @@ var capacitorCapacitorCameraView = (function (exports, core) {
|
|
|
242
243
|
if (this.isStarted && options.force) {
|
|
243
244
|
await this.stop({ force: true });
|
|
244
245
|
}
|
|
246
|
+
this.startVideoBitrate = this.parseVideoBitrate(options === null || options === void 0 ? void 0 : options.videoBitrate);
|
|
245
247
|
this.isBackCamera = true;
|
|
246
248
|
this.isStarted = false;
|
|
247
249
|
const parent = document.getElementById((options === null || options === void 0 ? void 0 : options.parent) || '');
|
|
@@ -601,6 +603,20 @@ var capacitorCapacitorCameraView = (function (exports, core) {
|
|
|
601
603
|
track.stop();
|
|
602
604
|
}
|
|
603
605
|
}
|
|
606
|
+
parseVideoBitrate(value) {
|
|
607
|
+
if (value != null && Number.isFinite(value) && Number.isInteger(value) && value > 0 && value <= 0xffffffff) {
|
|
608
|
+
return value;
|
|
609
|
+
}
|
|
610
|
+
return null;
|
|
611
|
+
}
|
|
612
|
+
resolveRecordingVideoBitrate(options) {
|
|
613
|
+
var _a;
|
|
614
|
+
const perCall = this.parseVideoBitrate((_a = options === null || options === void 0 ? void 0 : options.videoBitrate) !== null && _a !== void 0 ? _a : null);
|
|
615
|
+
if (perCall != null) {
|
|
616
|
+
return perCall;
|
|
617
|
+
}
|
|
618
|
+
return this.startVideoBitrate;
|
|
619
|
+
}
|
|
604
620
|
async stop(_options) {
|
|
605
621
|
await this.stopBarcodeScanner();
|
|
606
622
|
const video = this.videoElement;
|
|
@@ -613,6 +629,7 @@ var capacitorCapacitorCameraView = (function (exports, core) {
|
|
|
613
629
|
}
|
|
614
630
|
this.videoElement = null;
|
|
615
631
|
this.isStarted = false;
|
|
632
|
+
this.startVideoBitrate = null;
|
|
616
633
|
// Remove grid overlay if it exists
|
|
617
634
|
const gridOverlay = document.getElementById('camera-grid-overlay');
|
|
618
635
|
gridOverlay === null || gridOverlay === void 0 ? void 0 : gridOverlay.remove();
|
|
@@ -851,7 +868,12 @@ var capacitorCapacitorCameraView = (function (exports, core) {
|
|
|
851
868
|
? 'video/webm;codecs=vp8'
|
|
852
869
|
: 'video/webm';
|
|
853
870
|
this.recordedChunks = [];
|
|
854
|
-
|
|
871
|
+
const recorderOptions = { mimeType };
|
|
872
|
+
const videoBitrate = this.resolveRecordingVideoBitrate(options);
|
|
873
|
+
if (videoBitrate != null) {
|
|
874
|
+
recorderOptions.videoBitsPerSecond = videoBitrate;
|
|
875
|
+
}
|
|
876
|
+
this.mediaRecorder = new MediaRecorder(stream, recorderOptions);
|
|
855
877
|
this.mediaRecorder.ondataavailable = (event) => {
|
|
856
878
|
if (event.data && event.data.size > 0) {
|
|
857
879
|
this.recordedChunks.push(event.data);
|