Skip to content

Instantly share code, notes, and snippets.

@kristopherjohnson
Created October 2, 2012 13:05
Show Gist options
  • Save kristopherjohnson/3818941 to your computer and use it in GitHub Desktop.
Save kristopherjohnson/3818941 to your computer and use it in GitHub Desktop.
Turn LED on/off on iOS
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if ([device hasTorch]) {
[device lockForConfiguration:nil];
[device setTorchMode:AVCaptureTorchModeOn]; // use AVCaptureTorchModeOff to turn off
[device unlockForConfiguration];
}
@kristopherjohnson
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment