My iOS app can record video by using AVCaptureSession and play video at the same time.
but the problem is that app gets much slower after completed this function.
I don't know why... My app is ARC mode and I tried my recorder class that contains AVCaptureSession to nil but the problem was not solved.
Please tell me the possible reasons make app slow after recording video.
Thank.
It's very important where you are storing recorded files.The large files should be saved in document directory instead of RAM.So don't save your recorded file in improper places like NSUserDefault,which results slow performance and memory issue.
ARC doesn't mean you should not manage your memory. Make sure the used memory is deallocated after recording the video. Maybe there is some leak?
Related
My configuration
iPhone X
iOS 12
Problem
Since iOS 11/12 my apps audio for some reason has a periodic crackling/popping sound which appears to get worse/more noticeable the louder or more constant the audio is.
Troubleshooting
I played a 800Hz sine wave from djay2 through AudioBus into my app and saved the output of my app to a file.
Loading my apps output into Audacity I can see that the crackling occurs every 14,112 samples or every 0.320 seconds.
Has anyone got any idea where I should start looking. Changing the internal configuration of my app between 41.1kHz and 48kHz appears to make no difference. I thought it might have been due to downsampling from the hardware sample rate.
Toggling Inter-App Audio Sync on/off within AudioBus appears to have some effect (1 in every ~8 toggles will stop the crackling).
I assume this is due to the AudioSession being restarted or something.
Has anyone got any idea what might be causing this or has experienced this before?
Thanks,
Anthony
I am working on the app which capture the video and save in document directory. Later I have to upload that video on Amazon S3 Server. But when I am going to stop video recording and save in document directory, the iPhone app crashes due to Memory Pressure.
Same code works on iPad without any problem. But it crashes on iPhone and iPod.
Can anyone help me to solve the issue?
Thanks.
"Memory Pressure" sound like RAM, not disk related, are you trying to get the entire video in RAM at some point?
You can not expect to load an entire video into memory ignored to upload it. Instead you need to stream the video most likely using NSStream so only a portion is in ARM memory at any time.
Have little hope that anyone's encountered this, but there seems to be a system wide bug with AVPlayer. I've tested with my app along with other apps, including Pandora.
Namely, and randomly, if you successfully open the app and begin playing, then put the app in the background, perform a variety of random actions, such as playing media in other apps, making a phone call, etc, and try to come back to the app, the AVPlayer's don't play.
I've replicated this many times, though inconsistently, with Pandora and the app that I'm working on.
I've logged my code and have not found any errors in playback. It just doesn't play.
Has anyone else experienced this strange issue? I have spent countless days on it and am now desperate.
Looks like the AVFoundation media server is crashing and resetting, causing this problem.
The solution:
https://developer.apple.com/library/ios/qa/qa1749/_index.html
The app plays video n audio from the bundle. When I'm testing the app on my iPod Touch, SOMETIMES just before the video is getting played, it logs the message. sometimes when the app wants to prepare the audioplayer (in another viewController) it logs the message.
However I haven't had a crash YET! :D I'm not sure if there's gonna be a crash if it runs on other devices which have multiple apps open.
So, should I worry about this? should I prepareAudioPlayer or moviePlayer in another thread?
or just ignore it?
Even if you prepare it on other threads it will not solve this issue, what you have to do is to prepare your self for when you recieve a memory warning to act upon it and free some memory that you dont need
Try to free some memory up, optimize your application memory consumption, using lazy loading technique and so on, but using another thread is definitely not a solution
This app I'm working on allows the user to take pictures, and saves them locally (a small thumbnail image via Core Data, and the full-size image in the documents directory).
I'm finding that writing the image file to the documents directory takes a long time, though -- 8 seconds on my iPhone 3GS, even longer on my iPhone 3G, and on the first-gen iPod touch.
I write the file this way:
[imgData writeToFile:imagePath atomically:YES];
Is there a faster way to do this?
The iPhone's camera app seems to write the images to the filesystem very quickly. I could do the writing in a thread, but I'm concerned about the user possibly quitting my app before the thread finishes.
A closely related question has been asked before, and the general opinion is that the
iPhone's camera app uses undocumented internal API calls. I'm personally not sure if this is true, I think it's more likely that the iPhone app can persist in the background until the image is saved, a "commodity" not yet available to third party apps on non-jailbroken devices.
Perhaps you should try indeed using a thread to save your image, but in a more data-oriented way, in byte chunks. This way, if the user presses the home button, in your - (void) applicationWillTerminate(UIApplication *)application method from the app's delegate, you could finalize the process of data saving to disk. This will only buy you an extra 5 seconds, though, but it's better than nothing at all. Similar recommendations have been given on saving a text file. Hope this helps, best of luck!