Screen Capture View, a UIView subclass that records real-time video of the screen or a subview. The sample/update rate can be configured by setting the frameRate property. Can include audio for global sounds (app, microphone, etc) with recorded video.
Create a video of view, full screen with status bar or full screen without the status bar area. By default, the view and it's subviews are recorded. Get a screenshot at any time of a view, full screen with status area or full screen without status area.
By default, all screen snapshots are now done on a background thread to free up the UI main thread. A flag in UIScreenCaptureView class lets you switch between running snapshot on background or main thread.
This class can also be used to record real-time video of its subviews, using the startRecording and stopRecording methods. A new recording will overwrite any previously made recording file, so if you want to create multiple recordings per session (or across multiple sessions) then it is your responsibility to copy/back-up the recording output file after each session.
// Recording the screen
// Create screen capture view. Any subviews added to screen capture view will be recorded.
int captureViewWidth = self.view.width;
int captureViewHeight = self.view.height;
BOOL fullScreen = TRUE;
BOOL includeStatusBar = FALSE:
UIScreenCaptureView * screenCaptureView = [[UIScreenCaptureView alloc] initWithFrame:CGRectMake(0, 0, captureViewWidth, captureViewHeight)] parent:self fullscreen:fullscreen includeStatusBar:incldueStatusBar];
// Recording options:
[screenCaptureView includeAudio:TRUE]; // indicates audio
[screenCaptureView setFrameRate:15.0f]; // 15 frames per second (10 fps the default)
[screenCaptureView setOutputName:@"video.mp4"]; // output name (output.mp4 is the default)
[screenCaptureView setVerbose:TRUE]; // verbose debug mode
screenCaptureView.delegate = self; // implements UIScreenCaptureViewDelegate interface
self.view = screenCaptureView; // if make main view then add app subviews to it, can record the full app window. If you add the screenCaptureView as a subview of any of your windows, then only the subviews of the screenCaptureView are recorded. Note: Videos are currently is not recorded.
[screenCaptureView startRecording]; // verbose debug mode (false is default)
// Getting a screenshot of the screen
// Take screen snapshot and return the resulting image
UIImage * screenSnapshot = [UIScreenCaptureView takeScreenSnapshot];
// Take screen snapshot and save the resulting image to photos
// Take a screenshot and include status bar area and return the resulting image
UIImage * screenSnapshotWithStatusBar = [UIScreenCaptureView takeScreenshotWithStatusBar;
// Take a screenshot and do not include status bar area and return the resulting image
UIImage * screenSnapshotNoStatusBar = [UIScreenCaptureView takeScreenSnapshotWithNoStatusBar;
// Take a screenshot of a UIView
UIImage * screenSnapshotForView = [UIScreenCaptureView takeScreenSnapshotOfView:theView];
- Take a screen snapshot and save to photos. Includes UIView and it's subviews contents.
- Create a video of your app
- Create a video of a specific view in your app.
- Create a video and include audio for global sounds such as app sounds, mic etc....
- Create a video including full screen device area and status area.
- Create a video including full screen device area and no status area.
- Add screen capture video recording capability to any view in your app
- Make the main view for your app to allow your app users to create videos on their own
- Create screen snapshot images. Can access the individual screen capture images used to create the video.
- Create screen snapshot. Periodically samples its current display to create a snapshot of the screen. So you do not have to even start recording to get screen snapshots. Use frameRate to adjust the sampling rate.
- Create full-screen screen capture or video with or without the status area.
- Get a screen capture of full screen with status area.
- Get a screen capture of the full screen without status area.
- Get a screen capture of a specific view.
New alternative methods that do not require adding UIScreenCaptureView as main view.
e.g.: [screenCaptureView startRecordingViewForTimePeriod:seconds view:self.view parent:self];
New static screenshot methods for just getting a screenshot image for an area of the screen.
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.
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 including audio, if desired.