@capgo/camera-preview 7.23.3 → 7.23.5

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.
@@ -455,14 +455,14 @@ public class CameraPreview
455
455
  }
456
456
 
457
457
  if (cameraXView != null) {
458
- if (cameraXView.isRunning()) {
459
- cameraXView.stopSession();
460
- }
458
+ cameraXView.stopSession();
461
459
  // Only drop the reference if no deferred stop is pending
462
460
  if (!cameraXView.isStopDeferred()) {
463
461
  cameraXView = null;
464
462
  }
465
463
  }
464
+ // Manual stops should not trigger automatic resume with stale config
465
+ lastSessionConfig = null;
466
466
  // Restore original window background if modified earlier
467
467
  if (originalWindowBackground != null) {
468
468
  try {
@@ -1785,9 +1785,15 @@ public class CameraPreview
1785
1785
  }
1786
1786
 
1787
1787
  @Override
1788
- public void onCameraStopped() {
1789
- // Ensure reference is cleared once underlying CameraXView has fully stopped
1790
- cameraXView = null;
1788
+ public void onCameraStopped(CameraXView source) {
1789
+ if (cameraXView != null && cameraXView != source) {
1790
+ Log.d(TAG, "onCameraStopped: ignoring callback from stale instance");
1791
+ return;
1792
+ }
1793
+ // Ensure reference is cleared once the originating CameraXView has fully stopped
1794
+ if (cameraXView == source) {
1795
+ cameraXView = null;
1796
+ }
1791
1797
 
1792
1798
  PluginCall queuedCall = null;
1793
1799
  synchronized (pendingStartLock) {
@@ -111,7 +111,7 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
111
111
  void onSampleTakenError(String message);
112
112
  void onCameraStarted(int width, int height, int x, int y);
113
113
  void onCameraStartError(String message);
114
- void onCameraStopped();
114
+ void onCameraStopped(CameraXView source);
115
115
  }
116
116
 
117
117
  public interface VideoRecordingCallback {
@@ -470,7 +470,7 @@ public class CameraXView implements LifecycleOwner, LifecycleObserver {
470
470
  }
471
471
  if (listener != null) {
472
472
  try {
473
- listener.onCameraStopped();
473
+ listener.onCameraStopped(this);
474
474
  } catch (Exception ignored) {}
475
475
  }
476
476
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/camera-preview",
3
- "version": "7.23.3",
3
+ "version": "7.23.5",
4
4
  "description": "Camera preview",
5
5
  "license": "MIT",
6
6
  "repository": {