Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gif Recording #7

Closed
mokargas opened this issue Sep 21, 2015 · 3 comments
Closed

Gif Recording #7

mokargas opened this issue Sep 21, 2015 · 3 comments

Comments

@mokargas
Copy link

Is it possible to record a fixed length of time? Say 1 second, on a button click?

I've tried to do the following with the Gif renderer. I'm using a Canvas object previously created via p5.js:

function setup() {
    // setup camera capture
    videoInput = createCapture();
    videoInput.size(canvasWidth, canvasHeight);
    videoInput.position(0, 0);
    videoInput.parent('wrapper');

     // setup canvas
    cnv = createCanvas(canvasWidth, canvasHeight);
    cnv.position(0, 0);
    cnv.parent('wrapper');
}

With canvas rendering done in the draw function:

function draw() {
    clear();
    // a bunch of drawing calls go here ..
    render();      
 }

function render(){
    capturer.capture( cnv.elt );
 }

Then in my button handler:

 capturer.start();
 setTimeout(function(){
     capturer.stop();
     capturer.save( function( e ) { 
            console.log(e);
           //$('#gifOutput').attr('src', url);
         } );
  }, 1000);

I get an exception (which hangs the browser), from gif.coffee on line 72: "Width and height must be set prior to rendering".

@spite
Copy link
Owner

spite commented Sep 22, 2015

I think there's a couple of issue with trying to do this.

Do you have a jsfiddle or jsbin that I can check to make sure and reply?

@spite spite closed this as completed Apr 12, 2016
@Yugloocamai
Copy link

I have the exact same issue.

@spite
Copy link
Owner

spite commented Mar 2, 2019

There's a setting to specify the duration in seconds, timeLimit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants