Skip to content

Efficient, convenient, and configurable screen recording for iOS apps

License

Notifications You must be signed in to change notification settings

edsharp/SGASScreenRecorder

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SGASScreenRecorder 🎥

Super-efficient, highly convenient, and easily configurable screen recording for iOS apps.

Warning: This is only meant to be used during development in debug and in-house testing builds and is completely NOT App Store-safe.

What

It allows you to continuously record whatever is happening on the device's screen while your application is in foreground and save this recording either to a video file or to device's Photo Library.

How

Screen capture is done using low-level functions from the IOKit, IOSurface and IOMobileFramebuffer private frameworks. This mostly boils down to IOMobileFramebufferGetLayerDefaultSurface() and IOSurfaceAcceleratorTransferSurface() calls.

Capturing is done from a callback of a CADisplayLink scheduled on a background thread's runloop to minimize performance impact on application code. There's no busy waiting and no operations are performed on the main thread during capture.

Why

  • Because recording in-app activities has never been simpler
  • Because a video is worth a thousand words of any bug report

What's Inside

  • Screen recorder
  • Photo library import for recorded videos
  • Screen corner overlay UI for convenient integration
  • On-screen touch visualization during screen recording

Usage

Use CocoaPods to quickly run the example project:

pod try SGASScreenRecorder

Requirements

  • iOS 7.0.0 and above
  • iOS devices only. Will build for and run on iOS Simulator, but will not do any actual recording

Installation

SGASScreenRecorder is available through CocoaPods.

Simple

For a simple all-in-one installation, add the following line to your Podfile:

pod 'SGASScreenRecorder', '~> 1.0'

To initialize the screen recording UI overlay, run something along the following lines:

- (void)setupScreenRecorderUIManager {
#ifndef APPSTORE
    SGASScreenRecorderSettings *settings = [SGASScreenRecorderSettings new];
    _screenRecorderUIManager = [[SGASScreenRecorderUIManager alloc] initWithScreenCorner:UIRectCornerTopLeft
                                                                  screenRecorderSettings:settings];
#endif
}

Make sure to use compile-time checks/preprocessor macros to prevent this code from getting to App Store builds.

Feel free to peek into the demo project for more details.

Granular

If you do not need the recording overlay UI and would rather prefer to start and stop recording yourself, you could only import what you need:

  • Use pod 'SGASScreenRecorder/SGASScreenRecorder', '~> 1.0' to get just the screen recorder

or

  • Use pod 'SGASScreenRecorder/SGASPhotoLibraryScreenRecorder', '~> 1.0' to get the screen recorder plus Photo Library import support

Authors

@Shmatlay, @sanekgusev

This project was initially based on the early versions of RecordMyScreen project and was privately developed by @Shmatlay, who added screen overlay controls, touch visualization, and saving to the Photo Library. With Andrey's permission, I later refactored the project, transitioned it to ARC, made it more modular, and completely rewrote the capturing code to support iOS8, improve performance and memory footprint.

I can be bugged via the following:

License

SGASScreenRecorder is available under the MIT license. See the LICENSE file for more info.

About

Efficient, convenient, and configurable screen recording for iOS apps

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 68.3%
  • Objective-C 26.7%
  • C++ 3.8%
  • Ruby 1.2%