avcapturedevice

AVCaptureSession and background audio iOS 7

廉价感情. 提交于 2019-11-26 09:37:43
问题 Whenever I start an AVCaptureSession running with the microphone as an input it cancels whatever background music is currently running (iPod music for instance). If I comment out the line adding the audio input, the background audio continues. Does anyone know a way to record video clips with the microphone while continuing to allow background audio to play? Also there is error, when you trying to record video and the music is currently playing. A tried to do like this: [[AVAudioSession

Turn on torch/flash on iPhone

落爺英雄遲暮 提交于 2019-11-26 00:28:09
I know that the only way to turn on the flash and keep it on on iPhone 4 is by turning the video camera on. I'm not too sure of the code though. Here is what I am trying: -(IBAction)turnTorchOn { 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 = [