Capture Screen Video in iOS, especially iPad Ratina - ios

In one of my iPad app, I need to add the ability to record everything on the screen and create a video. I found the great ScreenCaptureView here: http://aroth.no-ip.org:82/wordpress/archives/673, and it does work. But it performs badly on my iPad 4. After profiling with Instruments, I find the pain point to be the "renderInContext" call every 100ms (10frame/s by default) to get the current screen shot.
I then googled and tried a lot, such as using [[self.layer representationLayer] renderInContext:context], and even the private API UIGetScreenImage(). But they all have bad performance. The renderInContext method call can take more than 300ms each time. :(
So, Is there any high performance method to get the current screenshot image? Or is there better video capturing method than the one listed above?
Thanks.

Try tho VTMScreenRecorderTest. I have used it and works great. !!!
http://www.subfurther.com/blog/2011/04/
Hope It helped..

Related

Lost Connection to Ipad error while taking photos

I am trying to add images using the camera in iPad, I am able to add max 30 images and when I am trying to add the 31st or sometimes the 32nd image, when camera opens I am getting an error like "Lost connection to iPad". I tried with allocation, memory is increasing up to 120MB while taking the pic. The images are saved to core data, but I am resizing the image to 600x600. Anybody have any idea about this issue or can you give me a clue so that I can check the reason. Please help me.
Alright, do you get the same behavior on simulator? If you don't, maybe try testing with the iPad fully charged, that will avoid any power supply bug (always happens with my iPad Air).
You said RAM is increasing up to 120MB while taking photos, how does your resize image method looks like? Test it without that method and see if memory goes down, and if it does, just don't use that method.
Also, check for memory leaks, deallocate everything you need and never keep strong references alive when you do so.
I hope that helps you somehow!

iOS debugging with instruments - lag in real device

I am using Instruments (for the first time) as I am trying to debug a lag time arising on a real device but not on the simulator. I have collected some data but I am stuck now since I don't know very well how to interpret them.
Briefly, when I try to present a presentationController in my app I am faced with a lag time (about 5 sec) before the UIView appears on screen. I want to display a UITextView with attributed text. I registered the process with Instruments and here is what I can see (4 figures):
All I have understood so far is that there is maybe a problem with Core Graphics and Font. Could anyone help me to figure out what is going wrong and how I could get rid of this problem? I can give more code if needed.
EDIT:
This is what I obtained when applying the advice given, but I can still not figure out how I can refer those lines to my code.
You want to click these check boxes at the bottom of the time profiler:
from:
http://imgur.com/j0anIdf
to:
http://imgur.com/8PFU5VX
Now you should see your calls rather than all calls

IOS Orientation fix doesn't work all the time

I am developping a swipe gallery for mobile devices. Users can change images by sliding the screen, as any normal images gallery in most iPhone app.
Here is a demo:
http://daviddarx.com/stuffs/work/custom/swip/
To debug the iOS orientation bug (which let the content zoomed when you change the orientation), I used the only library that correct that:
http://scottjehl.github.com/iOS-Orientationchange-Fix/
Unfortunately, this library is working perfectly most of the time, but it happens to fail and not work correctly. This happen around 1 time on 10 times, and the result is then the same as if the library wasn't here.
This is not a huge problem on most of the mobile and responsive website, as the user can manually dezoom and then get back to the normal display.
But the problem here is that I had to disable the zoom function, to make my system work correctly. So, when the bug happen, once on 10 times, the gallery is then just bugged and stay like that....
So, here are my questions:
-do you know any other library that manage that bug fix, and is 100% completely reliable?
-if not, do you know a way to correct the used library to get a 100% support rate?
-if not, do you have any idea or solution for me?
Thank you in advance for your help!
David
There's an outstanding pull request on Scott Jehl's repo that uses slope detection instead of absolute values which seems to not suffer from the intermittent-ness of the original solution.
https://github.com/PeterWooster/iOS-Orientationchange-Fix/

iPad Limitations on Canvas Tag; Webpage Crashses on Canvas Tag Animation

Does anyone know if the iPad has any limitations on the canvas tag?
Currently I'm working on a creative that uses a flipbook and audio tag combination to simulate inline video content. The animations are drawn to the canvas element and synced with the audio content being played. There are 4 short video clips that get played when someone clicks on the four buttons below.
http://cs.sandbox.millennialmedia.com/~tkirchner/rich/K/kungfupanda2_test/
The problem I'm having though is in iPad. After playing a few animations, mobile safari just suddenly crashes. It never happens when I play it on my iPhone but it happens every time on the iPad. Its not one particular animation either because if I click a different combination of buttons, the previous clip that it crashed on plays fine, and then it decides to crash on another clip.
I think the problem might have to do with the amount of memory Safari gives individual page views. I found a blog post that explains that problem pretty well.
http://roblaplaca.com/blog/2010/05/05/ipad-safari-image-limit-workaround/
According to that post, once mobile Safari reaches a particular threshold of memory, images begin to return blank. This is consistant with my finds so far. The iPad that I'm testing this all on is running iOS 3.2.1 (and before anyone tells me that I should just explain to my boss that nobody uses 3.X anymore, I tried... they still want me to investigate this). I borrowed a co-workers iPad running iOS 4.2.1 and that device didn't crash, but some of the images weren't being drawn to the canvas.
I'm pretty sure its a problem with the canvas tag too, because I tried experimenting with running the animation without drawing anything to the canvas element, and the page never crashed.
Thats why I think maybe its a limitation with Safari's support of the canvas tag. Of course, I'm open to anybody else's suggestions.
Feels kinda weird answering my own question again, buuuut I figured if anyone did a search on this kind of question, an answer would be helpful.
I believe my original hypothesis was correct. The total amount of images that the aniamtions were using was around 600+. I think the older iPad loaded as many as it could and then when it ran out of cache and the canvas tag was trying to draw images that weren't really there anymore, it crashed.
Eventually we ended up serving the ad to devices with iOS 4.2 and higher, since the problem didn't seem to occur on those newer devices. Plus, we compressed the image sizes further, so that helped reduce the amount of images we were storing into memory.
If anybody knows approximately what the cache threshold in iOS 4.2 or higher browsers are, I'd appreciate it if you commented. Just want to get an idea of how many KB of image data I can safely load.

iOS 4.2.1 Mobile Safari won't show poster image

I've been working on an iPad-specific site that uses HTML5 video and though I've got video playback working, I can't for the life of me get the poster image to appear. It looks fine on Desktop Safari. Here's the code:
<video src="video/about_the_man.mp4" controls height=360 width=480 poster="video/posters/about_the_man.jpg"></video>
I've using this link as a reference (listing 1.2): https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/AudioandVideoTagBasics/AudioandVideoTagBasics.html#//apple_ref/doc/uid/TP40009523-CH2-SW6
It says that on iOS the poster image will be shown until the user initiates playback, but right now all I'm getting is a black video-sized screen with a big play button in the center. I've looked at other postings on this top (here and here) but neither solution has worked for me. The only thing that's a little bit unconventional about the site is that the video element is in an inline lightbox, so initially on pageload it's not visible, but I don't know why that would make a difference.
I had the exact same problem. I decided to try my code on other iPad's, and it worked fine. The poster image showed up.
After scratching my head for a bit, the solution was to hard reset the iPad and try again. After a reboot, my iPad displayed the poster image as it should.
Maybe it will work for you?
I found there is a limit to the amount of images you can load on an iPad
Here is what it says:
I hit a mobile Safari limitation recently when building an AJAX-y site
on the iPad. If you load a ton of images eventually mobile Safari cuts
you off and will display a [?] instead of the image. After doing some
tests it appears that this limit is around 6.5 MB. Here’s a test page
I made that attempts to load 20 500kb images. When opening this page
on an iPad, 7 of the images don’t appear, even though in Charles they
are returning 200 – success. I’m assuming this is similar to the way
autoplay is disabled for the video tag on iPad/iPhone. Apple probably
wants to make sure users don’t get overloaded with downloads when
browsing on 3G.
Anyhow, 6.5 MB is a hefty load and wouldn’t fare well on 3G, but for one reason or another you may want to work around this limitation. I found the easiest way to patch my code was to load the image into a canvas tag using drawImage(). The canvas tag appears to be immune to the limitation.
Here’s another test page using the canvas tag, all the images should load.

Resources