Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions LLSimpleCamera/LLSimpleCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ typedef enum : NSUInteger {
*/
- (void)alterFocusBox:(CALayer *)layer animation:(CAAnimation *)animation;

/**
* Function to zoom the camera from code
*
* @param factor from 0.0 to 1.0
*/
- (void) scaleToFactor:(CGFloat)factor;

/**
* Checks is the front camera is available.
*/
Expand All @@ -224,4 +231,8 @@ typedef enum : NSUInteger {
* Checks is the rear camera is available.
*/
+ (BOOL)isRearCameraAvailable;




@end
12 changes: 12 additions & 0 deletions LLSimpleCamera/LLSimpleCamera.m
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,18 @@ - (void)handlePinchGesture:(UIPinchGestureRecognizer *)recognizer
}
}

#pragma mark - Zooming programmatically
- (void) scaleToFactor:(CGFloat)factor
{
NSError *error = nil;
if ([self.videoCaptureDevice lockForConfiguration:&error])
{
[self.videoCaptureDevice rampToVideoZoomFactor:factor withRate:10];

[self.videoCaptureDevice unlockForConfiguration];
}
}

#pragma mark - Camera

- (void)attachToViewController:(UIViewController *)vc withFrame:(CGRect)frame
Expand Down