AVCaptureSession and background audio iOS 7

In your AppDelegate: – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { //Stop app pausing other sound. [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDuckOthers | AVAudioSessionCategoryOptionDefaultToSpeaker error:nil]; } Where you are allocating AVCaptureSession: AVCaptureSession *session = [[AVCaptureSession alloc] init]; session.automaticallyConfiguresApplicationAudioSession = NO; This code will allow you to play background music and run AVCaptureSession with the microphone. SWIFT UPDATE: AppDelegate: func … Read more

Accessing iOS 6 new APIs for camera exposure and shutter speed

It’s true that there is an -exposureMode property on AVCaptureDevice, but that’s only for setting the mode (off/auto/continuous) and not the actual f-stop, SS, or ISO. Camera apps that provide “exposure” control all seem to do it through post-processing. However, it seems there are undocumented APIs in the framework to do this. Check out the … Read more

Turn on torch/flash on iPhone

Here’s a shorter version you can now use to turn the light on or off: AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; if ([device hasTorch]) { [device lockForConfiguration:nil]; [device setTorchMode:AVCaptureTorchModeOn]; // use AVCaptureTorchModeOff to turn off [device unlockForConfiguration]; } UPDATE: (March 2015) With iOS 6.0 and later, you can control the brightness or level of the torch … Read more