@capgo/camera-preview 7.4.0-alpha.3 → 7.4.0-alpha.32
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 +179 -12
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraPreview.java +585 -11
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraXView.java +994 -423
- package/dist/docs.json +312 -11
- package/dist/esm/definitions.d.ts +115 -11
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +24 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +16 -1
- package/dist/esm/web.js +82 -5
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +105 -5
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +105 -5
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapgoCameraPreviewPlugin/CameraController.swift +143 -34
- package/ios/Sources/CapgoCameraPreviewPlugin/Plugin.swift +486 -132
- package/package.json +10 -2
package/dist/docs.json
CHANGED
|
@@ -161,7 +161,11 @@
|
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
163
|
"name": "since",
|
|
164
|
-
"text": "7.
|
|
164
|
+
"text": "7.5.0"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "platform",
|
|
168
|
+
"text": "android, ios"
|
|
165
169
|
}
|
|
166
170
|
],
|
|
167
171
|
"docs": "Set the aspect ratio of the camera preview.",
|
|
@@ -180,7 +184,11 @@
|
|
|
180
184
|
},
|
|
181
185
|
{
|
|
182
186
|
"name": "since",
|
|
183
|
-
"text": "7.
|
|
187
|
+
"text": "7.5.0"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"name": "platform",
|
|
191
|
+
"text": "android, ios"
|
|
184
192
|
}
|
|
185
193
|
],
|
|
186
194
|
"docs": "Gets the current aspect ratio of the camera preview.",
|
|
@@ -422,7 +430,11 @@
|
|
|
422
430
|
},
|
|
423
431
|
{
|
|
424
432
|
"name": "since",
|
|
425
|
-
"text": "7.
|
|
433
|
+
"text": "7.5.0"
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
"name": "platform",
|
|
437
|
+
"text": "android, ios"
|
|
426
438
|
}
|
|
427
439
|
],
|
|
428
440
|
"docs": "Checks if the camera preview is currently running.",
|
|
@@ -441,7 +453,11 @@
|
|
|
441
453
|
},
|
|
442
454
|
{
|
|
443
455
|
"name": "since",
|
|
444
|
-
"text": "7.
|
|
456
|
+
"text": "7.5.0"
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
"name": "platform",
|
|
460
|
+
"text": "android, ios"
|
|
445
461
|
}
|
|
446
462
|
],
|
|
447
463
|
"docs": "Gets all available camera devices.",
|
|
@@ -462,7 +478,11 @@
|
|
|
462
478
|
},
|
|
463
479
|
{
|
|
464
480
|
"name": "since",
|
|
465
|
-
"text": "7.
|
|
481
|
+
"text": "7.5.0"
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
"name": "platform",
|
|
485
|
+
"text": "android, ios"
|
|
466
486
|
}
|
|
467
487
|
],
|
|
468
488
|
"docs": "Gets the current zoom state, including min/max and current lens info.",
|
|
@@ -471,6 +491,25 @@
|
|
|
471
491
|
],
|
|
472
492
|
"slug": "getzoom"
|
|
473
493
|
},
|
|
494
|
+
{
|
|
495
|
+
"name": "getZoomButtonValues",
|
|
496
|
+
"signature": "() => Promise<{ values: number[]; }>",
|
|
497
|
+
"parameters": [],
|
|
498
|
+
"returns": "Promise<{ values: number[]; }>",
|
|
499
|
+
"tags": [
|
|
500
|
+
{
|
|
501
|
+
"name": "since",
|
|
502
|
+
"text": "7.5.0"
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
"name": "platform",
|
|
506
|
+
"text": "android, ios"
|
|
507
|
+
}
|
|
508
|
+
],
|
|
509
|
+
"docs": "Returns zoom button values for quick switching.\n- iOS/Android: includes 0.5 if ultra-wide available; 1 and 2 if wide available; 3 if telephoto available\n- Web: unsupported",
|
|
510
|
+
"complexTypes": [],
|
|
511
|
+
"slug": "getzoombuttonvalues"
|
|
512
|
+
},
|
|
474
513
|
{
|
|
475
514
|
"name": "setZoom",
|
|
476
515
|
"signature": "(options: { level: number; ramp?: boolean; autoFocus?: boolean; }) => Promise<void>",
|
|
@@ -493,7 +532,11 @@
|
|
|
493
532
|
},
|
|
494
533
|
{
|
|
495
534
|
"name": "since",
|
|
496
|
-
"text": "7.
|
|
535
|
+
"text": "7.5.0"
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
"name": "platform",
|
|
539
|
+
"text": "android, ios"
|
|
497
540
|
}
|
|
498
541
|
],
|
|
499
542
|
"docs": "Sets the zoom level of the camera.",
|
|
@@ -512,7 +555,11 @@
|
|
|
512
555
|
},
|
|
513
556
|
{
|
|
514
557
|
"name": "since",
|
|
515
|
-
"text": "7.
|
|
558
|
+
"text": "7.5.0"
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
"name": "platform",
|
|
562
|
+
"text": "android, ios"
|
|
516
563
|
}
|
|
517
564
|
],
|
|
518
565
|
"docs": "Gets the current flash mode.",
|
|
@@ -529,7 +576,11 @@
|
|
|
529
576
|
"tags": [
|
|
530
577
|
{
|
|
531
578
|
"name": "since",
|
|
532
|
-
"text": "7.
|
|
579
|
+
"text": "7.5.0"
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
"name": "platform",
|
|
583
|
+
"text": "android, ios"
|
|
533
584
|
}
|
|
534
585
|
],
|
|
535
586
|
"docs": "Removes all registered listeners.",
|
|
@@ -558,7 +609,11 @@
|
|
|
558
609
|
},
|
|
559
610
|
{
|
|
560
611
|
"name": "since",
|
|
561
|
-
"text": "7.
|
|
612
|
+
"text": "7.5.0"
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
"name": "platform",
|
|
616
|
+
"text": "android, ios"
|
|
562
617
|
}
|
|
563
618
|
],
|
|
564
619
|
"docs": "Switches the active camera to the one with the specified `deviceId`.",
|
|
@@ -577,7 +632,11 @@
|
|
|
577
632
|
},
|
|
578
633
|
{
|
|
579
634
|
"name": "since",
|
|
580
|
-
"text": "7.
|
|
635
|
+
"text": "7.5.0"
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
"name": "platform",
|
|
639
|
+
"text": "android, ios"
|
|
581
640
|
}
|
|
582
641
|
],
|
|
583
642
|
"docs": "Gets the ID of the currently active camera device.",
|
|
@@ -592,6 +651,14 @@
|
|
|
592
651
|
"tags": [
|
|
593
652
|
{
|
|
594
653
|
"name": "returns"
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
"name": "since",
|
|
657
|
+
"text": "7.5.0"
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
"name": "platform",
|
|
661
|
+
"text": "android, ios"
|
|
595
662
|
}
|
|
596
663
|
],
|
|
597
664
|
"docs": "Gets the current preview size and position.",
|
|
@@ -617,6 +684,14 @@
|
|
|
617
684
|
{
|
|
618
685
|
"name": "returns",
|
|
619
686
|
"text": "A promise that resolves with the actual preview dimensions and position."
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
"name": "since",
|
|
690
|
+
"text": "7.5.0"
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
"name": "platform",
|
|
694
|
+
"text": "android, ios"
|
|
620
695
|
}
|
|
621
696
|
],
|
|
622
697
|
"docs": "Sets the preview size and position.",
|
|
@@ -645,12 +720,168 @@
|
|
|
645
720
|
},
|
|
646
721
|
{
|
|
647
722
|
"name": "since",
|
|
648
|
-
"text": "
|
|
723
|
+
"text": "7.5.0"
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
"name": "platform",
|
|
727
|
+
"text": "android, ios"
|
|
649
728
|
}
|
|
650
729
|
],
|
|
651
730
|
"docs": "Sets the camera focus to a specific point in the preview.",
|
|
652
731
|
"complexTypes": [],
|
|
653
732
|
"slug": "setfocus"
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
"name": "addListener",
|
|
736
|
+
"signature": "(eventName: \"screenResize\", listenerFunc: (data: { width: number; height: number; x: number; y: number; }) => void) => Promise<PluginListenerHandle>",
|
|
737
|
+
"parameters": [
|
|
738
|
+
{
|
|
739
|
+
"name": "eventName",
|
|
740
|
+
"docs": "- The event name to listen for.",
|
|
741
|
+
"type": "'screenResize'"
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
"name": "listenerFunc",
|
|
745
|
+
"docs": "- The function to call when the event is triggered.",
|
|
746
|
+
"type": "(data: { width: number; height: number; x: number; y: number; }) => void"
|
|
747
|
+
}
|
|
748
|
+
],
|
|
749
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
750
|
+
"tags": [
|
|
751
|
+
{
|
|
752
|
+
"name": "param",
|
|
753
|
+
"text": "eventName - The event name to listen for."
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
"name": "param",
|
|
757
|
+
"text": "listenerFunc - The function to call when the event is triggered."
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
"name": "returns",
|
|
761
|
+
"text": "A promise that resolves with a handle to the listener."
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
"name": "since",
|
|
765
|
+
"text": "7.5.0"
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
"name": "platform",
|
|
769
|
+
"text": "android, ios"
|
|
770
|
+
}
|
|
771
|
+
],
|
|
772
|
+
"docs": "Adds a listener for screen resize events.",
|
|
773
|
+
"complexTypes": [
|
|
774
|
+
"PluginListenerHandle"
|
|
775
|
+
],
|
|
776
|
+
"slug": "addlistenerscreenresize-"
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
"name": "addListener",
|
|
780
|
+
"signature": "(eventName: \"orientationChange\", listenerFunc: (data: { orientation: DeviceOrientation; }) => void) => Promise<PluginListenerHandle>",
|
|
781
|
+
"parameters": [
|
|
782
|
+
{
|
|
783
|
+
"name": "eventName",
|
|
784
|
+
"docs": "- The event name to listen for.",
|
|
785
|
+
"type": "'orientationChange'"
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
"name": "listenerFunc",
|
|
789
|
+
"docs": "- The function to call when the event is triggered.",
|
|
790
|
+
"type": "(data: { orientation: DeviceOrientation; }) => void"
|
|
791
|
+
}
|
|
792
|
+
],
|
|
793
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
794
|
+
"tags": [
|
|
795
|
+
{
|
|
796
|
+
"name": "param",
|
|
797
|
+
"text": "eventName - The event name to listen for."
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
"name": "param",
|
|
801
|
+
"text": "listenerFunc - The function to call when the event is triggered."
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
"name": "returns",
|
|
805
|
+
"text": "A promise that resolves with a handle to the listener."
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
"name": "since",
|
|
809
|
+
"text": "7.5.0"
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
"name": "platform",
|
|
813
|
+
"text": "android, ios"
|
|
814
|
+
}
|
|
815
|
+
],
|
|
816
|
+
"docs": "Adds a listener for orientation change events.",
|
|
817
|
+
"complexTypes": [
|
|
818
|
+
"PluginListenerHandle",
|
|
819
|
+
"DeviceOrientation"
|
|
820
|
+
],
|
|
821
|
+
"slug": "addlistenerorientationchange-"
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
"name": "deleteFile",
|
|
825
|
+
"signature": "(options: { path: string; }) => Promise<{ success: boolean; }>",
|
|
826
|
+
"parameters": [
|
|
827
|
+
{
|
|
828
|
+
"name": "options",
|
|
829
|
+
"docs": "",
|
|
830
|
+
"type": "{ path: string; }"
|
|
831
|
+
}
|
|
832
|
+
],
|
|
833
|
+
"returns": "Promise<{ success: boolean; }>",
|
|
834
|
+
"tags": [
|
|
835
|
+
{
|
|
836
|
+
"name": "since",
|
|
837
|
+
"text": "7.5.0"
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
"name": "platform",
|
|
841
|
+
"text": "android, ios"
|
|
842
|
+
}
|
|
843
|
+
],
|
|
844
|
+
"docs": "Deletes a file at the given absolute path on the device.\nUse this to quickly clean up temporary images created with `storeToFile`.\nOn web, this is not supported and will throw.",
|
|
845
|
+
"complexTypes": [],
|
|
846
|
+
"slug": "deletefile"
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
"name": "getSafeAreaInsets",
|
|
850
|
+
"signature": "() => Promise<SafeAreaInsets>",
|
|
851
|
+
"parameters": [],
|
|
852
|
+
"returns": "Promise<SafeAreaInsets>",
|
|
853
|
+
"tags": [
|
|
854
|
+
{
|
|
855
|
+
"name": "platform",
|
|
856
|
+
"text": "android, ios"
|
|
857
|
+
}
|
|
858
|
+
],
|
|
859
|
+
"docs": "Gets the safe area insets for devices.\nReturns the orientation-aware notch/camera cutout inset and the current orientation.\nIn portrait mode: returns top inset (notch at top).\nIn landscape mode: returns left inset (notch moved to side).\nThis specifically targets the cutout area (notch, punch hole, etc.) that all modern phones have.\n\nAndroid: Values returned in dp (logical pixels).\niOS: Values returned in physical pixels, excluding status bar (only pure notch/cutout size).",
|
|
860
|
+
"complexTypes": [
|
|
861
|
+
"SafeAreaInsets"
|
|
862
|
+
],
|
|
863
|
+
"slug": "getsafeareainsets"
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
"name": "getOrientation",
|
|
867
|
+
"signature": "() => Promise<{ orientation: DeviceOrientation; }>",
|
|
868
|
+
"parameters": [],
|
|
869
|
+
"returns": "Promise<{ orientation: DeviceOrientation; }>",
|
|
870
|
+
"tags": [
|
|
871
|
+
{
|
|
872
|
+
"name": "since",
|
|
873
|
+
"text": "7.5.0"
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
"name": "platform",
|
|
877
|
+
"text": "android, ios"
|
|
878
|
+
}
|
|
879
|
+
],
|
|
880
|
+
"docs": "Gets the current device orientation in a cross-platform format.",
|
|
881
|
+
"complexTypes": [
|
|
882
|
+
"DeviceOrientation"
|
|
883
|
+
],
|
|
884
|
+
"slug": "getorientation"
|
|
654
885
|
}
|
|
655
886
|
],
|
|
656
887
|
"properties": []
|
|
@@ -1357,6 +1588,45 @@
|
|
|
1357
1588
|
"type": "number"
|
|
1358
1589
|
}
|
|
1359
1590
|
]
|
|
1591
|
+
},
|
|
1592
|
+
{
|
|
1593
|
+
"name": "PluginListenerHandle",
|
|
1594
|
+
"slug": "pluginlistenerhandle",
|
|
1595
|
+
"docs": "",
|
|
1596
|
+
"tags": [],
|
|
1597
|
+
"methods": [],
|
|
1598
|
+
"properties": [
|
|
1599
|
+
{
|
|
1600
|
+
"name": "remove",
|
|
1601
|
+
"tags": [],
|
|
1602
|
+
"docs": "",
|
|
1603
|
+
"complexTypes": [],
|
|
1604
|
+
"type": "() => Promise<void>"
|
|
1605
|
+
}
|
|
1606
|
+
]
|
|
1607
|
+
},
|
|
1608
|
+
{
|
|
1609
|
+
"name": "SafeAreaInsets",
|
|
1610
|
+
"slug": "safeareainsets",
|
|
1611
|
+
"docs": "Represents safe area insets for devices.\nAndroid: Values are expressed in logical pixels (dp) to match JS layout units.\niOS: Values are expressed in physical pixels and exclude status bar.",
|
|
1612
|
+
"tags": [],
|
|
1613
|
+
"methods": [],
|
|
1614
|
+
"properties": [
|
|
1615
|
+
{
|
|
1616
|
+
"name": "orientation",
|
|
1617
|
+
"tags": [],
|
|
1618
|
+
"docs": "Current device orientation (1 = portrait, 2 = landscape, 0 = unknown).",
|
|
1619
|
+
"complexTypes": [],
|
|
1620
|
+
"type": "number"
|
|
1621
|
+
},
|
|
1622
|
+
{
|
|
1623
|
+
"name": "top",
|
|
1624
|
+
"tags": [],
|
|
1625
|
+
"docs": "Orientation-aware notch/camera cutout inset (excluding status bar).\nIn portrait mode: returns top inset (notch at top).\nIn landscape mode: returns left inset (notch at side).\nAndroid: Value in dp, iOS: Value in pixels (status bar excluded).",
|
|
1626
|
+
"complexTypes": [],
|
|
1627
|
+
"type": "number"
|
|
1628
|
+
}
|
|
1629
|
+
]
|
|
1360
1630
|
}
|
|
1361
1631
|
],
|
|
1362
1632
|
"enums": [
|
|
@@ -1513,6 +1783,37 @@
|
|
|
1513
1783
|
]
|
|
1514
1784
|
}
|
|
1515
1785
|
]
|
|
1786
|
+
},
|
|
1787
|
+
{
|
|
1788
|
+
"name": "DeviceOrientation",
|
|
1789
|
+
"slug": "deviceorientation",
|
|
1790
|
+
"docs": "Canonical device orientation values across platforms.",
|
|
1791
|
+
"types": [
|
|
1792
|
+
{
|
|
1793
|
+
"text": "\"portrait\"",
|
|
1794
|
+
"complexTypes": []
|
|
1795
|
+
},
|
|
1796
|
+
{
|
|
1797
|
+
"text": "\"landscape\"",
|
|
1798
|
+
"complexTypes": []
|
|
1799
|
+
},
|
|
1800
|
+
{
|
|
1801
|
+
"text": "\"landscape-left\"",
|
|
1802
|
+
"complexTypes": []
|
|
1803
|
+
},
|
|
1804
|
+
{
|
|
1805
|
+
"text": "\"landscape-right\"",
|
|
1806
|
+
"complexTypes": []
|
|
1807
|
+
},
|
|
1808
|
+
{
|
|
1809
|
+
"text": "\"portrait-upside-down\"",
|
|
1810
|
+
"complexTypes": []
|
|
1811
|
+
},
|
|
1812
|
+
{
|
|
1813
|
+
"text": "\"unknown\"",
|
|
1814
|
+
"complexTypes": []
|
|
1815
|
+
}
|
|
1816
|
+
]
|
|
1516
1817
|
}
|
|
1517
1818
|
],
|
|
1518
1819
|
"pluginConfigs": []
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PluginListenerHandle } from "@capacitor/core";
|
|
1
2
|
export type CameraPosition = "rear" | "front";
|
|
2
3
|
export type FlashMode = CameraPreviewFlashMode;
|
|
3
4
|
export type GridMode = "none" | "3x3" | "4x4";
|
|
@@ -289,6 +290,26 @@ export interface CameraOpacityOptions {
|
|
|
289
290
|
*/
|
|
290
291
|
opacity?: number;
|
|
291
292
|
}
|
|
293
|
+
/**
|
|
294
|
+
* Represents safe area insets for devices.
|
|
295
|
+
* Android: Values are expressed in logical pixels (dp) to match JS layout units.
|
|
296
|
+
* iOS: Values are expressed in physical pixels and exclude status bar.
|
|
297
|
+
*/
|
|
298
|
+
export interface SafeAreaInsets {
|
|
299
|
+
/** Current device orientation (1 = portrait, 2 = landscape, 0 = unknown). */
|
|
300
|
+
orientation: number;
|
|
301
|
+
/**
|
|
302
|
+
* Orientation-aware notch/camera cutout inset (excluding status bar).
|
|
303
|
+
* In portrait mode: returns top inset (notch at top).
|
|
304
|
+
* In landscape mode: returns left inset (notch at side).
|
|
305
|
+
* Android: Value in dp, iOS: Value in pixels (status bar excluded).
|
|
306
|
+
*/
|
|
307
|
+
top: number;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Canonical device orientation values across platforms.
|
|
311
|
+
*/
|
|
312
|
+
export type DeviceOrientation = "portrait" | "landscape" | "landscape-left" | "landscape-right" | "portrait-upside-down" | "unknown";
|
|
292
313
|
/**
|
|
293
314
|
* The main interface for the CameraPreview plugin.
|
|
294
315
|
*/
|
|
@@ -356,7 +377,8 @@ export interface CameraPreviewPlugin {
|
|
|
356
377
|
* - x: Optional x coordinate for positioning. If not provided, view will be auto-centered horizontally.
|
|
357
378
|
* - y: Optional y coordinate for positioning. If not provided, view will be auto-centered vertically.
|
|
358
379
|
* @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the actual preview dimensions and position.
|
|
359
|
-
* @since 7.
|
|
380
|
+
* @since 7.5.0
|
|
381
|
+
* @platform android, ios
|
|
360
382
|
*/
|
|
361
383
|
setAspectRatio(options: {
|
|
362
384
|
aspectRatio: "4:3" | "16:9";
|
|
@@ -372,7 +394,8 @@ export interface CameraPreviewPlugin {
|
|
|
372
394
|
* Gets the current aspect ratio of the camera preview.
|
|
373
395
|
*
|
|
374
396
|
* @returns {Promise<{ aspectRatio: '4:3' | '16:9' }>} A promise that resolves with the current aspect ratio.
|
|
375
|
-
* @since 7.
|
|
397
|
+
* @since 7.5.0
|
|
398
|
+
* @platform android, ios
|
|
376
399
|
*/
|
|
377
400
|
getAspectRatio(): Promise<{
|
|
378
401
|
aspectRatio: "4:3" | "16:9";
|
|
@@ -461,7 +484,8 @@ export interface CameraPreviewPlugin {
|
|
|
461
484
|
* Checks if the camera preview is currently running.
|
|
462
485
|
*
|
|
463
486
|
* @returns {Promise<{ isRunning: boolean }>} A promise that resolves with the running state.
|
|
464
|
-
* @since 7.
|
|
487
|
+
* @since 7.5.0
|
|
488
|
+
* @platform android, ios
|
|
465
489
|
*/
|
|
466
490
|
isRunning(): Promise<{
|
|
467
491
|
isRunning: boolean;
|
|
@@ -470,7 +494,8 @@ export interface CameraPreviewPlugin {
|
|
|
470
494
|
* Gets all available camera devices.
|
|
471
495
|
*
|
|
472
496
|
* @returns {Promise<{ devices: CameraDevice[] }>} A promise that resolves with the list of available camera devices.
|
|
473
|
-
* @since 7.
|
|
497
|
+
* @since 7.5.0
|
|
498
|
+
* @platform android, ios
|
|
474
499
|
*/
|
|
475
500
|
getAvailableDevices(): Promise<{
|
|
476
501
|
devices: CameraDevice[];
|
|
@@ -479,7 +504,8 @@ export interface CameraPreviewPlugin {
|
|
|
479
504
|
* Gets the current zoom state, including min/max and current lens info.
|
|
480
505
|
*
|
|
481
506
|
* @returns {Promise<{ min: number; max: number; current: number; lens: LensInfo }>} A promise that resolves with the zoom state.
|
|
482
|
-
* @since 7.
|
|
507
|
+
* @since 7.5.0
|
|
508
|
+
* @platform android, ios
|
|
483
509
|
*/
|
|
484
510
|
getZoom(): Promise<{
|
|
485
511
|
min: number;
|
|
@@ -487,12 +513,23 @@ export interface CameraPreviewPlugin {
|
|
|
487
513
|
current: number;
|
|
488
514
|
lens: LensInfo;
|
|
489
515
|
}>;
|
|
516
|
+
/**
|
|
517
|
+
* Returns zoom button values for quick switching.
|
|
518
|
+
* - iOS/Android: includes 0.5 if ultra-wide available; 1 and 2 if wide available; 3 if telephoto available
|
|
519
|
+
* - Web: unsupported
|
|
520
|
+
* @since 7.5.0
|
|
521
|
+
* @platform android, ios
|
|
522
|
+
*/
|
|
523
|
+
getZoomButtonValues(): Promise<{
|
|
524
|
+
values: number[];
|
|
525
|
+
}>;
|
|
490
526
|
/**
|
|
491
527
|
* Sets the zoom level of the camera.
|
|
492
528
|
*
|
|
493
529
|
* @param {{ level: number; ramp?: boolean; autoFocus?: boolean }} options - The desired zoom level. `ramp` is currently unused. `autoFocus` defaults to true.
|
|
494
530
|
* @returns {Promise<void>} A promise that resolves when the zoom level is set.
|
|
495
|
-
* @since 7.
|
|
531
|
+
* @since 7.5.0
|
|
532
|
+
* @platform android, ios
|
|
496
533
|
*/
|
|
497
534
|
setZoom(options: {
|
|
498
535
|
level: number;
|
|
@@ -503,7 +540,8 @@ export interface CameraPreviewPlugin {
|
|
|
503
540
|
* Gets the current flash mode.
|
|
504
541
|
*
|
|
505
542
|
* @returns {Promise<{ flashMode: FlashMode }>} A promise that resolves with the current flash mode.
|
|
506
|
-
* @since 7.
|
|
543
|
+
* @since 7.5.0
|
|
544
|
+
* @platform android, ios
|
|
507
545
|
*/
|
|
508
546
|
getFlashMode(): Promise<{
|
|
509
547
|
flashMode: FlashMode;
|
|
@@ -511,7 +549,8 @@ export interface CameraPreviewPlugin {
|
|
|
511
549
|
/**
|
|
512
550
|
* Removes all registered listeners.
|
|
513
551
|
*
|
|
514
|
-
* @since 7.
|
|
552
|
+
* @since 7.5.0
|
|
553
|
+
* @platform android, ios
|
|
515
554
|
*/
|
|
516
555
|
removeAllListeners(): Promise<void>;
|
|
517
556
|
/**
|
|
@@ -519,7 +558,8 @@ export interface CameraPreviewPlugin {
|
|
|
519
558
|
*
|
|
520
559
|
* @param {{ deviceId: string }} options - The ID of the device to switch to.
|
|
521
560
|
* @returns {Promise<void>} A promise that resolves when the camera is switched.
|
|
522
|
-
* @since 7.
|
|
561
|
+
* @since 7.5.0
|
|
562
|
+
* @platform android, ios
|
|
523
563
|
*/
|
|
524
564
|
setDeviceId(options: {
|
|
525
565
|
deviceId: string;
|
|
@@ -528,7 +568,8 @@ export interface CameraPreviewPlugin {
|
|
|
528
568
|
* Gets the ID of the currently active camera device.
|
|
529
569
|
*
|
|
530
570
|
* @returns {Promise<{ deviceId: string }>} A promise that resolves with the current device ID.
|
|
531
|
-
* @since 7.
|
|
571
|
+
* @since 7.5.0
|
|
572
|
+
* @platform android, ios
|
|
532
573
|
*/
|
|
533
574
|
getDeviceId(): Promise<{
|
|
534
575
|
deviceId: string;
|
|
@@ -536,6 +577,8 @@ export interface CameraPreviewPlugin {
|
|
|
536
577
|
/**
|
|
537
578
|
* Gets the current preview size and position.
|
|
538
579
|
* @returns {Promise<{x: number, y: number, width: number, height: number}>}
|
|
580
|
+
* @since 7.5.0
|
|
581
|
+
* @platform android, ios
|
|
539
582
|
*/
|
|
540
583
|
getPreviewSize(): Promise<{
|
|
541
584
|
x: number;
|
|
@@ -547,6 +590,8 @@ export interface CameraPreviewPlugin {
|
|
|
547
590
|
* Sets the preview size and position.
|
|
548
591
|
* @param options The new position and dimensions.
|
|
549
592
|
* @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the actual preview dimensions and position.
|
|
593
|
+
* @since 7.5.0
|
|
594
|
+
* @platform android, ios
|
|
550
595
|
*/
|
|
551
596
|
setPreviewSize(options: {
|
|
552
597
|
x?: number;
|
|
@@ -566,10 +611,69 @@ export interface CameraPreviewPlugin {
|
|
|
566
611
|
* @param {number} options.x - The x coordinate in the preview view to focus on (0-1 normalized).
|
|
567
612
|
* @param {number} options.y - The y coordinate in the preview view to focus on (0-1 normalized).
|
|
568
613
|
* @returns {Promise<void>} A promise that resolves when the focus is set.
|
|
569
|
-
* @since
|
|
614
|
+
* @since 7.5.0
|
|
615
|
+
* @platform android, ios
|
|
570
616
|
*/
|
|
571
617
|
setFocus(options: {
|
|
572
618
|
x: number;
|
|
573
619
|
y: number;
|
|
574
620
|
}): Promise<void>;
|
|
621
|
+
/**
|
|
622
|
+
* Adds a listener for screen resize events.
|
|
623
|
+
* @param {string} eventName - The event name to listen for.
|
|
624
|
+
* @param {Function} listenerFunc - The function to call when the event is triggered.
|
|
625
|
+
* @returns {Promise<PluginListenerHandle>} A promise that resolves with a handle to the listener.
|
|
626
|
+
* @since 7.5.0
|
|
627
|
+
* @platform android, ios
|
|
628
|
+
*/
|
|
629
|
+
addListener(eventName: "screenResize", listenerFunc: (data: {
|
|
630
|
+
width: number;
|
|
631
|
+
height: number;
|
|
632
|
+
x: number;
|
|
633
|
+
y: number;
|
|
634
|
+
}) => void): Promise<PluginListenerHandle>;
|
|
635
|
+
/**
|
|
636
|
+
* Adds a listener for orientation change events.
|
|
637
|
+
* @param {string} eventName - The event name to listen for.
|
|
638
|
+
* @param {Function} listenerFunc - The function to call when the event is triggered.
|
|
639
|
+
* @returns {Promise<PluginListenerHandle>} A promise that resolves with a handle to the listener.
|
|
640
|
+
* @since 7.5.0
|
|
641
|
+
* @platform android, ios
|
|
642
|
+
*/
|
|
643
|
+
addListener(eventName: "orientationChange", listenerFunc: (data: {
|
|
644
|
+
orientation: DeviceOrientation;
|
|
645
|
+
}) => void): Promise<PluginListenerHandle>;
|
|
646
|
+
/**
|
|
647
|
+
* Deletes a file at the given absolute path on the device.
|
|
648
|
+
* Use this to quickly clean up temporary images created with `storeToFile`.
|
|
649
|
+
* On web, this is not supported and will throw.
|
|
650
|
+
* @since 7.5.0
|
|
651
|
+
* @platform android, ios
|
|
652
|
+
*/
|
|
653
|
+
deleteFile(options: {
|
|
654
|
+
path: string;
|
|
655
|
+
}): Promise<{
|
|
656
|
+
success: boolean;
|
|
657
|
+
}>;
|
|
658
|
+
/**
|
|
659
|
+
* Gets the safe area insets for devices.
|
|
660
|
+
* Returns the orientation-aware notch/camera cutout inset and the current orientation.
|
|
661
|
+
* In portrait mode: returns top inset (notch at top).
|
|
662
|
+
* In landscape mode: returns left inset (notch moved to side).
|
|
663
|
+
* This specifically targets the cutout area (notch, punch hole, etc.) that all modern phones have.
|
|
664
|
+
*
|
|
665
|
+
* Android: Values returned in dp (logical pixels).
|
|
666
|
+
* iOS: Values returned in physical pixels, excluding status bar (only pure notch/cutout size).
|
|
667
|
+
*
|
|
668
|
+
* @platform android, ios
|
|
669
|
+
*/
|
|
670
|
+
getSafeAreaInsets(): Promise<SafeAreaInsets>;
|
|
671
|
+
/**
|
|
672
|
+
* Gets the current device orientation in a cross-platform format.
|
|
673
|
+
* @since 7.5.0
|
|
674
|
+
* @platform android, ios
|
|
675
|
+
*/
|
|
676
|
+
getOrientation(): Promise<{
|
|
677
|
+
orientation: DeviceOrientation;
|
|
678
|
+
}>;
|
|
575
679
|
}
|