diff --git a/LFLiveKit.podspec b/LFLiveKit.podspec index 9f5fc8f5..d9daa20c 100644 --- a/LFLiveKit.podspec +++ b/LFLiveKit.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| s.name = "LFLiveKit" - s.version = "2.7" + s.version = "2.8" s.summary = "LaiFeng ios Live. LFLiveKit." s.homepage = "https://github.com/chenliming777" s.license = { :type => "MIT", :file => "LICENSE" } diff --git a/LFLiveKit/capture/LFVideoCapture.m b/LFLiveKit/capture/LFVideoCapture.m index 214181be..113cf06d 100755 --- a/LFLiveKit/capture/LFVideoCapture.m +++ b/LFLiveKit/capture/LFVideoCapture.m @@ -72,11 +72,20 @@ - (void)dealloc { - (void) turnFlashLightOn{ - [_videoCamera.inputCamera setTorchModeOnWithLevel:1.0 error:nil]; + if(_videoCamera.inputCamera.hasTorch){ + [_videoCamera.inputCamera lockForConfiguration:nil]; + _videoCamera.inputCamera.torchMode = AVCaptureTorchModeOn; + [_videoCamera.inputCamera setTorchModeOnWithLevel:1.0 error:nil]; + [_videoCamera.inputCamera unlockForConfiguration]; + } } - (void) turnFlashLightOff{ - [_videoCamera.inputCamera setTorchModeOnWithLevel:0 error:nil]; + if(_videoCamera.inputCamera.hasTorch){ + [_videoCamera.inputCamera lockForConfiguration:nil]; + _videoCamera.inputCamera.torchMode = AVCaptureTorchModeOff; + [_videoCamera.inputCamera unlockForConfiguration]; + } } #pragma mark -- Setter Getter