Loading longer movie and while doing so show a small animation?

edited October 2015 in Library Questions

Hello all,

I want to load a movie during the sketch (and not in setup() because it takes too long then and the movie is rarely needed in the sketch) and when I load it, I want to show a small animation, to show the user has to wait.

    myMovie = new Movie(this, "my.mov");

but I can't show any animation because the sketch waits at this line...

so how can I put this in another thread of event function please?

I am lost.

Thank you all!!!

Best, Chrisir ;-)

Answers

  • edited October 2015 Answer ✓
    import processing.video.Movie;
    
    Movie myMovie;
    
    void setup() {
      thread("loadVideo");
    }
    
    void draw() {
      if (myMovie != null && myMovie.width != 0)  set(0, 0, myMovie);
    }
    
    void loadVideo() {
      (myMovie = new Movie(this, "my.mov")).loop();
    }
    
    void movieEvent(Movie mv) {
      mv.read();
    }
    
  • Wow...

    I'll test it....

  • thank you!

  • this works:

    import processing.video.*;
    
    Movie myMovie = null;
    String loadingText = "Loading";
    
    void setup() {
      size(700, 600);
      background(111);
      println("A");
      thread("loadVideo");
      println("B");
    }
    
    void draw() {  
      if (myMovie != null) {
        println("loading Done.");
        // if (myMovie != null) {
        myMovie.play();  
        image( myMovie, 0, 0);
      } else {
        background(111);
        println("C");
        text(loadingText, 20, 20, width-40, 1000);
        loadingText+=".";
      }
    }
    
    void loadVideo() {
      myMovie = new Movie(this, "My.mov");
    }
    
    void movieEvent(Movie mv) {
      mv.read();
    }
    //
    
  • edited October 2015 Answer ✓

    Indeed forgotten to play() the video and import the Movie class: #-o

    import processing.video.Movie;
    
    void loadVideo() {
      (myMovie = new Movie(this, "my.mov")).loop();
      println("Movie loading done!");
    }
    
  • thanks again

    can you recommend a program to compress this mov-file?

    thank you!

  • AFAIK, in order to shorten a video file we need to re-decode it using a worse setting.

Sign In or Register to comment.