Important facts about commercial licenses

  • Licenses are perpetual. They do not expire and do not need to be renewed.
  • Licenses can be upgraded. You can upgrade to a more expensive license later paying only the difference in cost.
  • Pay attention to the distribution type - Hosted (sites / servers), binary (applications) or source (includes all the others). Choose according to your needs (more below).
  • All licenses allow commercial use unless otherwise indicated.
  • Read the full license by clicking on the icon.
  • Read more about licenses in our handy license guide.
$39

Single App License

1 application Binary restricted distribution 6 months support
$69

Multiple App License

5 applications Binary restricted distribution 6 months support
$99

Developer License

Unlimited projects Source and binary distribution 1 year support
You need to log-in or create an account
  • Create an account
  • Log-in
  • Please use your real name.
  • Account activation link will be sent to this address.
  • Minimum 8 characters

Clicking this button confirms you read and agreed to the terms of use and privacy policy.

(1 ratings)

iOS Screen Capture View

iOS Screen Capture View
Developed by Markelsoft, Released Jul 26, 2012

A UIView that records real-time video of its subviews. Make an app demo video. Get screen snapshots. Includes a demo.

Objective-C

Tags: ios6 , ipad , iphone , screen capture

UIScreenCaptureView is a UIView subclass for creating a video of screen captures of any view. For iPad, iPhone and iPod Touch.

The recording can be manually started and stopped or can be done for a specified number of seconds. Some uses:

  1. Create a video of your app
  2. Create a video of a specific view in your app
  3. Add screen capture video recording capability to any view in your app
  4. Make the main view for your app to allow your app users to create videos on their own
  5. Create screen capture images. Can access the individual screen capture images used to create the video.
  6. NEW: now have alternative methods that do not require adding UIScreenCaptureView as main view. New method e.g.: [screenCaptureView startRecordingViewForTimePeriod:seconds view:self.view parent:self];

Use UIScreenCaptureView like any UIView class and add views to record as subviews. If you would like to use the class to make a video of your app, make a UIScreenCaptureView the main view for your app. This way the recording will include all views in your app.

NEW: new methods have been added that do not require you to add a UIScreenCaptureView as the main view.

If you want to record a specific view only, then replace the view to record with a UIScreenCaptureView instance.

UIScreenCaptureView will make a recording of anything in it's subviews. Powerful and simple.

It's tested and works fine on iOS6 but will work on any other version as well.

Back to top

Supported OS & SDK Versions

  • Supported build target - iOS 6.0 / Mac OS 10.7 (Xcode 4.3.1, Apple LLVM compiler 3.1)
  • Earliest supported deployment target - iOS 6.0 / Mac OS 10.6
  • Earliest compatible deployment target - iOS 6.0 / Mac OS 10.6

NOTE: 'Supported' means that the library has been tested with this version. 'Compatible' means that the library should work on this OS version (i.e. it doesn't rely on any unavailable SDK features) but is no longer being tested for compatibility and may require tweaking or bug fixes to run correctly.

Back to top

Installation

To install UIScreenCaptureView into your app, drag the, UIScreenCaptureView.h and UIScreenCaptureView.m into your project. Make sure that you indicate to copy the files into your project. Also make sure that the Target Membership is checked for UIScreenCaptureView.m

Back to top

Usage

To use this class, you must link against the following frameworks:

  - AssetsLibrary
  - AVFoundation
  - CoreGraphics
  - CoreMedia
  - CoreVideo
  - QuartzCore
  - MediaPlayer

// see Demo Example in Examples/Demo folder for full example and source code

 // To use view to make a video of screen snapshots of you app.
 // First make your view the UIScreenCaptureView
 // then any view added to UIScreenCaptureView will included when recording…


  (void)viewDidLoad {
 [super viewDidLoad];

 // create screen capture view.   Any subviews added to screen capture view will be recorded.
 UIScreenCaptureView * screenCaptureView = [[UIScreenCaptureView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
 screenCaptureView.delegate = self;   // implements UIScreenCaptureViewDelegate interface
 self.view = screenCaptureView;

 // add your views to be recorded.   If you do not want to make the screenCaptureView your main view, see ALTERNATIVE below
 [self.view addSubView:yourView];

  // set some options
 [screenCaptureView setFrameRate:10.0f];            // 10 frames per seconds (10 frames is the default) adjust to control
                                                    // sampling of screen captures used in making video.
 [screenCaptureView setOutputName:@"output1.mp4"];  // output name (output.mp4 is the default)
 [screenCaptureView setVerbose:false];              // verbose debug mode (false is default)

  // ALTERNATIVE: if you did not want to set a UIScreenCaptureView as your parent view, then you
  // can use this alternate recording method to record your main views components.
  // To use this method you do not need to do the [self.view addSubview:yourView] call above
  // as you will be providing self.view which is your current view used.
  // [screenCaptureView startRecordingViewForTimePeriod:seconds view:self.view parent:self];

 // MANUAL RECORDING TIED TO BUTTONS if you want manual start recording by clicking a button, 
 // then create a UIButton that calls startRecording method when clicked.  Add another button 
 // to call stopRecording 

 // TIMED RECORDING: this test shows starting a timed recording for 20 seconds which records 
 // a video of view added to screenCaptureView
 [NSThread detachNewThreadSelector:@selector(startRecordingForTimePeriodTestThread:) toTarget:self withObject:@""];
 }

 // timed recording...
 (void)startRecordingForTimePeriodTestThread:(NSString *)arg {

[NSThread sleepForTimeInterval:1];
[self performSelectorOnMainThread:@selector(startRecordingForTimePeriodTest:) withObject:@"" waitUntilDone:NO];
}

 (void)startRecordingForTimePeriodTest:(NSString *)arg {

    [self startRecordingForTimePeriod:20];
}

 (void)startRecordingForTimePeriod:(int)seconds {

recordButton.hidden = TRUE;
stopButton.hidden = TRUE;

playIndex = 0;
recordingSeconds = seconds;
recordingTimer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(recordingTimerElapsed:) userInfo:nil repeats:YES];   

[screenCaptureView setFrameRate:10.0f];             // 10 frames per seconds (10 frames is the default)
[screenCaptureView setOutputName:@"video.mp4"];     // output name (output.mp4 is the default)
[screenCaptureView setVerbose:FALSE];                // verbose debug mode off

// record any subview of screenCaptureView...
//[screenCaptureView startRecordingForTimePeriod:seconds];   // record for N seconds

// if you did not want to add a UIScreenCaptureView as your parent view, then you
// can use this alternate recording method to record your main views components.

// alternate method records any subview of self.view without having to 
// make screenCaptureView the parent view.   Make sure the view passed is the main app view...
// this is useful for adding app demo video recording to your app without modifying your view layout...
[screenCaptureView startRecordingViewForTimePeriod:seconds view:self.view parent:self];
 }

 (void)startRecording {

recordButton.hidden = TRUE;
stopButton.hidden = FALSE;

playIndex = 0;
recordingTimer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(recordingTimerElapsed:) userInfo:nil repeats:YES];   

[screenCaptureView setFrameRate:10.0f];            // 10 frames per seconds (10 frames is the default)
[screenCaptureView setOutputName:@"video.mp4"];    // output name (output.mp4 is the default)
[screenCaptureView setVerbose:FALSE];              // verbose debug mode off
[screenCaptureView startRecording];                // verbose debug mode (false is default)
 }

// outputPathOrNil has the local output path if successful or nil if an error occurred...
 (void)recordingFinished:(NSURL *)outputPathOrNil {

 if (outputPathOrNil != nil) {
     NSLog(@"local output filename is %@", outputPathOrNil);

     // save the created video to Photos...
     NSString * outputName = [outputPathOrNil path];
     [screenCaptureView saveToPhotos:outputName target:self];

     // ---- other options:
     // play recorded video
     // [screenCaptureView playVideo:outputPathOrNil parent:self];

     // remove local copy
     // [screenCaptureView removeLocalCopyOfVideo:outputPathOrNil];    
     // ---- end other options
 } else
     NSLog(@"Error creating the video!");
}

 (void)video:(NSString *)videoPath didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo {

 if (error != nil)
     NSLog(@"Try to saved video and got the error: %@", [error description]);
}

// Methods:

(id)initWithFrame:(CGRect)frame parent:(UIViewController *)parent;  

(BOOL)startRecording;     // start recording screen captures...
(BOOL)startRecordingForTimePeriod:(int)seconds;  // start recording screen captures for so many seconds...

 (BOOL)startRecordingView:(UIView *)view parent:(UIViewController *)_parent;     // start recording screen captures for a view...
 (BOOL)startRecordingViewForTimePeriod:(int)seconds view:(UIView *)view parent:(UIViewController *)_parent;  // start recording screen captures for so many seconds for a view...

 (void)stopRecording;   // stop recording screen captures and save video...

 (UIImage *)screenCaptureView:(UIView *)view;   // get screen capture image for a view

 (UIImage *)screenCaptureView2:(UIView *)view rect:(CGRect)rect;  // get screen capture image for a specific area of a view

 (void)playVideo:(NSURL *)videoUrl parent:(UIViewController *)parent;  // play a recorded view using the supplied view controller

 (BOOL)removeLocalCopyOfVideo:(NSURL *)localFile;    // remove the local copy of a recorded video

 (void)setVerbose:(BOOL)verbose;   // turn verbose mode on which displays more details when recording
Back to top

Example Project Demo

The UIScreenCaptureViewDemo demo example in the Examples/Demo folder demonstrates how you might implement using UIScreenCaptureView.

The example is for iOS.

View all 1 reviews »

User Reviews

  • Vadim Glebov 7 months ago
    UIScreenCaptureView is very useful for me. And it saved my time.
    Flag
    Was this helpful? Yes No
Read all 53 comments »

Questions & Comments


Or enter your name and Email
  • Eduardo Urias License holderSingle App License 4 weeks ago
    Can I use this the record the contents of an AVPlayerLayer?
    • Markelsoft Developer 1 week ago
      Currently no. We are looking at your issue as we start work on a new version.
  • Michiel Timmerman License holderSingle App License 1 month ago
    I bought the package but do have a couple of questions.
    1. It seems that the movie generated from the images is corrupted when in landscape mode. I checked the code and the images should take the orientation of the Screen Capture View. The movie is of the correct size and orientation. Am I doing something wrong?

    2. In the recorded view it seems that clear view (transparant) places on the view are turned black. Is it possible to add this transparancy in the movie instead of the black?
    • Markelsoft Developer 1 week ago
      We are looking at your issues as we start work on a new version.
    • Markelsoft Developer 1 week ago
      I tried to recreate your transparent view being recorded as black:

      - I added a transparent view on top then did a recording and did not see black where the transparent view was.
  • Bob Dole License holderMultiple App License 1 month ago
    This may not be a universal fix, but I ran into an issue when using a View that was built in Landscape mode and is used in landscape mode in the simulator. The code uses self.frame.size, but self.bounds.size is the only one that has width and height properly swapped. When using self.frame.size, some of the subviews draw wrong in the video. I bought your code just because I couldn't resolve this issue after about an hour of trying, but it turned out that you had the exact same issue. Again, I'm not sure if this fixes one issue and causes others, but it works for me.
    • Markelsoft Developer 1 week ago
      Thanks we do have the same problem and are fixing it.
You must be logged-in to vote. Log-in to your account or register now.