@capgo/camera-preview 7.13.4 → 7.13.6
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.
|
@@ -765,10 +765,13 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
765
765
|
videoCapture = VideoCapture.withOutput(recorder);
|
|
766
766
|
}
|
|
767
767
|
|
|
768
|
-
preview.setSurfaceProvider(previewView.getSurfaceProvider());
|
|
769
768
|
// Unbind any existing use cases and bind new ones
|
|
770
769
|
cameraProvider.unbindAll();
|
|
771
770
|
|
|
771
|
+
// Re-set the surface provider after unbinding to ensure the preview
|
|
772
|
+
// is connected and video frames are captured correctly
|
|
773
|
+
preview.setSurfaceProvider(previewView.getSurfaceProvider());
|
|
774
|
+
|
|
772
775
|
// Bind with or without video capture based on enableVideoMode
|
|
773
776
|
if (sessionConfig.isVideoModeEnabled() && videoCapture != null) {
|
|
774
777
|
camera = cameraProvider.bindToLifecycle(
|
|
@@ -3854,6 +3857,10 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
|
|
|
3854
3857
|
// Rebind with video capture included
|
|
3855
3858
|
cameraProvider.unbindAll();
|
|
3856
3859
|
if (preview != null) {
|
|
3860
|
+
// CRITICAL: Re-set the surface provider after unbinding
|
|
3861
|
+
// Without this, the preview won't be connected to the surface and video won't be captured
|
|
3862
|
+
preview.setSurfaceProvider(previewView.getSurfaceProvider());
|
|
3863
|
+
|
|
3857
3864
|
camera = cameraProvider.bindToLifecycle(
|
|
3858
3865
|
this,
|
|
3859
3866
|
currentCameraSelector,
|
|
@@ -1935,7 +1935,14 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
|
|
|
1935
1935
|
}
|
|
1936
1936
|
}
|
|
1937
1937
|
|
|
1938
|
+
private var lastOrientation: String?
|
|
1939
|
+
|
|
1938
1940
|
@objc private func handleOrientationChange() {
|
|
1941
|
+
var currentOrientation = self.currentOrientationString()
|
|
1942
|
+
if currentOrientation == "portrait-upside-down" || currentOrientation == lastOrientation {
|
|
1943
|
+
return
|
|
1944
|
+
}
|
|
1945
|
+
lastOrientation = currentOrientation
|
|
1939
1946
|
DispatchQueue.main.async {
|
|
1940
1947
|
let result = self.rawSetAspectRatio()
|
|
1941
1948
|
self.notifyListeners("screenResize", data: result)
|