Coder Social home page Coder Social logo

glimpse's Introduction

Glimpse

Glimpse is a simple library that allows you to create videos from UIViews. It records animations and actions as they happen by taking screen shots of a UIView in a series and then creating a quicktime video and saving it to your app’s document folder.

Setup

To setup Glimpse, add the Glimpse project file to your project or workspace. Import <Glimpse/Glimpse.h> where you want to use it.

Example Usage

Glimpse only uses 2 methods that start and stop recording your view.

#import <Glimpse/Glimpse.h>

@implementation myViewController
- (void)viewDidAppear
{
	    [super viewDidAppear:animated];
    
    	// Create a new Glimpse object.
	    Glimpse *glimpse = [[Glimpse alloc] init];
	    
	    // Start recording and tell Glimpse what to do when you are finished
    	[glimpse startRecordingView:self.view onCompletion:^(NSURL *fileOuputURL) {
        	NSLog(@"DONE WITH OUTPUT: %@", fileOuputURL.absoluteString);
	    }];

		// Create a subview for this example
    	UIView *view = [[UIView alloc] initWithFrame:CGRectInset(self.view.bounds, 40.0f 40.0f)];
	    view.backgroundColor = [UIColor greenColor];
	    view.alpha = 0.0f;
    	
    	[self.view addSubview:view];
    
    	// We are going to record the view fading in.
	    [UIView animateWithDuration:5.0 animations:^{
    	    view.alpha = 1.0f;
	    } completion:^(BOOL finished) {
	    	// Since our animation is complete, lets tell Glimpse to stop recording.
    	    [glimpse stop];
	    }];
 }
@end

Developer info

License

Read LICENSE file for more info.

glimpse's People

Contributors

aogden-zynga avatar pgmy avatar wess avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

glimpse's Issues

much time to create video

i want to use this code for screen recording in drawing app...but it takes much time to convert the video

Having issue to Save fileOutPutUrl to device

I can save video to Documents of Mac ,but could not save video file to real device using Here is my code ,What I've done so far

        ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
       glim=[[Glimpse alloc]init];

     [glim startRecordingView:self.view onCompletion:^(NSURL *fileOuput) {
     NSLog(@"File Output :%@",fileOuput.absoluteString);
    if (fileOuput)
    {
    if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:fileOuput])
        {
            [library writeVideoAtPathToSavedPhotosAlbum:fileOuput
                                        completionBlock:^(NSURL *assetURL, NSError *error){}
             ];
        }

    }

}];

Capture video in background?

Hi,

do you have a sample to capture the video in background?

I want to prevent that the user have to view the whole uiview animation until the rendering is done.

Many thanks for your answer!
Marcus

Video clarity

How to make best clarity video? Video clarity is very low.

fileOutputURL does not contain valid file

after stopping glimpse from recording I want to save this file into the camera roll.
Below is the completion block I am using....

[glimpse startRecordingView:self.tableView onCompletion:^(NSURL *fileOuputURL) {
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library writeVideoAtPathToSavedPhotosAlbum:fileOuputURL completionBlock:^(NSURL *assetURL, NSError *error) {
NSLog(@"%@",error);
NSLog(@"%@",assetURL);
NSLog(@"%@",fileOuputURL);
}];
}];

assetURL is NULL as well as my error. So it does not seem to error out. Any reason why I can't use this file URL that is generated from glimpse to save this file to someones camera roll?

How to increase framerate?

Changing self.framesPerSecond = 1; in GlimpseAssetWriter has no effect. Is some other change required?

Assertion Fails for NSParameterAssert(success)

Hi,

While recording the UIView animation, I encountered below Crash whenever I try to record the screen.

2015-04-17 07:09:46.170 Planbook[848:6733] *** Assertion failure in -[GlimpseAssetWriter writeVideoFromImageFrames:], /Users/dshah/Documents/Planbook/Libraries/GlimpseAssetWriter.m:151
2015-04-17 07:09:46.176 Planbook[848:6733] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: success'
*** First throw call stack:
(
0 CoreFoundation 0x0000000103b08c65 exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000103446bb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000103b08aca +[NSException raise:format:arguments:] + 106
3 Foundation 0x000000010305a98f -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
4 Planbook 0x0000000102dcf4b1 -[CaptureAssetWriter writeVideoFromImageFrames:] + 945
5 Planbook 0x0000000102dca293 -[CaptureView stop] + 291
6 Foundation 0x0000000102ff8744 __NSFireTimer + 83
7 CoreFoundation 0x0000000103a70174 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION
+ 20
8 CoreFoundation 0x0000000103a6fd35 __CFRunLoopDoTimer + 1045
9 CoreFoundation 0x0000000103a31d3d __CFRunLoopRun + 1901
10 CoreFoundation 0x0000000103a31366 CFRunLoopRunSpecific + 470
11 GraphicsServices 0x0000000107a93a3e GSEventRunModal + 161
12 UIKit 0x00000001044b6900 UIApplicationMain + 1282
13 Planbook 0x0000000102dd06ef main + 111
14 libdyld.dylib 0x00000001058d9145 start + 1
15 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

I have searched google and found the reason that appendPixelBuffer:withPresentationTime: method of AVAssetWriterInputPixelBufferAdaptor fails writing the buffer and hence the Success parameter is FALSE. I tried using below line instead of

while(!self.adapter.assetWriterInput.readyForMoreMediaData) {}

// [NSThread sleepForTimeInterval:sleepOffset];

This takes makes sure that buffer writing is completed. But this code also doesn't work.

Can you please provide any input for the same? Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.