4

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?

glenstorey
  • 5,134
  • 5
  • 39
  • 71
  • 1
    For a private API to do this, take a look at the answer here: http://stackoverflow.com/a/11105783/19679, in particular this project it links to: https://github.com/coolstar/RecordMyScreen . That's not a shippable solution, but it is a way of recording the screen in a performant manner. – Brad Larson Oct 23 '13 at 19:58
  • I wasn't aware of this way - good to know. You're right though, I want a shippable solution. – glenstorey Oct 24 '13 at 16:41

1 Answers1

1

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.

Community
  • 1
  • 1
glenstorey
  • 5,134
  • 5
  • 39
  • 71
  • What did you use as the recording approach in the background thread? – jasonjwwilliams Apr 05 '14 at 21:01
  • 1
    Can you please share a little bit more information about the way you solved this problem? how did you use GCD to record on the background thread? I'm about to lose my mind over this =\ – Chiko Aug 08 '14 at 21:36
  • Hey guys. I use dispatch_async to throw a method off the main thread. That method's job is to grab the screen's contents and use Zoul's solution to put that in a pixel buffer. – glenstorey Aug 29 '14 at 08:05
  • 1
    Is the code on Github by chance? Facing a similar situation and would love to see what you did. Thanks! – Crashalot Jan 29 '16 at 03:15
  • No sorry! But if you use Zoul's solution and a background thread you should be ok - the solution is still working happily in iOS9. Don't forget there's also ReplayKit if it's for a game. – glenstorey Jan 30 '16 at 07:20