Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #40

Merged
merged 14 commits into from
May 24, 2015
Merged
10 changes: 5 additions & 5 deletions LLSimpleCamera.podspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Pod::Spec.new do |s|
s.name = "LLSimpleCamera"
s.version = "2.2.0"
s.summary = "LLSimpleCamera: A simple customizable camera control."
s.version = "3.0.0"
s.summary = "LLSimpleCamera: A simple customizable camera - video recorder control."
s.description = <<-DESC
LLSimpleCamera is a library for creating a customized camera screens similar to snapchat's. You don't have to present the camera in a new view controller.
LLSimpleCamera is a library for creating a customized camera screens similar to snapchat's. You don't have to present the camera in a new view controller. You can capture images or record videos very easily.

LLSimpleCamera:
will let you easily capture photos
will let you easily capture photos or record videos
handles the position and flash of the camera
hides the nitty gritty details from the developer
DESC
Expand All @@ -15,7 +15,7 @@ hides the nitty gritty details from the developer
s.license = { :type => 'APACHE', :file => 'LICENSE' }
s.author = { "Ömer Faruk Gül" => "omergul123@gmail.com" }
s.platform = :ios,'7.0'
s.source = { :git => "https://github.com/omergul123/LLSimpleCamera.git", :tag => "v2.2.0" }
s.source = { :git => "https://github.com/omergul123/LLSimpleCamera.git", :tag => "v3.0.0" }
s.source_files = 'LLSimpleCamera/*.{h,m}'
s.requires_arc = true
s.framework = 'AVFoundation'
Expand Down
96 changes: 68 additions & 28 deletions LLSimpleCamera/LLSimpleCamera.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//
// CameraViewController.h
// Frizzbee
// LLSimpleCamera
//
// Created by Ömer Faruk Gül on 24/10/14.
// Copyright (c) 2014 Louvre Digital. All rights reserved.
// Copyright (c) 2014 Ömer Farul Gül. All rights reserved.
//

#import <UIKit/UIKit.h>
Expand All @@ -21,17 +21,12 @@ typedef enum : NSUInteger {
CameraFlashAuto
} CameraFlash;

typedef enum : NSUInteger {
CameraQualityLow,
CameraQualityMedium,
CameraQualityHigh,
CameraQualityPhoto
} CameraQuality;

extern NSString *const LLSimpleCameraErrorDomain;
typedef enum : NSUInteger {
LLSimpleCameraErrorCodePermission = 10,
LLSimpleCameraErrorCodeSession = 11
LLSimpleCameraErrorCodeCameraPermission = 10,
LLSimpleCameraErrorCodeMicrophonePermission = 11,
LLSimpleCameraErrorCodeSession = 12,
LLSimpleCameraErrorCodeVideoNotEnabled = 13
} LLSimpleCameraErrorCode;

@interface LLSimpleCamera : UIViewController
Expand All @@ -46,6 +41,12 @@ typedef enum : NSUInteger {
*/
@property (nonatomic, copy) void (^onError)(LLSimpleCamera *camera, NSError *error);

/**
* Camera quality, set a constants prefixed with AVCaptureSessionPreset.
* Make sure to call before calling -(void)initialize method, otherwise it would be late.
*/
@property (copy, nonatomic) NSString *cameraQuality;

/**
* Camera flash mode.
*/
Expand All @@ -56,6 +57,16 @@ typedef enum : NSUInteger {
*/
@property (nonatomic) CameraPosition position;

/**
* Boolean value to indicate if the video is enabled.
*/
@property (nonatomic, getter=isVideoEnabled) BOOL videoEnabled;

/**
* Boolean value to indicate if the camera is recording a video at the current moment.
*/
@property (nonatomic, getter=isRecording) BOOL recording;

/**
* Fixess the orientation after the image is captured is set to Yes.
* see: http://stackoverflow.com/questions/5427656/ios-uiimagepickercontroller-result-image-orientation-after-upload
Expand All @@ -73,11 +84,27 @@ typedef enum : NSUInteger {
*/
@property (nonatomic) BOOL useDeviceOrientation;

/**
* Use this method to request camera permission before initalizing LLSimpleCamera.
*/
+ (void)requestCameraPermission:(void (^)(BOOL granted))completionBlock;

/**
* Use this method to request microphone permission before initalizing LLSimpleCamera.
*/
+ (void)requestMicrophonePermission:(void (^)(BOOL granted))completionBlock;

/**
* Returns an instance of LLSimpleCamera with the given quality.
* @param quality The quality of the camera.
* Quality parameter could be any variable starting with AVCaptureSessionPreset.
*/
- (instancetype)initWithQuality:(NSString *)quality position:(CameraPosition)position videoEnabled:(BOOL)videoEnabled;

/**
* Returns an instance of LLSimpleCamera with quality "AVCaptureSessionPresetHigh" and position "CameraPositionBack".
* @param videEnabled: Set to YES to enable video recording.
*/
- (instancetype)initWithQuality:(CameraQuality)quality andPosition:(CameraPosition)position;
- (instancetype)initWithVideoEnabled:(BOOL)videoEnabled;

/**
* Starts running the camera session.
Expand All @@ -89,6 +116,29 @@ typedef enum : NSUInteger {
*/
- (void)stop;

/**
* Capture an image.
* @param onCapture a block triggered after the capturing the photo.
* @param exactSeenImage If set YES, then the image is cropped to the exact size as the preview. So you get exactly what you see.
*/
-(void)capture:(void (^)(LLSimpleCamera *camera, UIImage *image, NSDictionary *metadata, NSError *error))onCapture exactSeenImage:(BOOL)exactSeenImage;

/**
* Capture an image.
* @param onCapture a block triggered after the capturing the photo.
*/
-(void)capture:(void (^)(LLSimpleCamera *camera, UIImage *image, NSDictionary *metadata, NSError *error))onCapture;

/*
* Start recording a video. Video is saved to the given url.
*/
- (void)startRecordingWithOutputUrl:(NSURL *)url;

/**
* Stop recording video with a completion block.
*/
- (void)stopRecording:(void (^)(LLSimpleCamera *camera, NSURL *outputFileUrl, NSError *error))completionBlock;

/**
* Attaches the LLSimpleCamera to another view controller with a frame. It basically adds the LLSimpleCamera as a
* child vc to the given vc.
Expand All @@ -112,26 +162,16 @@ typedef enum : NSUInteger {
*/
- (BOOL)isFlashAvailable;

/**
* Checks if torch (flash for video) is avilable for the currently active device.
*/
- (BOOL)isTorchAvailable;

/**
* Alter the layer and the animation displayed when the user taps on screen.
* @param layer Layer to be displayed
* @param animation to be applied after the layer is shown
*/
- (void)alterFocusBox:(CALayer *)layer animation:(CAAnimation *)animation;


/**
* Capture the image.
* @param onCapture a block triggered after the capturing the photo.
* @param exactSeenImage If set YES, then the image is cropped to the exact size as the preview. So you get exactly what you see.
*/
-(void)capture:(void (^)(LLSimpleCamera *camera, UIImage *image, NSDictionary *metadata, NSError *error))onCapture exactSeenImage:(BOOL)exactSeenImage;

/**
* Capture the image.
* @param onCapture a block triggered after the capturing the photo.
*/
-(void)capture:(void (^)(LLSimpleCamera *camera, UIImage *image, NSDictionary *metadata, NSError *error))onCapture;


@end
Loading