Skip to content

Instantly share code, notes, and snippets.

@pablasso
Created March 3, 2012 16:35
Show Gist options
  • Save pablasso/1966906 to your computer and use it in GitHub Desktop.
Save pablasso/1966906 to your computer and use it in GitHub Desktop.
Control iOS device torch (flash)
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if ([device hasTorch]) {
[device lockForConfiguration:nil];
[device setTorchMode:AVCaptureTorchModeOn]; // AVCaptureTorchModeOff
[device unlockForConfiguration];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment