avcapturesession

How to record video and maintain music playing in the background?

≡放荡痞女 提交于 2020-01-01 05:14:11
问题 Sorry if this is a duplicate, but I couldn't find a question similar to this. I have a custom camera/recorder that I made with AVFoundation and I was wondering how to keep the audio running from other apps while recording a video because right now it stops the audio (doesn't even pause it) and then records the video If I am thinking correctly, could this be solved by adding something similar to this: [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil]; 回答1:

Quick 180 rotation of iOS Device results in the camera viewing upside-down

ε祈祈猫儿з 提交于 2020-01-01 04:41:27
问题 I've implemented the code below to change the orientation of an AVCaptureVideoSession based upon the UIInterfaceOrientation : - (AVCaptureVideoOrientation)interfaceOrientationToVideoOrientation:(UIInterfaceOrientation)orientation { switch (orientation) { case UIInterfaceOrientationPortrait: return AVCaptureVideoOrientationPortrait; case UIInterfaceOrientationPortraitUpsideDown: return AVCaptureVideoOrientationPortraitUpsideDown; case UIInterfaceOrientationLandscapeLeft: return

Proper way to optimize my AVCaptureSession?

霸气de小男生 提交于 2020-01-01 03:44:07
问题 I got my AVCaptureSession to work and it duplicates the Camera.app UI almost perfectly, however, after a few seconds the application will crash and I just cannot find what I'm doing wrong. I really hope someone knows how to optimize this! I AM using ARC; and again, the whole session runs fine but crashes after a little bit. The AVCaptureSession delegate method gets called what seems like EVERY second. If there's a way to call that method only when the user presses the "take picture" button,

Switch front/back camera with AVCaptureSession

自闭症网瘾萝莉.ら 提交于 2020-01-01 02:17:08
问题 I'm following the only answer this has on SO - Switch cameras with avcapturesession However cameraWithPosition does not seem to work. Deprecated? //Get new input AVCaptureDevice *newCamera = nil; if(((AVCaptureDeviceInput*)currentCameraInput).device.position == AVCaptureDevicePositionBack) { newCamera = [self cameraWithPosition:AVCaptureDevicePositionFront]; } else { newCamera = [self cameraWithPosition:AVCaptureDevicePositionBack]; } 回答1: What you need to do is reconfigure your

Record Audio/Video with AVCaptureSession and Playback Audio simultaneously?

独自空忆成欢 提交于 2020-01-01 01:16:52
问题 I'm trying to create an iOS app which can record audio and video while simultaneously outputting audio to the speakers. To do the recording and preview, I'm using AVCaptureSession , an AVCaptureConnection each for both video and audio, and an AVAssetWriterInput each for both video and audio. I basically achieved this by following the RosyWriter example code. Prior to setting up recording in this fashion, I was using AVAudioPlayer to play audio. Now, if I am in the middle of capturing (not

AVCaptureSession Record Video With Audio

萝らか妹 提交于 2019-12-31 09:20:13
问题 I have my app set up to record video from the camera using an AVCaptureSession, however, there is no audio with it. What do I need to do to record audio and then add it to the videoOutput for the file? Here is my code for recording the video: AVCaptureSession *session = [[AVCaptureSession alloc] init]; [session beginConfiguration]; session.sessionPreset = AVCaptureSessionPresetMedium; CALayer *viewLayer = self.vImagePreview.layer; NSLog(@"viewLayer = %@", viewLayer);

Audio Not Recording in AVCaptureSession [duplicate]

梦想与她 提交于 2019-12-30 09:06:09
问题 This question already has answers here : AVCaptureSession audio doesn't work for long videos (3 answers) Closed last year . I have an app that when a view is loaded up, begins capturing video and audio, and upon completion, records it to both the documents folder of the app, along with the Camera Roll of the iPad that it is running on. I have made sure and added in the input to the session for both audio and video, but when I go to view the saved video, there is no audio with it. Can anyone

Audio Not Recording in AVCaptureSession [duplicate]

家住魔仙堡 提交于 2019-12-30 09:05:05
问题 This question already has answers here : AVCaptureSession audio doesn't work for long videos (3 answers) Closed last year . I have an app that when a view is loaded up, begins capturing video and audio, and upon completion, records it to both the documents folder of the app, along with the Camera Roll of the iPad that it is running on. I have made sure and added in the input to the session for both audio and video, but when I go to view the saved video, there is no audio with it. Can anyone

Get Camera Preview to AVCaptureVideoPreviewLayer

我怕爱的太早我们不能终老 提交于 2019-12-29 04:45:07
问题 I was trying to get the camera input to show on a preview layer view. self.cameraPreviewView is tied to a UIView in IB Here is my current code that I put together from the AV Foundation Programming Guide. But the preview never shows AVCaptureSession *session = [[AVCaptureSession alloc] init]; session.sessionPreset = AVCaptureSessionPresetHigh; AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; NSError *error = nil; AVCaptureDeviceInput *input =

Capture 60fps in iPhone app

对着背影说爱祢 提交于 2019-12-28 10:06:52
问题 I am working on a project where we will be using iPhones as cameras for capturing a scene. When recording we need to record @60fps and not 30fps (as natively supported). So I am working on an app to do this as the iPhone 4S hardware supports 720p@60fps (if you jailbreak your phone you can achieve this). Does anybody know how to do this in Objective-C on iOS? Today I saw an app out there (slopro) that can record 60fps on non jailbroken phones. Any advice or tips is much appreciated. 回答1: After