capacitor-camera-module 0.0.64 → 0.0.67
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.
|
@@ -180,31 +180,22 @@ public class CameraModulePlugin: CAPPlugin,CAPBridgedPlugin,AVCaptureVideoDataOu
|
|
|
180
180
|
return
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
// 1. Hacer el webView transparente
|
|
183
|
+
// 1. Hacer el webView transparente
|
|
184
184
|
webView.isOpaque = false
|
|
185
185
|
webView.backgroundColor = .clear
|
|
186
186
|
webView.scrollView.backgroundColor = .clear
|
|
187
|
-
|
|
188
|
-
// Si necesitas mantener scroll pero transparente:
|
|
189
187
|
webView.scrollView.isOpaque = false
|
|
190
188
|
|
|
191
189
|
// 2. Crear previewView
|
|
192
190
|
let previewView = UIView()
|
|
193
191
|
previewView.translatesAutoresizingMaskIntoConstraints = false
|
|
194
|
-
previewView.backgroundColor = .
|
|
195
|
-
previewView.isUserInteractionEnabled = false //
|
|
196
|
-
|
|
197
|
-
// DEBUG: Borde para ver los límites
|
|
198
|
-
previewView.layer.borderWidth = 2
|
|
199
|
-
previewView.layer.borderColor = UIColor.green.cgColor
|
|
192
|
+
previewView.backgroundColor = .clear // Transparente desde el inicio
|
|
193
|
+
previewView.isUserInteractionEnabled = false // No intercepta toques
|
|
200
194
|
|
|
201
|
-
|
|
202
|
-
print("🔍 DEBUG: WebView frame: \(webView.frame)")
|
|
203
|
-
|
|
204
|
-
// 3. Insertar previewView DETRÁS de todo (posición 0)
|
|
195
|
+
// 3. Insertar previewView DETRÁS de todo
|
|
205
196
|
container.insertSubview(previewView, at: 0)
|
|
206
197
|
|
|
207
|
-
// 4. Configurar constraints para
|
|
198
|
+
// 4. Configurar constraints para toda la pantalla
|
|
208
199
|
NSLayoutConstraint.activate([
|
|
209
200
|
previewView.topAnchor.constraint(equalTo: container.topAnchor),
|
|
210
201
|
previewView.bottomAnchor.constraint(equalTo: container.bottomAnchor),
|
|
@@ -219,18 +210,12 @@ public class CameraModulePlugin: CAPPlugin,CAPBridgedPlugin,AVCaptureVideoDataOu
|
|
|
219
210
|
// 6. Forzar layout
|
|
220
211
|
container.layoutIfNeeded()
|
|
221
212
|
|
|
222
|
-
print("🔍 DEBUG: PreviewView frame después de layout: \(previewView.frame)")
|
|
223
|
-
|
|
224
213
|
// 7. Crear previewLayer
|
|
225
214
|
let previewLayer = AVCaptureVideoPreviewLayer(session: session)
|
|
226
215
|
previewLayer.videoGravity = .resizeAspectFill
|
|
227
216
|
previewLayer.frame = previewView.bounds
|
|
228
217
|
previewLayer.masksToBounds = true
|
|
229
218
|
|
|
230
|
-
// DEBUG: Borde para el layer también
|
|
231
|
-
previewLayer.borderWidth = 1
|
|
232
|
-
previewLayer.borderColor = UIColor.yellow.cgColor
|
|
233
|
-
|
|
234
219
|
previewView.layer.insertSublayer(previewLayer, at: 0)
|
|
235
220
|
|
|
236
221
|
// 8. Guardar referencias
|
|
@@ -245,23 +230,15 @@ public class CameraModulePlugin: CAPPlugin,CAPBridgedPlugin,AVCaptureVideoDataOu
|
|
|
245
230
|
DispatchQueue.global(qos: .userInitiated).async {
|
|
246
231
|
session.startRunning()
|
|
247
232
|
|
|
248
|
-
DispatchQueue.main.
|
|
249
|
-
print("
|
|
250
|
-
print("
|
|
251
|
-
print("📍 WebView transparente: \(webView.isOpaque ? "NO" : "SÍ")")
|
|
252
|
-
|
|
253
|
-
// Quitar borde de debug después de 3 segundos
|
|
254
|
-
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
|
|
255
|
-
previewView.layer.borderWidth = 0
|
|
256
|
-
previewLayer.borderWidth = 0
|
|
257
|
-
previewView.backgroundColor = .clear // Ahora sí transparente
|
|
258
|
-
}
|
|
233
|
+
DispatchQueue.main.async {
|
|
234
|
+
print("Cámara iniciada correctamente")
|
|
235
|
+
print("Preview visible: \(previewView.window != nil ? "SÍ" : "NO")")
|
|
259
236
|
}
|
|
260
237
|
}
|
|
261
238
|
|
|
262
239
|
call.resolve([
|
|
263
240
|
"success": true,
|
|
264
|
-
"message": "Preview
|
|
241
|
+
"message": "Preview de cámara iniciado"
|
|
265
242
|
])
|
|
266
243
|
}
|
|
267
244
|
}
|