metag-sdk-ionic 1.2.7-native-0.136 → 1.2.7-native-0.138
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.
|
@@ -64,16 +64,20 @@ public class CustomVideoRecorder extends Plugin {
|
|
|
64
64
|
|
|
65
65
|
@PluginMethod
|
|
66
66
|
public void startPreview(PluginCall call) {
|
|
67
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: Iniciando preview de cámara");
|
|
67
68
|
if (!hasRequiredPermissions()) {
|
|
69
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: No se tienen los permisos necesarios");
|
|
68
70
|
call.reject("No se tienen los permisos necesarios");
|
|
69
71
|
return;
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
getActivity().runOnUiThread(() -> {
|
|
73
75
|
try {
|
|
76
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: Obteniendo WebView parent");
|
|
74
77
|
ViewGroup webViewParent = (ViewGroup) getBridge().getWebView().getParent();
|
|
75
78
|
|
|
76
79
|
// Crear vista de overlay nativo con preview y UI
|
|
80
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: Creando CameraOverlayView");
|
|
77
81
|
overlayView = new CameraOverlayView(getContext(), this);
|
|
78
82
|
|
|
79
83
|
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
|
|
@@ -81,14 +85,18 @@ public class CustomVideoRecorder extends Plugin {
|
|
|
81
85
|
FrameLayout.LayoutParams.MATCH_PARENT
|
|
82
86
|
);
|
|
83
87
|
webViewParent.addView(overlayView, params);
|
|
88
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: Overlay agregado al WebView parent");
|
|
84
89
|
|
|
85
90
|
getBridge().getWebView().setBackgroundColor(0x00000000);
|
|
86
91
|
getBridge().getWebView().setVisibility(View.GONE);
|
|
92
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: WebView ocultado, preview iniciado correctamente");
|
|
87
93
|
|
|
88
94
|
JSObject ret = new JSObject();
|
|
89
95
|
ret.put("success", true);
|
|
90
96
|
call.resolve(ret);
|
|
91
97
|
} catch (Exception e) {
|
|
98
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: Exception en startPreview: " + e.getMessage());
|
|
99
|
+
e.printStackTrace();
|
|
92
100
|
call.reject("Error al iniciar preview: " + e.getMessage());
|
|
93
101
|
}
|
|
94
102
|
});
|
|
@@ -529,6 +537,7 @@ public class CustomVideoRecorder extends Plugin {
|
|
|
529
537
|
}
|
|
530
538
|
|
|
531
539
|
private void startCountdown() {
|
|
540
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: Iniciando countdown de 3 segundos");
|
|
532
541
|
countdown = 3;
|
|
533
542
|
overlayView.updateUI();
|
|
534
543
|
|
|
@@ -537,11 +546,13 @@ public class CustomVideoRecorder extends Plugin {
|
|
|
537
546
|
@Override
|
|
538
547
|
public void run() {
|
|
539
548
|
countdown--;
|
|
549
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: Countdown: " + countdown);
|
|
540
550
|
overlayView.updateUI();
|
|
541
551
|
|
|
542
552
|
if (countdown > 0) {
|
|
543
553
|
handler.postDelayed(this, 1000);
|
|
544
554
|
} else {
|
|
555
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: Countdown terminado, iniciando grabación");
|
|
545
556
|
startRecordingInternal();
|
|
546
557
|
}
|
|
547
558
|
}
|
|
@@ -630,16 +641,20 @@ public class CustomVideoRecorder extends Plugin {
|
|
|
630
641
|
}
|
|
631
642
|
|
|
632
643
|
private void stopRecordingInternal() {
|
|
644
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: Deteniendo grabación");
|
|
633
645
|
getActivity().runOnUiThread(() -> {
|
|
634
646
|
try {
|
|
635
647
|
if (mediaRecorder != null) {
|
|
636
648
|
try {
|
|
649
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: Llamando mediaRecorder.stop()");
|
|
637
650
|
mediaRecorder.stop();
|
|
651
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: MediaRecorder detenido correctamente");
|
|
638
652
|
} catch (RuntimeException e) {
|
|
639
|
-
|
|
653
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: RuntimeException al detener: " + e.getMessage());
|
|
640
654
|
e.printStackTrace();
|
|
641
655
|
}
|
|
642
656
|
mediaRecorder.reset();
|
|
657
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: MediaRecorder reseteado");
|
|
643
658
|
}
|
|
644
659
|
|
|
645
660
|
isRecording = false;
|
|
@@ -649,14 +664,19 @@ public class CustomVideoRecorder extends Plugin {
|
|
|
649
664
|
}
|
|
650
665
|
|
|
651
666
|
// Notificar al JavaScript con el path del video
|
|
667
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: Video grabado en: " + videoFilePath);
|
|
652
668
|
JSObject ret = new JSObject();
|
|
653
669
|
ret.put("success", true);
|
|
654
670
|
ret.put("videoPath", videoFilePath);
|
|
671
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: Notificando a JavaScript");
|
|
655
672
|
notifyListeners("recordingComplete", ret);
|
|
673
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: Notificación enviada");
|
|
656
674
|
|
|
657
675
|
// Cerrar el preview después de notificar (dar tiempo al JS para procesar)
|
|
676
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: Programando cierre del preview en 500ms");
|
|
658
677
|
new Handler().postDelayed(() -> {
|
|
659
678
|
try {
|
|
679
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: Cerrando cámara y limpiando vista");
|
|
660
680
|
closeCamera();
|
|
661
681
|
if (overlayView != null) {
|
|
662
682
|
ViewGroup parent = (ViewGroup) overlayView.getParent();
|
|
@@ -668,18 +688,22 @@ public class CustomVideoRecorder extends Plugin {
|
|
|
668
688
|
|
|
669
689
|
getBridge().getWebView().setBackgroundColor(0xFFFFFFFF);
|
|
670
690
|
getBridge().getWebView().setVisibility(View.VISIBLE);
|
|
691
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: Vista limpiada, WebView restaurado");
|
|
671
692
|
} catch (Exception e) {
|
|
693
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: Exception al limpiar: " + e.getMessage());
|
|
672
694
|
e.printStackTrace();
|
|
673
695
|
}
|
|
674
696
|
}, 500);
|
|
675
697
|
|
|
676
698
|
} catch (Exception e) {
|
|
699
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: Exception crítica: " + e.getMessage());
|
|
677
700
|
e.printStackTrace();
|
|
678
701
|
|
|
679
702
|
// En caso de error, notificar también
|
|
680
703
|
JSObject ret = new JSObject();
|
|
681
704
|
ret.put("success", false);
|
|
682
705
|
ret.put("error", e.getMessage());
|
|
706
|
+
android.util.Log.e("CustomVideoRecorder", "ERROR: Notificando error a JavaScript");
|
|
683
707
|
notifyListeners("recordingComplete", ret);
|
|
684
708
|
}
|
|
685
709
|
});
|
package/package.json
CHANGED