capacitor-camera-module 0.0.59 → 0.0.61
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.
|
@@ -54,8 +54,8 @@ public class CameraModulePlugin: CAPPlugin,CAPBridgedPlugin,AVCaptureVideoDataOu
|
|
|
54
54
|
guard let webView = bridge?.webView else { return }
|
|
55
55
|
|
|
56
56
|
webView.isOpaque = true
|
|
57
|
-
webView.backgroundColor = .
|
|
58
|
-
webView.scrollView.backgroundColor = .
|
|
57
|
+
webView.backgroundColor = .black
|
|
58
|
+
webView.scrollView.backgroundColor = .black
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
|
|
@@ -191,11 +191,18 @@ public class CameraModulePlugin: CAPPlugin,CAPBridgedPlugin,AVCaptureVideoDataOu
|
|
|
191
191
|
return
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
container.insertSubview(previewView,
|
|
194
|
+
container.insertSubview(previewView, at: 0)
|
|
195
|
+
webView.layer.zPosition = 1
|
|
196
|
+
previewView.layer.zPosition = 0
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
let safeArea = container.safeAreaLayoutGuide
|
|
195
202
|
|
|
196
203
|
NSLayoutConstraint.activate([
|
|
197
204
|
previewView.topAnchor.constraint(equalTo: container.topAnchor),
|
|
198
|
-
previewView.bottomAnchor.constraint(equalTo:
|
|
205
|
+
previewView.bottomAnchor.constraint(equalTo: safeArea.bottomAnchor, constant: -180),
|
|
199
206
|
previewView.leadingAnchor.constraint(equalTo: container.leadingAnchor),
|
|
200
207
|
previewView.trailingAnchor.constraint(equalTo: container.trailingAnchor)
|
|
201
208
|
])
|
|
@@ -207,6 +214,8 @@ public class CameraModulePlugin: CAPPlugin,CAPBridgedPlugin,AVCaptureVideoDataOu
|
|
|
207
214
|
|
|
208
215
|
previewView.layoutIfNeeded()
|
|
209
216
|
previewLayer.frame = previewView.bounds
|
|
217
|
+
previewLayer.masksToBounds = true
|
|
218
|
+
|
|
210
219
|
|
|
211
220
|
previewView.layer.insertSublayer(previewLayer, at: 0)
|
|
212
221
|
|
|
@@ -216,7 +225,12 @@ public class CameraModulePlugin: CAPPlugin,CAPBridgedPlugin,AVCaptureVideoDataOu
|
|
|
216
225
|
self.videoPreviewLayer = previewLayer
|
|
217
226
|
self.captureSession = session
|
|
218
227
|
|
|
228
|
+
session.beginConfiguration()
|
|
229
|
+
session.sessionPreset = .photo
|
|
230
|
+
session.commitConfiguration()
|
|
231
|
+
|
|
219
232
|
DispatchQueue.global(qos: .userInitiated).async {
|
|
233
|
+
|
|
220
234
|
session.startRunning()
|
|
221
235
|
}
|
|
222
236
|
call.resolve()
|
|
@@ -230,7 +244,10 @@ public class CameraModulePlugin: CAPPlugin,CAPBridgedPlugin,AVCaptureVideoDataOu
|
|
|
230
244
|
self.captureSession = nil
|
|
231
245
|
self.videoPreviewLayer?.removeFromSuperlayer()
|
|
232
246
|
self.previewView?.removeFromSuperview()
|
|
247
|
+
self.videoPreviewLayer?.session = nil
|
|
248
|
+
|
|
233
249
|
self.videoPreviewLayer = nil
|
|
250
|
+
|
|
234
251
|
self.previewView = nil
|
|
235
252
|
call.resolve()
|
|
236
253
|
}
|