简体   繁体   中英

Creating a smooth screencast video on iOS from UIView

I've been trying to get my head around recording a screencast, in app, on iOS7. There are some fantastic apps out there, for example Explain Everything (which I'm not trying to compete with, replace or copy), but I can't see how they manage to get such smooth recording of drawing. It looks like they record to their own proprietary format and then export to a movie when requested by the user.

I've tried some libraries:

  • Glimpse . Unfortunately it still uses renderInContext and is really slow
  • ScreenCaptureView and (what appears to be a derivative) UIScreenCaptureView . The later uses the new drawHierachy methods, but it pimps the iPad's processor up to 96% and is far too slow to draw smoothly; it feels like you're dragging your finger through treacle.

It seems like recording UIView directly to a movie is just too inefficient to create a smooth, drawing based screencast like you see in apps like ShowMe or Explain Everything.

Is there an approach to recording smooth drawing, or what happens in a given UIView that is smooth and achievable? How do (good) screencast apps already out there manage this?

Seems obvious now, but it wasn't at the beginning. The above libraries all use the main thread so I implemented my own solution and used GCD to record on a background thread> This free'd up the interface and stopped the treacle like effect while recording.

Not 100% if it's thread safe or not ( this post seems to indicate that it's not but this post suggests accessing the graphics stack is safe to access). It seems to work for me though. I used a Zoul's solution and drawViewHierarchyInRect:afterScreenUpdates to render the contents of a view in a background thread. It's surprisingly fast and I haven't had any problems yet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM