avcapturedevice

How to save a movie from AVCapture

丶灬走出姿态 提交于 2019-12-13 04:34:04
问题 I've been trying to figure out AVCapture the last couple of days and am struggling to save a video. My understanding is that you call [movieFileOutput startRecordingToOutputFileURL:outputURL recordingDelegate:self]; and then at a later time you can call [movieFileOutput stopRecording]; And it should then call the delegate method -(void)captureOutput:(AVCaptureFileOutput *)captureOutput didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL fromConnections:(NSArray *)connections error:

Real time face detection with Camera on swift 3

那年仲夏 提交于 2019-12-09 07:19:44
问题 How can I do face detection in realtime just as "Camera" does? like white round shape around and over the face. I use AVCapturSession . I found that the image I saved for facial detection. Below I have attached my current code. it only captures image when I press the button and save it into the photo gallery. some please help me to create real-time round shape over according to the person's face! code class CameraFaceRecongnitionVC: UIViewController { @IBOutlet weak var imgOverlay:

How to switch to front camera in Swift 2?

纵饮孤独 提交于 2019-12-09 05:48:26
I have all this code in my ViewDidAppear captureSession = AVCaptureSession() // let backCamera = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo) var captureDevice:AVCaptureDevice! = nil if (camera == CameraType.Front) { let videoDevices = AVCaptureDevice.devicesWithMediaType(AVMediaTypeVideo) for device in videoDevices{ let device = device as! AVCaptureDevice if device.position == AVCaptureDevicePosition.Front { captureDevice = device break } } } else { captureDevice = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo) } do { let input = try? AVCaptureDeviceInput(device:

Application crashing while accessing microphone in iOS 12.1.2 for iPhone XS

流过昼夜 提交于 2019-12-08 08:24:33
问题 I am working on iOS application which uses microphone for video capture. When we try to capture video, it asks for microphone permission and crashes immediately after that. We are getting following error: "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: -[AVCaptureDevice setActiveColorSpace:] Not supported - use activeFormat.supportedColorSpaces " We have tried searching for this property for AVCaptureDevice. However, not able to find the same. 回答1: We have

How to switch to front camera in Swift 2?

随声附和 提交于 2019-12-08 06:30:07
问题 I have all this code in my ViewDidAppear captureSession = AVCaptureSession() // let backCamera = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo) var captureDevice:AVCaptureDevice! = nil if (camera == CameraType.Front) { let videoDevices = AVCaptureDevice.devicesWithMediaType(AVMediaTypeVideo) for device in videoDevices{ let device = device as! AVCaptureDevice if device.position == AVCaptureDevicePosition.Front { captureDevice = device break } } } else { captureDevice =

Haptic feedback not playing nice with AVFoundation? (UIImpactFeedbackGenerator, etc)

 ̄綄美尐妖づ 提交于 2019-12-08 01:42:05
问题 I'm trying to have a video / camera view in the background while I also allow for haptic feedback in my app for various actions, but it seems that AVFoundation is not playing nice with any of the calls I am making that involve the haptic calls: if #available(iOS 10.0, *) { let generator = UIImpactFeedbackGenerator(style: .light) generator.prepare() generator.impactOccurred() // More: let feedbackGenerator = UISelectionFeedbackGenerator() feedbackGenerator.selectionChanged() } Haptic feedback

AVAudioSessionInterruptionNotification not triggered when capture device active

为君一笑 提交于 2019-12-07 07:07:21
问题 I'm having a problem with " AVAudioSessionInterruptionNotification " on iOS 7.0.4. I sign up for it on the NSNotificationCenter, and I activate AVAudioSession. Everything works fine, but if a camera is activated, that particular notification is not triggered anymore, neither for the beginning of an interruption, nor for the end of it. I test audio interruptions by receiving cell calls on an iPhone4, and also by making an alarm ring while the app is running. I also tried using the notification

Set a custom AVFrameRateRange for an AVCaptureSession

▼魔方 西西 提交于 2019-12-07 04:42:40
问题 I'm trying to take 5 pictures every second with AVCaptureSession and I'm not sure I understand what AVFrameRange means. Currently I have some code that sets up the device: AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; and tries to set the activeVideoMinFrameDuration and activeVideoMaxFrameDuration to a custom value of CMTimeMake(1, 5) . Apple tells me I can only use one of the AVFrameRanges that they've provided. When I NSLogged them, I get (2, 30),

Application crashing while accessing microphone in iOS 12.1.2 for iPhone XS

会有一股神秘感。 提交于 2019-12-06 15:15:17
I am working on iOS application which uses microphone for video capture. When we try to capture video, it asks for microphone permission and crashes immediately after that. We are getting following error: "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: -[AVCaptureDevice setActiveColorSpace:] Not supported - use activeFormat.supportedColorSpaces " We have tried searching for this property for AVCaptureDevice. However, not able to find the same. We have tried searching for this property for AVCaptureDevice. However, not able to find the same. Solution: The

AVCaptureDevice videoZoomFactor always Out of Range

守給你的承諾、 提交于 2019-12-06 12:25:41
I'm trying to set the zoom level of a camera by this code: AVCaptureDevice *videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; if ([videoDevice lockForConfiguration:nil]) { float newzoom=1.3; videoDevice.videoZoomFactor = newzoom; [videoDevice unlockForConfiguration]; } This code doesn't not works in ios 7(it works in ios 9), it cause always an exception: Terminating app due to uncaught exception 'NSRangeException', reason: 'videoZoomFactor out of range' I can't find information but the zoom range in ios 7 seems to be "from 1 to 2". But every value i have tried to set