Video not showing up?

edited May 2015 in Library Questions

I'm making a little interactive doo-hickey for a class, and it's based on the fact that I little videos playing on each page. I've only gotten far enough to implement one, but it doesn't show up. The video is called in "void driveOff()" (at the bottom). Any idea on whats wrong?

EDIT: I figured it out.

import processing.video.*;

// Project #3, Art Assignment

PFont regular;
PFont light;
PFont small;
PFont big;

Movie sequence1;
PImage startOff;

boolean clutch = false;

color buttonText = color(40);
color titleText = color(250);
color textHover = color(250);
color buttonShadow = color(250);
color buttonColor = color(237, 227, 54);
color buttonHover = color(87, 74, 184);

color mainBG = color(28, 15, 120);

int page = 0;

// go Left/right button
int lrSize = 100;

int leftX = 230;
int lrY = 150;
// go RIGHT button
int rightX = 1050;
// go STRAIGHT button
int straightX = 490;
int straightY = 100;

// go Straight Button size
int straightW = 300;
int straightH = 100;

// Yes & No
int yesX = leftX+120;
int yesnoY = lrY+100;
int noX = rightX-115;

// button corners
int buttonCorner = 10;
// Start Over button
int startOverSize = 200;
int startOverX = 640;
int startOverY = 600;

// START Button
int startButtonSize = 500;
int startButtonX = 640;
int startButtonY = 612;


void setup() {
  size (1280, 1024);
  regular = loadFont("Sansation_Regular-40.vlw");
  light = loadFont("Sansation_Light-40.vlw");
  small = loadFont("Sansation_Light-24.vlw");
  big = loadFont("Sansation_Light-100.vlw");
  startOff = loadImage("startOff.png");

  sequence1 = new Movie(this, "sequence01.mov");
  sequence1.noLoop();

  frameRate(60);
}

void draw() {    
  // HOME PAGE
  if (page==0) {
    startPage();
  } else if (page==1) {
    driveOrWalk();
  } else if (page==2) {
    pagetwo();
  } else if (page==3) {
    walkBoring();
  } else if (page==4) {
    clutch();
  } else if (page==5) {
    driveOff();
  }

  println("Page: " + page);
}

void mousePressed() {
  if (page==0 && ellipseHover (startButtonX, startButtonY, startButtonSize) == true) {
    page=1;
  }
  if (page!=1 && ellipseHover (startOverX, startOverY, startOverSize) == true) {
    page=1;
  }
  // Drive?
  if (page==1 && ellipseHover (yesX, yesnoY, lrSize) == true) {
    page=2;
  }
  if (page==1 && ellipseHover (noX, yesnoY, lrSize) == true) {
    page=3;
  }

  // Start
  if (page==2 && clutch==false && rectHover (straightX, straightY, straightW, straightH) == true) {
    page=4;
  } else if (page==2 && clutch==true && rectHover (straightX, straightY, straightW, straightH) == true) {
    page=5;
  } // Clutch
  if (page==4 && rectHover (straightX, straightY+200, straightW, straightH) == true) {
    clutch = true;
    page=2;
  }
}

// START Page
void startPage() {
  background(mainBG);

  textAlign(CENTER, TOP);
  fill(titleText);
  textSize(100);
  textFont(big);
  text("'find the quietest place.'", 650, 150);

  startButton();
}


// BUTTONS
boolean rectHover (int x, int y, int width, int height) {
  if (mouseX > x && mouseX < x+width && mouseY > y && mouseY < y+height) {
    return true;
  } else {
    return false;
  }
}

boolean ellipseHover (int x, int y, int diameter) {
  float disX = x - mouseX;
  float disY = y - mouseY;
  if (sqrt(sq(disX) + sq(disY)) < diameter/2 ) {
    return true;
  } else {
    return false;
  }
}

void startButton() {
  textAlign(CENTER, CENTER);
  textSize(100);
  textFont(big);
  strokeWeight(3);
  if (ellipseHover (startButtonX, startButtonY, startButtonSize) == true) {
    stroke(buttonShadow);
    fill(buttonHover);
    ellipse(startButtonX, startButtonY, startButtonSize, startButtonSize);
    fill(titleText);
    text("START", startButtonX-1, startButtonY-8);
  } else {
    noStroke();
    fill(buttonColor);
    ellipse(startButtonX, startButtonY, startButtonSize, startButtonSize);
    fill(buttonText);
    text("START", startButtonX-1, startButtonY-8);
  }
}

void startOver() {
  textAlign(CENTER, CENTER);
  textSize(40);
  textFont(regular);
  if (ellipseHover (startOverX, startOverY, startOverSize) == true) {
    stroke(buttonShadow);
    fill(buttonHover);
    ellipse(startOverX, startOverY, startOverSize, startOverSize);
    fill(titleText);
    text("start", startOverX, startOverY-20);
    text("over", startOverX, startOverY+17);
  } else {
    noStroke();
    fill(buttonColor);
    ellipse(startOverX, startOverY, startOverSize, startOverSize);
    fill(buttonText);
    text("start", startOverX, startOverY-20);
    text("over", startOverX, startOverY+17);
  }
}

void pageButtons() {
  textAlign(CENTER, CENTER);
  textSize(40);
  textFont(regular);

  // GO LEFT
  if (ellipseHover (leftX, lrY, lrSize) == true) {
    stroke(buttonShadow);
    fill(buttonHover);
    ellipse(leftX, lrY, lrSize, lrSize);
    fill(titleText);
    text("left", leftX, lrY-3);
  } else {
    noStroke();
    fill(buttonColor);
    ellipse(leftX, lrY, lrSize, lrSize);
    fill(buttonText);
    text("left", leftX, lrY-3);
  }

  // GO RIGHT
  if (ellipseHover (rightX, lrY, lrSize) == true) {
    stroke(buttonShadow);
    fill(buttonHover);
    ellipse(rightX, lrY, lrSize, lrSize);
    fill(titleText);
    text("right", rightX, lrY-3);
  } else {
    noStroke();
    fill(buttonColor);
    ellipse(rightX, lrY, lrSize, lrSize);
    fill(buttonText);
    text("right", rightX, lrY-3);
  }

  // GO STRAIGHT
  if (rectHover (straightX, straightY, straightW, straightH) == true) {
    stroke(buttonShadow);
    fill(buttonHover);
    rect(straightX, straightY, straightW, straightH, buttonCorner);
    fill(titleText);
    text("straight", straightX+150, straightY+47);
  } else {
    noStroke();
    fill(buttonColor);
    rect(straightX, straightY, straightW, straightH, buttonCorner);
    fill(buttonText);
    text("straight", straightX+150, straightY+47);
  }
}


// PAGES

void driveOrWalk() {
  background(mainBG);
  textAlign(CENTER, TOP);
  fill(titleText);
  textSize(100);
  textFont(big);
  text("drive?", 650, 150);

  textAlign(CENTER, CENTER);
  textSize(40);
  textFont(regular);

  if (ellipseHover (yesX, yesnoY, lrSize) == true) {
    stroke(buttonShadow);
    fill(buttonHover);
    ellipse(yesX, yesnoY, lrSize, lrSize);
    fill(titleText);
    text("yes", yesX, yesnoY-3);
  } else {
    noStroke();
    fill(buttonColor);
    ellipse(yesX, yesnoY, lrSize, lrSize);
    fill(buttonText);
    text("yes", yesX, yesnoY-3);
  }

  if (ellipseHover (noX, yesnoY, lrSize) == true) {
    stroke(buttonShadow);
    fill(buttonHover);
    ellipse(noX, yesnoY, lrSize, lrSize);
    fill(titleText);
    text("no", noX, yesnoY-3);
  } else {
    noStroke();
    fill(buttonColor);
    ellipse(noX, yesnoY, lrSize, lrSize);
    fill(buttonText);
    text("no", noX, yesnoY-3);
  }
}

void pagetwo() {
  background(mainBG); 
  image(startOff, 0, 260);
  if (rectHover (straightX, straightY, straightW, straightH) == true) {
    stroke(buttonShadow);
    fill(buttonHover);
    rect(straightX, straightY, straightW, straightH, buttonCorner);
    fill(titleText);
    text("go", straightX+150, straightY+47);
  } else {
    noStroke();
    fill(buttonColor);
    rect(straightX, straightY, straightW, straightH, buttonCorner);
    fill(buttonText);
    text("go", straightX+150, straightY+47);
  }
}

void walkBoring() {
  background(mainBG);
  textAlign(CENTER, TOP);
  fill(titleText);
  textSize(100);
  textFont(big);
  text("boring", 650, 150);
  text("try again.", 650, 320);

  startOver();
}

void clutch() {
  background(mainBG);
  textAlign(CENTER, TOP);
  fill(titleText);
  textSize(40);
  textFont(regular);
  text("you forgot to press the clutch.", 650, 200);

  textAlign(CENTER, CENTER);
  textSize(40);
  textFont(regular);
  if (rectHover (straightX, straightY+200, straightW, straightH) == true) {
    stroke(buttonShadow);
    fill(buttonHover);
    rect(straightX, straightY+200, straightW, straightH, buttonCorner);
    fill(titleText);
    text("press clutch", straightX+150, straightY+247);
  } else {
    noStroke();
    fill(buttonColor);
    rect(straightX, straightY+200, straightW, straightH, buttonCorner);
    fill(buttonText);
    text("press clutch", straightX+150, straightY+247);
  }
}

void driveOff() {
  background(mainBG);

  image(sequence1, 0, 260);

  pageButtons();
}

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

Answers

  • Answer ✓

    Could you tell me what the solution to this was? I'm having a similar problem.

  • the movie name.play(); needs to be in the page displayed. However I ran into other issues later when trying to switch videos, and ended up switching to .gifs.

Sign In or Register to comment.