Error going from Processing 2 to Processing 3

edited October 2015 in Library Questions

I'm not sure if this is the right forum for this quesiton. I couldn't find a category dealing with P2 to P3 issues.

I have code that works in Processing 2 but does not work in Processing 3. Here is the code, and below is a photo of the error that I get:

/**
 * Playback Speed 
 * 
 * Move the cursor across the screen to  
 * change the speed of the video playback. 
 * moving the cursor  farther to the left plays the movie
 * faster forward, moving it farther to the right plays it back 
 * faster backwards. Placing the cursor in the middle of the screen
 * pauses the movie.
 */

import jmcvideo.*;
import processing.opengl.*;
JMCMovie myMovie;



void setup() 
{
  size(320, 240, P2D);
  background(0);

  // Load and play the video in a loop
  myMovie = movieFromDataPath("lincoln_01.mov"); 

  //myMovie.play();
  myMovie.loop();
  //myMovie.bounce();

}

JMCMovie movieFromDataPath(String filename)
{
   return new JMCMovie(this, filename, RGB);
}


void draw() 
{

  image(myMovie, 0, 0, myMovie.width, myMovie.height);
  myMovie.setRate (((width/2.0-mouseX)/(width/2.0))*3.0);

}

Screen Shot 2015-10-13 at 1.46.33 PM

Answers

  • I think it's an issue with the "jmcvideo" library. It hasn't been updated since 2009: https://github.com/angusforbes/jmcvideo

    I recommend modifying the code to work with the Video library.

    import processing.video.*;
    Movie myMovie;
    
    void setup() {
      size(200, 200);
      myMovie = new Movie(this, "totoro.mov");
      myMovie.loop();
    }
    
    void draw() {
      image(myMovie, 0, 0);
    }
    
    void movieEvent(Movie m) {
      m.read();
    }
    
  • Answer ✓

    The code above is a start. The speed() method allows you to set the playback speed with the Video library.

  • Thanks REAS. This is very helpful! I'll implement the Video library instead.

Sign In or Register to comment.