@@ -451,8 +451,8 @@ - (void)record:(NSDictionary *)options resolve:(RCTPromiseResolveBlock)resolve r
451
451
[connection setVideoOrientation: [RNCameraUtils videoOrientationForDeviceOrientation: [[UIDevice currentDevice ] orientation ]]];
452
452
453
453
if (options[@" codec" ]) {
454
- AVVideoCodecType videoCodecType = options[@" codec" ];
455
454
if (@available (iOS 10 , *)) {
455
+ AVVideoCodecType videoCodecType = options[@" codec" ];
456
456
if ([self .movieFileOutput.availableVideoCodecTypes containsObject: videoCodecType]) {
457
457
[self .movieFileOutput setOutputSettings: @{AVVideoCodecKey:videoCodecType} forConnection: connection];
458
458
self.videoCodecType = videoCodecType;
@@ -812,12 +812,15 @@ - (void)captureOutput:(AVCaptureFileOutput *)captureOutput didFinishRecordingToO
812
812
}
813
813
}
814
814
if (success && self.videoRecordedResolve != nil ) {
815
- AVVideoCodecType videoCodec = self.videoCodecType ;
816
- if (videoCodec == nil ) {
817
- videoCodec = [self .movieFileOutput.availableVideoCodecTypes firstObject ];
815
+ if (@available (iOS 10 , *)) {
816
+ AVVideoCodecType videoCodec = self.videoCodecType ;
817
+ if (videoCodec == nil ) {
818
+ videoCodec = [self .movieFileOutput.availableVideoCodecTypes firstObject ];
819
+ }
820
+ self.videoRecordedResolve (@{ @" uri" : outputFileURL.absoluteString , @" codec" :videoCodec });
821
+ } else {
822
+ self.videoRecordedResolve (@{ @" uri" : outputFileURL.absoluteString });
818
823
}
819
-
820
- self.videoRecordedResolve (@{ @" uri" : outputFileURL.absoluteString , @" codec" :videoCodec });
821
824
} else if (self.videoRecordedReject != nil ) {
822
825
self.videoRecordedReject (@" E_RECORDING_FAILED" , @" An error occurred while recording a video." , error);
823
826
}
0 commit comments