@capgo/camera-preview 7.9.0 → 7.10.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.
|
@@ -695,29 +695,32 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
|
|
|
695
695
|
return
|
|
696
696
|
}
|
|
697
697
|
|
|
698
|
-
//
|
|
699
|
-
|
|
698
|
+
// Ensure UI operations happen on main thread
|
|
699
|
+
DispatchQueue.main.async {
|
|
700
|
+
// Disable user interaction during flip
|
|
701
|
+
self.previewView.isUserInteractionEnabled = false
|
|
700
702
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
+
do {
|
|
704
|
+
try self.cameraController.switchCameras()
|
|
703
705
|
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
706
|
+
// Update preview layer frame without animation
|
|
707
|
+
CATransaction.begin()
|
|
708
|
+
CATransaction.setDisableActions(true)
|
|
709
|
+
self.cameraController.previewLayer?.frame = self.previewView.bounds
|
|
710
|
+
self.cameraController.previewLayer?.videoGravity = .resizeAspectFill
|
|
711
|
+
CATransaction.commit()
|
|
710
712
|
|
|
711
|
-
|
|
713
|
+
self.previewView.isUserInteractionEnabled = true
|
|
712
714
|
|
|
713
|
-
|
|
714
|
-
|
|
715
|
+
// Ensure webview remains transparent after flip
|
|
716
|
+
self.makeWebViewTransparent()
|
|
715
717
|
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
718
|
+
call.resolve()
|
|
719
|
+
} catch {
|
|
720
|
+
self.previewView.isUserInteractionEnabled = true
|
|
721
|
+
print("Failed to flip camera: \(error.localizedDescription)")
|
|
722
|
+
call.reject("Failed to flip camera: \(error.localizedDescription)")
|
|
723
|
+
}
|
|
721
724
|
}
|
|
722
725
|
}
|
|
723
726
|
|
|
@@ -1342,28 +1345,31 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
|
|
|
1342
1345
|
return
|
|
1343
1346
|
}
|
|
1344
1347
|
|
|
1345
|
-
//
|
|
1346
|
-
|
|
1348
|
+
// Ensure UI operations happen on main thread
|
|
1349
|
+
DispatchQueue.main.async {
|
|
1350
|
+
// Disable user interaction during device swap
|
|
1351
|
+
self.previewView.isUserInteractionEnabled = false
|
|
1347
1352
|
|
|
1348
|
-
|
|
1349
|
-
|
|
1353
|
+
do {
|
|
1354
|
+
try self.cameraController.swapToDevice(deviceId: deviceId)
|
|
1350
1355
|
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1356
|
+
// Update preview layer frame without animation
|
|
1357
|
+
CATransaction.begin()
|
|
1358
|
+
CATransaction.setDisableActions(true)
|
|
1359
|
+
self.cameraController.previewLayer?.frame = self.previewView.bounds
|
|
1360
|
+
self.cameraController.previewLayer?.videoGravity = .resizeAspectFill
|
|
1361
|
+
CATransaction.commit()
|
|
1357
1362
|
|
|
1358
|
-
|
|
1363
|
+
self.previewView.isUserInteractionEnabled = true
|
|
1359
1364
|
|
|
1360
|
-
|
|
1361
|
-
|
|
1365
|
+
// Ensure webview remains transparent after device switch
|
|
1366
|
+
self.makeWebViewTransparent()
|
|
1362
1367
|
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1368
|
+
call.resolve()
|
|
1369
|
+
} catch {
|
|
1370
|
+
self.previewView.isUserInteractionEnabled = true
|
|
1371
|
+
call.reject("Failed to swap to device \(deviceId): \(error.localizedDescription)")
|
|
1372
|
+
}
|
|
1367
1373
|
}
|
|
1368
1374
|
}
|
|
1369
1375
|
|