Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Play and replay the video after few second of the playing time message.

$
0
0

Hello

I was trying to make a code for playing my project. But I couldn't figure out how to make the same video play and after finished showing few second (maybe 5 seconds) of how many times video played. and again playing the video.

  1. after the finished video, then showing the message
  2. the message counting how many times played.
  3. 5 sec after automatically play again.

It could be a very obvious question, but few days of searching, I still couldn't find the solution...

please anyone can advise on this problem?

import processing.video.Movie;

Movie vid;
boolean ended;

void setup() {
  frameRate(30);
  textSize(050);
  textAlign(CENTER, BASELINE);
  fill(0);

  vid = new Movie(this, "StudioOutside.mov") {
    @ Override public void eosEvent() {
      super.eosEvent();
      myEoS();
    }
  };

  vid.play();
  while (vid.width == 0 | vid.height == 0)  delay(10);

  surface.setSize(vid.width, vid.height); // P3
  //size(vid.width, vid.height); // P2
}

void draw() {
  if (!ended)  background(vid);
  else {
    if (key == ' ' || key == ' ') {
      keyPressed = true;
    if (keyPressed == true) {
     background(vid);
     vid.play();
    }
      } else {
    vid.stop();
    background(255);
    text("Playback has finished!", width>>1, height>>1);
  }
  }
}

void movieEvent(final Movie m) {
  m.read();
}

void myEoS() {
  ended = true;
  frameRate(1);
}

Viewing all articles
Browse latest Browse all 2896

Trending Articles