Latest 1.0.1
Homepage https://github.com/sanekgusev/SGASScreenRecorder
License MIT
Platforms ios 7.0
Dependencies SGVObjcMixin
Frameworks UIKit
Authors

SGASScreenRecorder :movie_camera:

Version
License
Platform
CI Status

Unfortunately, this no longer works when running on iOS 9.x. The behavior of IOMobileFramebufferGetLayerDefaultSurface() function has changed and it seems that there is no longer a way to access the screen’s surface to capture video samples from. More details can be found in StackOverflow answer by @jvisenti here: http://stackoverflow.com/a/32512999/1987487.

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.

Latest podspec

{
    "name": "SGASScreenRecorder",
    "version": "1.0.1",
    "summary": "Efficient on-device screen recording for iOS apps.",
    "cocoapods_version": ">= 1.0.0.beta2",
    "description": "Record whatever is happening on your device's screen while your app is in foreground.nnFeatures:nn* low performance impactn* low memory footprintn* save recordings to a video file or import into Photo Libraryn* touch visualization during recordingn* simple overlay UI to start/stop recordingnn             To be only used in development and in-house builds, *not* App Store-safe at all.",
    "homepage": "https://github.com/sanekgusev/SGASScreenRecorder",
    "screenshots": "https://cloud.githubusercontent.com/assets/1178649/5689239/f76d606e-9861-11e4-9213-e048fbfe9f61.PNG",
    "license": "MIT",
    "authors": {
        "Alexander Gusev": "[email protected]"
    },
    "source": {
        "git": "https://github.com/sanekgusev/SGASScreenRecorder.git",
        "tag": "1.0.1"
    },
    "social_media_url": "https://twitter.com/sanekgusev",
    "platforms": {
        "ios": "7.0"
    },
    "source_files": [
        "Pod/Classes/SGASScreenRecorderUIManager.{h,m}",
        "Pod/Classes/SGASTouchVisualizer.{h,m}",
        "Pod/Classes/SGASTouchTrackingApplication.{h,m}",
        "Pod/Classes/Windows/*.{h,m}"
    ],
    "public_header_files": "Pod/Classes/SGASScreenRecorderUIManager.h",
    "frameworks": "UIKit",
    "dependencies": {
        "SGVObjcMixin": [
            "~> 1.0"
        ]
    },
    "pod_target_xcconfig": {
        "ENABLE_STRICT_OBJC_MSGSEND": "YES",
        "GCC_TREAT_WARNINGS_AS_ERRORS": "YES",
        "GCC_WARN_FOUR_CHARACTER_CONSTANTS": "YES",
        "GCC_WARN_SHADOW": "YES",
        "GCC_WARN_64_TO_32_BIT_CONVERSION": "YES",
        "CLANG_WARN_IMPLICIT_SIGN_CONVERSION": "YES",
        "GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED": "YES",
        "GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS": "YES",
        "GCC_WARN_ABOUT_MISSING_PROTOTYPES": "YES",
        "CLANG_WARN_ASSIGN_ENUM": "YES",
        "GCC_WARN_SIGN_COMPARE": "YES",
        "CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION": "YES",
        "GCC_WARN_UNKNOWN_PRAGMAS": "YES",
        "CLANG_WARN_UNREACHABLE_CODE": "YES",
        "GCC_WARN_UNUSED_LABEL": "YES",
        "CLANG_WARN__DUPLICATE_METHOD_MATCH": "YES",
        "CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES": "YES",
        "CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS": "YES",
        "GCC_WARN_STRICT_SELECTOR_MATCH": "YES",
        "CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF": "YES",
        "CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK": "YES"
    },
    "subspecs": [
        {
            "name": "SGASScreenRecorder",
            "source_files": [
                "Pod/Classes/SGASScreenRecorder.{h,m}",
                "Pod/Classes/SGASScreenRecorderSettings.{h,m}"
            ],
            "public_header_files": [
                "Pod/Classes/SGASScreenRecorder.h",
                "Pod/Classes/SGASScreenRecorderSettings.h"
            ],
            "dependencies": {
                "SGVBackgroundRunloop": [
                    "~> 1.0"
                ]
            },
            "frameworks": [
                "UIKit",
                "AVFoundation",
                "CoreMedia",
                "MobileCoreServices"
            ],
            "subspecs": [
                {
                    "name": "SGASScreenRecorderPrivate",
                    "source_files": "Pod/PrivateHeaders/**/*.h",
                    "private_header_files": "Pod/PrivateHeaders/**/*.h",
                    "header_mappings_dir": "Pod/PrivateHeaders",
                    "preserve_paths": "Pod/PrivateFrameworks/**/*.framework",
                    "weak_frameworks": [
                        "IOSurface",
                        "IOKit",
                        "IOMobileFramebuffer"
                    ],
                    "user_target_xcconfig": {
                        "FRAMEWORK_SEARCH_PATHS": ""${PODS_ROOT}/SGASScreenRecorder/Pod/PrivateFrameworks/8.4""
                    }
                }
            ]
        },
        {
            "name": "SGASPhotoLibraryScreenRecorder",
            "source_files": "Pod/Classes/SGASPhotoLibraryScreenRecorder.{h,m}",
            "frameworks": "AssetsLibrary",
            "dependencies": {
                "SGASScreenRecorder/SGASScreenRecorder": []
            }
        }
    ]
}

Pin It on Pinterest

Share This