metag-sdk-ionic 1.2.7-native-0.135 → 1.2.7-native-0.136
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.
|
@@ -570,14 +570,27 @@ public class CustomVideoRecorder extends Plugin {
|
|
|
570
570
|
null,
|
|
571
571
|
backgroundHandler
|
|
572
572
|
);
|
|
573
|
-
mediaRecorder.start();
|
|
574
|
-
isRecording = true;
|
|
575
|
-
timeRemaining = 5;
|
|
576
|
-
overlayView.updateUI();
|
|
577
573
|
|
|
578
|
-
|
|
574
|
+
// Iniciar MediaRecorder
|
|
575
|
+
try {
|
|
576
|
+
mediaRecorder.start();
|
|
577
|
+
isRecording = true;
|
|
578
|
+
timeRemaining = 5;
|
|
579
|
+
|
|
580
|
+
getActivity().runOnUiThread(() -> {
|
|
581
|
+
if (overlayView != null) {
|
|
582
|
+
overlayView.updateUI();
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
startRecordingTimer();
|
|
587
|
+
} catch (Exception startEx) {
|
|
588
|
+
startEx.printStackTrace();
|
|
589
|
+
isRecording = false;
|
|
590
|
+
}
|
|
579
591
|
} catch (Exception e) {
|
|
580
592
|
e.printStackTrace();
|
|
593
|
+
isRecording = false;
|
|
581
594
|
}
|
|
582
595
|
}
|
|
583
596
|
|
|
@@ -596,8 +609,15 @@ public class CustomVideoRecorder extends Plugin {
|
|
|
596
609
|
Runnable timerRunnable = new Runnable() {
|
|
597
610
|
@Override
|
|
598
611
|
public void run() {
|
|
612
|
+
if (!isRecording) return; // Salir si ya no está grabando
|
|
613
|
+
|
|
599
614
|
timeRemaining--;
|
|
600
|
-
|
|
615
|
+
|
|
616
|
+
getActivity().runOnUiThread(() -> {
|
|
617
|
+
if (overlayView != null) {
|
|
618
|
+
overlayView.updateUI();
|
|
619
|
+
}
|
|
620
|
+
});
|
|
601
621
|
|
|
602
622
|
if (timeRemaining > 0) {
|
|
603
623
|
handler.postDelayed(this, 1000);
|
|
@@ -610,21 +630,58 @@ public class CustomVideoRecorder extends Plugin {
|
|
|
610
630
|
}
|
|
611
631
|
|
|
612
632
|
private void stopRecordingInternal() {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
633
|
+
getActivity().runOnUiThread(() -> {
|
|
634
|
+
try {
|
|
635
|
+
if (mediaRecorder != null) {
|
|
636
|
+
try {
|
|
637
|
+
mediaRecorder.stop();
|
|
638
|
+
} catch (RuntimeException e) {
|
|
639
|
+
// Ignorar si ya estaba detenido
|
|
640
|
+
e.printStackTrace();
|
|
641
|
+
}
|
|
642
|
+
mediaRecorder.reset();
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
isRecording = false;
|
|
646
|
+
|
|
647
|
+
if (overlayView != null) {
|
|
648
|
+
overlayView.updateUI();
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
// Notificar al JavaScript con el path del video
|
|
652
|
+
JSObject ret = new JSObject();
|
|
653
|
+
ret.put("success", true);
|
|
654
|
+
ret.put("videoPath", videoFilePath);
|
|
655
|
+
notifyListeners("recordingComplete", ret);
|
|
656
|
+
|
|
657
|
+
// Cerrar el preview después de notificar (dar tiempo al JS para procesar)
|
|
658
|
+
new Handler().postDelayed(() -> {
|
|
659
|
+
try {
|
|
660
|
+
closeCamera();
|
|
661
|
+
if (overlayView != null) {
|
|
662
|
+
ViewGroup parent = (ViewGroup) overlayView.getParent();
|
|
663
|
+
if (parent != null) {
|
|
664
|
+
parent.removeView(overlayView);
|
|
665
|
+
}
|
|
666
|
+
overlayView = null;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
getBridge().getWebView().setBackgroundColor(0xFFFFFFFF);
|
|
670
|
+
getBridge().getWebView().setVisibility(View.VISIBLE);
|
|
671
|
+
} catch (Exception e) {
|
|
672
|
+
e.printStackTrace();
|
|
673
|
+
}
|
|
674
|
+
}, 500);
|
|
675
|
+
|
|
676
|
+
} catch (Exception e) {
|
|
677
|
+
e.printStackTrace();
|
|
678
|
+
|
|
679
|
+
// En caso de error, notificar también
|
|
680
|
+
JSObject ret = new JSObject();
|
|
681
|
+
ret.put("success", false);
|
|
682
|
+
ret.put("error", e.getMessage());
|
|
683
|
+
notifyListeners("recordingComplete", ret);
|
|
684
|
+
}
|
|
685
|
+
});
|
|
629
686
|
}
|
|
630
687
|
}
|
package/package.json
CHANGED