@carviz/capacitor-camera-preview 7.2.2 → 7.2.4

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.
@@ -94,7 +94,7 @@ class CameraController: NSObject {
94
94
 
95
95
  // Configure video data output for sample capture
96
96
  self.videoDataOutput.setSampleBufferDelegate(self, queue: DispatchQueue(label: "videoQueue"))
97
- self.videoDataOutput.videoSettings = [kCVPixelBufferPixelFormatTypeKey as String: Int(kCVPixelFormatType_420YpCbCr8BiPlanarFullRange)]
97
+ self.videoDataOutput.videoSettings = [kCVPixelBufferPixelFormatTypeKey as String: Int(kCVPixelFormatType_32BGRA)]
98
98
  if captureSession.canAddOutput(self.videoDataOutput) {
99
99
  captureSession.addOutput(self.videoDataOutput)
100
100
 
@@ -544,7 +544,7 @@ extension CameraController: AVCaptureVideoDataOutputSampleBufferDelegate {
544
544
  // Clear the completion block to avoid capturing multiple frames for one request
545
545
  self.sampleBufferCaptureCompletionBlock = nil
546
546
 
547
- // Convert sample buffer to UIImage using a more direct approach
547
+ // Convert sample buffer to UIImage using a simple, reliable approach
548
548
  guard let image = self.imageFromSampleBuffer(sampleBuffer) else {
549
549
  DispatchQueue.main.async {
550
550
  completion(nil, CameraControllerError.unknown)
@@ -563,19 +563,20 @@ extension CameraController: AVCaptureVideoDataOutputSampleBufferDelegate {
563
563
  return nil
564
564
  }
565
565
 
566
- // Use CIImage for YUV to RGB conversion, but ensure we get the full extent
566
+ // Create CIImage from pixel buffer - this preserves the full frame
567
567
  let ciImage = CIImage(cvPixelBuffer: pixelBuffer)
568
- let context = CIContext()
569
568
 
570
- // Make sure we use the full extent of the image
571
- let rect = CGRect(x: 0, y: 0, width: ciImage.extent.width, height: ciImage.extent.height)
569
+ // Use CIContext to render the image
570
+ let context = CIContext(options: [.useSoftwareRenderer: false])
572
571
 
573
- guard let cgImage = context.createCGImage(ciImage, from: rect) else {
572
+ // Create CGImage from the FULL extent of the CIImage
573
+ guard let cgImage = context.createCGImage(ciImage, from: ciImage.extent) else {
574
574
  return nil
575
575
  }
576
576
 
577
- // Create UIImage with proper orientation
578
- return UIImage(cgImage: cgImage, scale: 1.0, orientation: .up)
577
+ // Create UIImage and apply orientation fix like the capture function does
578
+ let image = UIImage(cgImage: cgImage, scale: 1.0, orientation: .up)
579
+ return image.fixedOrientation()
579
580
  }
580
581
  }
581
582
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carviz/capacitor-camera-preview",
3
- "version": "7.2.2",
3
+ "version": "7.2.4",
4
4
  "description": "Fork of the capacitor-community/camera-preview plugin focusing on high resolution photos without bloating up the code.",
5
5
  "type": "module",
6
6
  "main": "dist/plugin.cjs.js",