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.
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.
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.
- Because recording in-app activities has never been simpler
- Because a video is worth a thousand words of any bug report
- Screen recorder
- Photo library import for recorded videos
- Screen corner overlay UI for convenient integration
- On-screen touch visualization during screen recording
Use CocoaPods to quickly run the example project:
pod try SGASScreenRecorder
- iOS 7.0.0 and above
- iOS devices only. Will build for and run on iOS Simulator, but will not do any actual recording
SGASScreenRecorder is available through CocoaPods.
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.
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
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:
- @sanekgusev on Twitter
- @sanekgusev on Telegram
- sanekgusev@gmail.com
SGASScreenRecorder is available under the MIT license. See the LICENSE file for more info.