avfoundation

Support for background recording of video using AVCaptureSession

谁都会走 提交于 2019-12-01 18:39:40
I am trying to record video also in background but currently my code is recording video in foreground when the app goes background the method. -(void)captureOutput:(AVCaptureFileOutput *)captureOutput didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL fromConnections:(NSArray *)connections error:(NSError *)error fires immediately with error as error:Error Domain=AVFoundationErrorDomain Code=-11818 "Recording Stopped" UserInfo=0x176aa180 {NSLocalizedRecoverySuggestion=Stop any other actions using the recording device and try again., NSUnderlyingError=0x1766c0e0 "The operation couldn’t

AVFoundation camera preview layer not working

老子叫甜甜 提交于 2019-12-01 18:07:06
So, I am trying to implement a camera using AVFoundation. I think I do everything right. this is what i am doing create session get devices of video type loop through devices to get the camera at the back get a device input using the device mentioned in #3 and add it to the session create an output of type AVCaptureStillImageOutput set output settings and add it to the session get a CALayer from my view 2(will explain below what I mean by view 2) create an instance of AVCaptureVideoPreviewLayer add it to the layer mentioned in #7 start running the session So I have 2 views one over the other.

UIActivityViewController Error: Failed to determine whether URL is managed by a file provider

别等时光非礼了梦想. 提交于 2019-12-01 17:26:52
I record a video in my app and write it it to the temp directory to allow the user to share it through UIActivityViewController. The video can successfully be played back in-app, and through UIActivityViewController can successfully be sent through Messages, shared to Facebook, and saved to camera roll. But when I try to share through WhatsApp, I get the following error: Failed to determine whether URL /private/var/mobile/Containers/Data/Application/E7F57458-A5F9-44CB-86FA-ACC4309C7473/tmp/65CB72B3-373E-42F2-8A80-9888E00C2268.mp4 (n) is managed by a file provider I have been unable to find

AVFoundation - How to control exposure

别来无恙 提交于 2019-12-01 16:53:52
问题 AFTER tapping to take picture, I want to lock exposure and turn off torch as soon as exposure is no longer adjusting. So, I added an observer to handle adjustingExposure: - (IBAction)configureImageCapture:(id)sender { [self.session beginConfiguration]; [self.cameraController device:self.inputDevice exposureMode:AVCaptureExposureModeAutoExpose]; [self.cameraController device:self.inputDevice torchMode:AVCaptureTorchModeOn torchLevel:0.8f]; [self.session commitConfiguration]; [(AVCaptureDevice

AVFoundation - How to control exposure

試著忘記壹切 提交于 2019-12-01 16:43:38
AFTER tapping to take picture, I want to lock exposure and turn off torch as soon as exposure is no longer adjusting. So, I added an observer to handle adjustingExposure: - (IBAction)configureImageCapture:(id)sender { [self.session beginConfiguration]; [self.cameraController device:self.inputDevice exposureMode:AVCaptureExposureModeAutoExpose]; [self.cameraController device:self.inputDevice torchMode:AVCaptureTorchModeOn torchLevel:0.8f]; [self.session commitConfiguration]; [(AVCaptureDevice *)self.inputDevice addObserver:self forKeyPath:@"adjustingExposure" options

UIActivityViewController Error: Failed to determine whether URL is managed by a file provider

北慕城南 提交于 2019-12-01 15:26:32
问题 I record a video in my app and write it it to the temp directory to allow the user to share it through UIActivityViewController. The video can successfully be played back in-app, and through UIActivityViewController can successfully be sent through Messages, shared to Facebook, and saved to camera roll. But when I try to share through WhatsApp, I get the following error: Failed to determine whether URL /private/var/mobile/Containers/Data/Application/E7F57458-A5F9-44CB-86FA-ACC4309C7473/tmp

Fetch All Audio & Video files in ios

一个人想着一个人 提交于 2019-12-01 13:44:01
I want to fetch all audio files and also video files from device into the app. so that i can listed their names into the different UITableViews. Is there any way in ios, so that i can fetch them. Vineet Singh Have a look at this ,specially on the section " Getting Media Items Programmatically ". If the media item picker doesn’t provide the control you want, you can use the database access classes from this API. These classes are designed to let you create arbitrarily complex queries. You could, for example, retrieve all the songs in a particular genre whose titles include a particular word or

Simulate AVLayerVideoGravityResizeAspectFill: crop and center video to mimic preview without losing sharpness

感情迁移 提交于 2019-12-01 12:04:17
Based on this SO post , the code below rotates, centers, and crops a video captured live by the user. The capture session uses AVCaptureSessionPresetHigh for the preset value, and the preview layer uses AVLayerVideoGravityResizeAspectFill for video gravity. This preview is extremely sharp. The exported video, however, is not as sharp, ostensibly because scaling from the 1920x1080 resolution for the back camera on the 5S to 320x568 (target size for the exported video) introduces fuzziness from throwing away pixels? Assuming there is no way to scale from 1920x1080 to 320x568 without some

Add and remove observer from multiple AVPlayerItem on UITableViewCell

十年热恋 提交于 2019-12-01 12:02:34
问题 i am trying to make a table view that plays multiple videos with AVPlayer and AVPlayerItem and i needed to addObserver to each AVPlayerItem so i can keep track of playbackLikelyToKeepUp property what i tried and failed is adding the observer after setting the AVPlayerItem and removing it in the deinit of the UITableViewCell but since the cells never gets deallocated but gets dequeued so this won't work and i will get this error An instance 0x14eedebc0 of class AVPlayerItem was deallocated

Add and remove observer from multiple AVPlayerItem on UITableViewCell

本小妞迷上赌 提交于 2019-12-01 11:39:52
i am trying to make a table view that plays multiple videos with AVPlayer and AVPlayerItem and i needed to addObserver to each AVPlayerItem so i can keep track of playbackLikelyToKeepUp property what i tried and failed is adding the observer after setting the AVPlayerItem and removing it in the deinit of the UITableViewCell but since the cells never gets deallocated but gets dequeued so this won't work and i will get this error An instance 0x14eedebc0 of class AVPlayerItem was deallocated while key value observers were still registered with it. After searching I came up with this I should not