Skip to content

Commit

Permalink
fix #386 解决录制视频小于0.3s时,按照拍照处理,但照片为nil的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
longitachi committed Oct 17, 2019
1 parent f659593 commit 590bc30
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ZLPhotoBrowser/PhotoBrowser/ZLCustomCamera.m
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ - (void)onTakePicture
_takedImageView.contentMode = UIViewContentModeScaleAspectFit;
[self.view insertSubview:_takedImageView belowSubview:self.toolView];
}

__weak typeof(self) weakSelf = self;
[self.imageOutPut captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) {
if (imageDataSampleBuffer == NULL) {
Expand Down Expand Up @@ -852,7 +853,6 @@ - (void)onStartRecord
- (void)onFinishRecord
{
[self.movieFileOutPut stopRecording];
[self.session stopRunning];
[self setVideoZoomFactor:1];
}

Expand Down Expand Up @@ -933,7 +933,7 @@ - (void)captureOutput:(AVCaptureFileOutput *)output didFinishRecordingToOutputFi
return;
}
}

[self.session stopRunning];
self.videoUrl = outputFileURL;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self playVideo];
Expand Down

0 comments on commit 590bc30

Please sign in to comment.