diff --git a/LFLiveKit.podspec b/LFLiveKit.podspec index d9daa20c..4e127516 100644 --- a/LFLiveKit.podspec +++ b/LFLiveKit.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| s.name = "LFLiveKit" - s.version = "2.8" + s.version = "2.9" s.summary = "LaiFeng ios Live. LFLiveKit." s.homepage = "https://github.com/chenliming777" s.license = { :type => "MIT", :file => "LICENSE" } diff --git a/LFLiveKit/LFLiveSession.h b/LFLiveKit/LFLiveSession.h index eb7c1f43..e57dacd2 100755 --- a/LFLiveKit/LFLiveSession.h +++ b/LFLiveKit/LFLiveSession.h @@ -159,6 +159,6 @@ typedef NS_ENUM(NSInteger,LFLiveCaptureTypeMask) { -(void)loadCustomFilter:(int)input; - (void) turnFlashLightOff; - (void) turnFlashLightOn; - +-(void)captureCamera; @end diff --git a/LFLiveKit/LFLiveSession.m b/LFLiveKit/LFLiveSession.m index 1f74feb1..9feb843c 100755 --- a/LFLiveKit/LFLiveSession.m +++ b/LFLiveKit/LFLiveSession.m @@ -436,5 +436,7 @@ - (void) turnFlashLightOff{ - (void) turnFlashLightOn{ [_videoCaptureSource turnFlashLightOn]; } - +-(void)captureCamera{ + [_videoCaptureSource captureCamera]; +} @end diff --git a/LFLiveKit/capture/LFVideoCapture.h b/LFLiveKit/capture/LFVideoCapture.h index 837bebb3..a2682654 100755 --- a/LFLiveKit/capture/LFVideoCapture.h +++ b/LFLiveKit/capture/LFVideoCapture.h @@ -83,4 +83,5 @@ -(void)loadCustomFilter:(int)input; - (void) turnFlashLightOff; - (void) turnFlashLightOn; +-(void)captureCamera; @end diff --git a/LFLiveKit/capture/LFVideoCapture.m b/LFLiveKit/capture/LFVideoCapture.m index 113cf06d..5c8e4b9e 100755 --- a/LFLiveKit/capture/LFVideoCapture.m +++ b/LFLiveKit/capture/LFVideoCapture.m @@ -72,6 +72,7 @@ - (void)dealloc { - (void) turnFlashLightOn{ + if(_videoCamera.inputCamera.hasTorch){ [_videoCamera.inputCamera lockForConfiguration:nil]; _videoCamera.inputCamera.torchMode = AVCaptureTorchModeOn; @@ -100,6 +101,13 @@ - (GPUImageVideoCamera *)videoCamera{ return _videoCamera; } +-(void)captureCamera{ + [_filter useNextFrameForImageCapture]; + UIImage *image = [_filter imageFromCurrentFramebuffer]; + UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil); + +} + - (void)setRunning:(BOOL)running { if (_running == running) return; _running = running;