Need someone with iPhone 4 to test flashlight code
Vmlweb
Member Posts: 427
Hey,
I need someone with an iPhone 4 to test a bit of Xcode code which is suppose to turn the flashlight on
Could you please test 1-2-3-4 and tell me which one works
1)
[videoCaptureDevice lockForConfiguration:nil];
videoCaptureDevice.torchMode = AVCaptureTorchModeOn;
[videoCaptureDevice unlockForConfiguration];
2)
videoCaptureDevice.torchMode = AVCaptureTorchModeOn;
3)
NSArray *devices = [AVCaptureDevice devices];
for (AVCaptureDevice *device in devices) {
device.flashMode = AVCaptureFlashModeOn;
}
4)
AVCaptureSession *captureSession = [[AVCaptureSession alloc] init];
AVCaptureDevice *videoCaptureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
NSError *error = nil;
AVCaptureDeviceInput *videoInput = [AVCaptureDeviceInput deviceInputWithDevice:videoCaptureDevice error:&error];
if (videoInput) {
[captureSession addInput:videoInput];
AVCaptureVideoDataOutput* videoOutput = [[AVCaptureVideoDataOutput alloc] init];
[videoOutput setSampleBufferDelegate:self queue:dispatch_get_current_queue()];
[captureSession addOutput:videoOutput];
[captureSession startRunning];
videoCaptureDevice.torchMode = AVCaptureTorchModeOn;
}
Thanks alot,
Vmlweb
I need someone with an iPhone 4 to test a bit of Xcode code which is suppose to turn the flashlight on
Could you please test 1-2-3-4 and tell me which one works
1)
[videoCaptureDevice lockForConfiguration:nil];
videoCaptureDevice.torchMode = AVCaptureTorchModeOn;
[videoCaptureDevice unlockForConfiguration];
2)
videoCaptureDevice.torchMode = AVCaptureTorchModeOn;
3)
NSArray *devices = [AVCaptureDevice devices];
for (AVCaptureDevice *device in devices) {
device.flashMode = AVCaptureFlashModeOn;
}
4)
AVCaptureSession *captureSession = [[AVCaptureSession alloc] init];
AVCaptureDevice *videoCaptureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
NSError *error = nil;
AVCaptureDeviceInput *videoInput = [AVCaptureDeviceInput deviceInputWithDevice:videoCaptureDevice error:&error];
if (videoInput) {
[captureSession addInput:videoInput];
AVCaptureVideoDataOutput* videoOutput = [[AVCaptureVideoDataOutput alloc] init];
[videoOutput setSampleBufferDelegate:self queue:dispatch_get_current_queue()];
[captureSession addOutput:videoOutput];
[captureSession startRunning];
videoCaptureDevice.torchMode = AVCaptureTorchModeOn;
}
Thanks alot,
Vmlweb
Comments
Anyone please?