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

I would like to play full movie every time when I touch yellow rectangle

$
0
0

I have figured out how to play and stop a movie.

Here I would like to know 2 things.

  1. I dont want screen to become black when I stop a movie.

  2. I would like to play full movie every time when I touch yellow rectangle. In other words, I dont want to stop a movie in a middle of video.

Thank You, Arigato m()m

import processing.video.*;
Movie movie;

void setup() {
  colorMode(HSB, 360, 100, 100);
  size(1280, 720);
  movie = new Movie( this, "movie.avi");
  frameRate(60);
}


void ellipseFront() {
  fill(0, 100, 100);
  ellipse(width*1/3, height/2, 100, 100);
}

void ellipseBack() {
  fill(120, 100, 100);
  ellipse(width*2/3, height/2, 100, 100);
}

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

void playMovie() {
  fill(60, 100, 100);
  rect(100, 100, 200, 200);
  image( movie, 0, 0, width, height);
  // if i touch yellow rect play movie
  if (mouseX > 100 && mouseX <300 && mouseY > 100 && mouseY <300) {
    movie.play();
  } else {
    movie.stop();
  }
}

void draw() {
  background(360);
  ellipseBack();
  playMovie();
  ellipseFront();
}

Viewing all articles
Browse latest Browse all 2896

Trending Articles