scoplan.camera 1.2.10 → 1.2.11

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scoplan.camera",
3
- "version": "1.2.10",
3
+ "version": "1.2.11",
4
4
  "description": "",
5
5
  "cordova": {
6
6
  "id": "scoplan.camera",
@@ -302,19 +302,16 @@ public class CameraFragment extends Fragment implements scoplan.camera.OnImageCa
302
302
  getActivity().runOnUiThread(() -> {
303
303
  if (!isAdded()) return;
304
304
  ViewGroup.LayoutParams layoutParams = surfaceView.getLayoutParams();
305
- boolean sizeChanged = layoutParams.width != displaySize.getWidth()
306
- || layoutParams.height != displaySize.getHeight();
307
305
  layoutParams.width = displaySize.getWidth();
308
306
  layoutParams.height = displaySize.getHeight();
309
307
  surfaceView.setLayoutParams(layoutParams);
310
308
  // Set buffer to camera native resolution
311
309
  mSurfaceHolder.setFixedSize(optimalPreviewSize.getWidth(), optimalPreviewSize.getHeight());
312
310
  surfaceSizeConfigured = true;
313
- // If size didn't change, surfaceChanged won't fire, so call createCameraPreview directly
314
- if (!sizeChanged) {
315
- createCameraPreview();
316
- }
317
- // Otherwise surfaceChanged will be called → createCameraPreview
311
+ // Always call createCameraPreview directly.
312
+ // surfaceChanged may or may not fire depending on the device;
313
+ // createCameraPreview is safe to call multiple times (guarded by previewReady).
314
+ createCameraPreview();
318
315
  });
319
316
  return;
320
317
  }
@@ -374,6 +371,10 @@ public class CameraFragment extends Fragment implements scoplan.camera.OnImageCa
374
371
  if (cameraId != null ) {
375
372
  return;
376
373
  }
374
+ // Ensure background thread is started
375
+ if (mBackgroundHandler == null) {
376
+ startBackgroundThread();
377
+ }
377
378
  for (String id : manager.getCameraIdList()) {
378
379
  CameraCharacteristics cameraCharacteristics =
379
380
  manager.getCameraCharacteristics(id);
@@ -399,7 +400,7 @@ public class CameraFragment extends Fragment implements scoplan.camera.OnImageCa
399
400
  }, CAMERA_REQUEST_PERMISSION);
400
401
  return;
401
402
  }
402
- manager.openCamera(cameraId, stateCallback,null);
403
+ manager.openCamera(cameraId, stateCallback, mBackgroundHandler);
403
404
  } catch (Exception e) {
404
405
  Sentry.captureException(e);
405
406
  this.failedCapture();