Commit 1282c7233b501fc45b7946e6b783a5ee7765a4ce

Authored by 梁星国
1 parent 09d4bc2d

提交0.0.14

CNLiveAVCamera.podspec
... ... @@ -8,7 +8,7 @@
8 8  
9 9 Pod::Spec.new do |s|
10 10 s.name = 'CNLiveAVCamera'
11   - s.version = '0.1.3'
  11 + s.version = '0.1.4'
12 12 s.summary = '自定义相机'
13 13  
14 14 # This description is used to generate tags and improve search results.
... ...
CNLiveAVCamera/Classes/XFCameraController.m
... ... @@ -459,13 +459,29 @@ typedef void(^PropertyChangeBlock)(AVCaptureDevice *captureDevice);
459 459  
460 460 [self startAnimationGroup];
461 461  
  462 + AVCaptureDevice *currentDevice = [self.videoInput device];
  463 + AVCaptureDevicePosition currentPosition = [currentDevice position];
  464 +
  465 + if (currentPosition == AVCaptureDevicePositionBack) {
  466 + self.flashButton.hidden = NO;
  467 + }else {
  468 + self.flashButton.hidden = YES;
  469 + }
462 470 }
463 471  
464 472 /**
465 473 * 确认按钮并返回代理
466 474 */
467   -- (void)confirmBtnFunc
  475 +- (void)confirmBtnFunc:(UIButton *)btn
468 476 {
  477 + [self confirmBtnDisplayFunc:btn];
  478 +
  479 +}
  480 +
  481 +#pragma mark - 延迟执行
  482 +- (void)confirmBtnDisplayFunc:(UIButton *)sender {
  483 +
  484 + sender.enabled = NO;
469 485  
470 486 if (self.playerLayer) {
471 487 self.playerLayer.hidden = YES;
... ... @@ -498,8 +514,7 @@ typedef void(^PropertyChangeBlock)(AVCaptureDevice *captureDevice);
498 514  
499 515 // }];
500 516  
501   - self.confirmButton.userInteractionEnabled = NO;
502   -
  517 + sender.enabled = YES;
503 518 }
504 519 else
505 520 {
... ... @@ -540,9 +555,8 @@ typedef void(^PropertyChangeBlock)(AVCaptureDevice *captureDevice);
540 555 [[NSFileManager defaultManager] removeItemAtURL:weakSelf.videoURL error:nil];
541 556 weakSelf.videoURL = nil;
542 557 }
  558 + sender.enabled = YES;
543 559 }
544   -
545   - weakSelf.confirmButton.userInteractionEnabled = NO;
546 560 }];
547 561  
548 562 // [XFPhotoLibraryManager saveVideoWithVideoUrl:outputURL andAssetCollectionName:nil withCompletion:^(NSURL *videoUrl, NSError *error) {
... ... @@ -578,10 +592,17 @@ typedef void(^PropertyChangeBlock)(AVCaptureDevice *captureDevice);
578 592 [[NSFileManager defaultManager] removeItemAtURL:weakSelf.videoURL error:nil];
579 593 weakSelf.videoURL = nil;
580 594 [[NSFileManager defaultManager] removeItemAtURL:outputURL error:nil];
  595 + sender.enabled = YES;
581 596 }
582 597 }];
583 598 }
  599 +
584 600 }
  601 +
  602 +
  603 +
  604 +
  605 +
585 606 #pragma mark - 懒加载
586 607 - (AVCaptureSession *)captureSession
587 608 {
... ... @@ -702,7 +723,7 @@ typedef void(^PropertyChangeBlock)(AVCaptureDevice *captureDevice);
702 723 {
703 724 _confirmButton = [[UIButton alloc] init];
704 725 [_confirmButton setImage:[UIImage imageNamedFromMyBundle:@"fb_wancheng"] forState:UIControlStateNormal];
705   - [_confirmButton addTarget:self action:@selector(confirmBtnFunc) forControlEvents:UIControlEventTouchUpInside];
  726 + [_confirmButton addTarget:self action:@selector(confirmBtnFunc:) forControlEvents:UIControlEventTouchUpInside];
706 727 // _confirmButton.cs_acceptEventInterval = 2.0f;
707 728  
708 729 }
... ... @@ -846,6 +867,11 @@ typedef void(^PropertyChangeBlock)(AVCaptureDevice *captureDevice);
846 867  
847 868 CALayer *layer = self.view.layer;
848 869  
  870 + if (IS_IPhoneX_All) {
  871 + _captureVideoPreviewLayer.frame = CGRectMake(0, 88, KScreenWidth, KScreenHeight - 88 - kVerticalBottomSafeHeight);
  872 + }else {
  873 + _captureVideoPreviewLayer.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
  874 + }
849 875 _captureVideoPreviewLayer.frame = CGRectMake(0, 0, k_ScreenWidth, KScreenHeight);
850 876 _captureVideoPreviewLayer.xf_centerY = self.view.centerY;
851 877  
... ... @@ -1448,9 +1474,9 @@ typedef void(^PropertyChangeBlock)(AVCaptureDevice *captureDevice);
1448 1474 - (NSString *)createVideoFolderPath
1449 1475 {
1450 1476  
1451   -#pragma mark - TODO: 存储路径
  1477 +#pragma mark - 存储路径
1452 1478  
1453   - if (self.outPutPath) {
  1479 + if (self.outPutPath.length > 0) {
1454 1480 return [self checkFilePath:self.outPutPath];
1455 1481 }
1456 1482 return [self chatFilePathByName:@"相机"];
... ...