add output to session only when possible
This commit is contained in:
parent
94c24b2c40
commit
a753c508ed
|
@ -308,11 +308,15 @@ RCT_ENUM_CONVERTER(CKCameraZoomMode, (@{
|
|||
{
|
||||
if (onReadCode) {
|
||||
_onReadCode = onReadCode;
|
||||
self.metadataOutput = [[AVCaptureMetadataOutput alloc] init];
|
||||
|
||||
AVCaptureMetadataOutput * output = [[AVCaptureMetadataOutput alloc] init];
|
||||
if ([self.session canAddOutput:output]) {
|
||||
self.metadataOutput = output;
|
||||
[self.session addOutput:self.metadataOutput];
|
||||
[self.metadataOutput setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()];
|
||||
[self.metadataOutput setMetadataObjectTypes:[self.metadataOutput availableMetadataObjectTypes]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-(void)handleCameraPermission {
|
||||
|
|
Loading…
Reference in New Issue