mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
ipad: fix camera switch button
This commit is contained in:
parent
c696f7fae1
commit
444e185509
1 changed files with 20 additions and 18 deletions
|
|
@ -72,7 +72,6 @@
|
|||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
[phoneMainView.switchCamera addTarget:self action:@selector(switchCameraPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
|
||||
-(void) switchCameraPressed {
|
||||
|
|
@ -80,30 +79,32 @@
|
|||
}
|
||||
|
||||
-(void) useCameraAtIndex:(NSInteger)camIndex startSession:(BOOL)start {
|
||||
[session stopRunning];
|
||||
@synchronized (self) {
|
||||
[session stopRunning];
|
||||
|
||||
if (input != nil)
|
||||
[session removeInput:input];
|
||||
if (input != nil)
|
||||
[session removeInput:input];
|
||||
|
||||
NSError* error;
|
||||
NSError* error;
|
||||
|
||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc]init];
|
||||
NSArray* array = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
|
||||
if ( [array count] == 0) {
|
||||
ms_warning("No camera available (running on simulator ?");
|
||||
return;
|
||||
}
|
||||
currentCamera = camIndex % [array count];
|
||||
AVCaptureDevice* device = (AVCaptureDevice*) [array objectAtIndex:currentCamera];
|
||||
input = [[AVCaptureDeviceInput deviceInputWithDevice:device
|
||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc]init];
|
||||
NSArray* array = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
|
||||
if ( [array count] == 0) {
|
||||
ms_warning("No camera available (running on simulator ?");
|
||||
return;
|
||||
}
|
||||
currentCamera = camIndex % [array count];
|
||||
AVCaptureDevice* device = (AVCaptureDevice*) [array objectAtIndex:currentCamera];
|
||||
input = [[AVCaptureDeviceInput deviceInputWithDevice:device
|
||||
error:&error] retain];
|
||||
|
||||
[session addInput:input];
|
||||
[session addInput:input];
|
||||
|
||||
[pool drain];
|
||||
[pool drain];
|
||||
|
||||
if (start)
|
||||
[session startRunning];
|
||||
if (start)
|
||||
[session startRunning];
|
||||
}
|
||||
}
|
||||
|
||||
-(void) stopPreview:(id) a {
|
||||
|
|
@ -151,6 +152,7 @@
|
|||
|
||||
-(void) viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
[phoneMainView.switchCamera addTarget:self action:@selector(switchCameraPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
|
||||
-(void) viewDidDisappear:(BOOL)animated {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue