2015-04-02 09:40:03 +00:00
|
|
|
#import "RCTBridge.h"
|
2015-04-01 01:02:57 +00:00
|
|
|
#import "RCTCamera.h"
|
2015-04-02 09:40:03 +00:00
|
|
|
#import "RCTCameraManager.h"
|
2015-04-01 01:02:57 +00:00
|
|
|
#import "RCTLog.h"
|
2015-04-08 20:51:31 +00:00
|
|
|
#import "RCTUtils.h"
|
2015-04-11 02:56:30 +00:00
|
|
|
|
2015-04-01 01:02:57 +00:00
|
|
|
#import <AVFoundation/AVFoundation.h>
|
|
|
|
|
|
|
|
@implementation RCTCamera
|
|
|
|
|
2015-04-01 17:32:53 +00:00
|
|
|
- (void)setAspect:(NSString *)aspect
|
2015-04-01 01:02:57 +00:00
|
|
|
{
|
2015-04-17 00:16:35 +00:00
|
|
|
[self.manager changeAspect:aspect];
|
2015-04-01 02:27:18 +00:00
|
|
|
}
|
|
|
|
|
2015-04-08 20:51:31 +00:00
|
|
|
- (void)setType:(NSInteger)camera
|
2015-04-01 02:27:18 +00:00
|
|
|
{
|
2015-04-11 02:56:30 +00:00
|
|
|
if (self.manager.session.isRunning) {
|
|
|
|
[self.manager changeCamera:camera];
|
2015-04-08 20:51:31 +00:00
|
|
|
}
|
|
|
|
else {
|
2015-04-11 02:56:30 +00:00
|
|
|
self.manager.presetCamera = camera;
|
2015-04-08 20:51:31 +00:00
|
|
|
}
|
2015-04-01 17:32:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setOrientation:(NSInteger)orientation
|
|
|
|
{
|
2015-04-11 02:56:30 +00:00
|
|
|
[self.manager changeOrientation:orientation];
|
2015-04-01 01:02:57 +00:00
|
|
|
}
|
|
|
|
|
2015-04-11 02:56:30 +00:00
|
|
|
- (id)initWithManager:(RCTCameraManager*)manager
|
2015-04-01 01:02:57 +00:00
|
|
|
{
|
2015-04-17 00:16:35 +00:00
|
|
|
|
2015-04-01 01:02:57 +00:00
|
|
|
if ((self = [super init])) {
|
2015-04-11 02:56:30 +00:00
|
|
|
self.manager = manager;
|
2015-04-01 01:02:57 +00:00
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)layoutSubviews
|
|
|
|
{
|
|
|
|
[super layoutSubviews];
|
2015-04-17 00:16:35 +00:00
|
|
|
self.manager.previewLayer.frame = self.bounds;
|
|
|
|
[self.layer insertSublayer:self.manager.previewLayer atIndex:0];
|
2015-04-01 01:02:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)insertReactSubview:(UIView *)view atIndex:(NSInteger)atIndex
|
|
|
|
{
|
2015-04-08 20:51:31 +00:00
|
|
|
[self insertSubview:view atIndex:atIndex + 1];
|
2015-04-01 01:02:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)removeReactSubview:(UIView *)subview
|
|
|
|
{
|
2015-04-03 01:07:22 +00:00
|
|
|
[subview removeFromSuperview];
|
2015-04-01 01:02:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|