@@ -4201,3 +4201,91 @@ RCT_EXPORT_METHOD(tokenize:(NSString *)text
42014201}
42024202
42034203@end
4204+
4205+// ── Section 54: Camera View ─────────────────────────────────────────────────
4206+// Live camera preview using AVCaptureVideoPreviewLayer
4207+
4208+@interface RCTCameraView : NSView
4209+@property (nonatomic, assign) BOOL active;
4210+@property (nonatomic, strong) AVCaptureSession *session;
4211+@property (nonatomic, strong) AVCaptureVideoPreviewLayer *previewLayer;
4212+@end
4213+
4214+@implementation RCTCameraView
4215+
4216+- (instancetype)initWithFrame:(NSRect)frame {
4217+ if (self = [super initWithFrame:frame]) {
4218+ self.wantsLayer = YES;
4219+ _active = NO;
4220+ }
4221+ return self;
4222+}
4223+
4224+- (NSSize)intrinsicContentSize {
4225+ return NSMakeSize(NSViewNoIntrinsicMetric, NSViewNoIntrinsicMetric);
4226+}
4227+
4228+- (void)setActive:(BOOL)active {
4229+ _active = active;
4230+ if (active) {
4231+ [self startCapture];
4232+ } else {
4233+ [self stopCapture];
4234+ }
4235+}
4236+
4237+- (void)startCapture {
4238+ if (_session) return;
4239+
4240+ AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
4241+ if (!device) {
4242+ NSLog(@"[CameraView] No video device found");
4243+ return;
4244+ }
4245+
4246+ NSError *error = nil;
4247+ AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device error:&error];
4248+ if (error) {
4249+ NSLog(@"[CameraView] Input error: %@", error);
4250+ return;
4251+ }
4252+
4253+ _session = [[AVCaptureSession alloc] init];
4254+ _session.sessionPreset = AVCaptureSessionPresetMedium;
4255+ [_session addInput:input];
4256+
4257+ _previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:_session];
4258+ _previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
4259+ _previewLayer.frame = self.bounds;
4260+ [self.layer addSublayer:_previewLayer];
4261+
4262+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
4263+ [self->_session startRunning];
4264+ });
4265+}
4266+
4267+- (void)stopCapture {
4268+ if (!_session) return;
4269+ [_session stopRunning];
4270+ [_previewLayer removeFromSuperlayer];
4271+ _previewLayer = nil;
4272+ _session = nil;
4273+}
4274+
4275+- (void)layout {
4276+ [super layout];
4277+ _previewLayer.frame = self.bounds;
4278+}
4279+
4280+- (void)dealloc {
4281+ [self stopCapture];
4282+}
4283+
4284+@end
4285+
4286+@interface RCTCameraViewManager : RCTViewManager @end
4287+@implementation RCTCameraViewManager
4288+RCT_EXPORT_MODULE(MacOSCameraView)
4289+- (NSView *)view { return [[RCTCameraView alloc] initWithFrame:CGRectZero]; }
4290+RCT_EXPORT_VIEW_PROPERTY(active, BOOL)
4291+@end