init preview each time view requested
This commit is contained in:
parent
13384afdcf
commit
2eac22d151
|
@ -22,6 +22,11 @@ RCT_EXPORT_MODULE();
|
||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
{
|
{
|
||||||
|
self.session = [AVCaptureSession new];
|
||||||
|
|
||||||
|
self.previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:self.session];
|
||||||
|
self.previewLayer.needsDisplayOnBoundsChange = YES;
|
||||||
|
|
||||||
return [[RCTCamera alloc] initWithManager:self bridge:self.bridge];
|
return [[RCTCamera alloc] initWithManager:self bridge:self.bridge];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,18 +147,10 @@ RCT_EXPORT_VIEW_PROPERTY(onZoomChanged, BOOL)
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)init {
|
- (id)init {
|
||||||
|
|
||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
self.mirrorImage = false;
|
self.mirrorImage = false;
|
||||||
|
|
||||||
self.session = [AVCaptureSession new];
|
|
||||||
|
|
||||||
self.previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:self.session];
|
|
||||||
self.previewLayer.needsDisplayOnBoundsChange = YES;
|
|
||||||
|
|
||||||
self.sessionQueue = dispatch_queue_create("cameraManagerQueue", DISPATCH_QUEUE_SERIAL);
|
self.sessionQueue = dispatch_queue_create("cameraManagerQueue", DISPATCH_QUEUE_SERIAL);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue