I've written a program that displays 3 random image loops and plays some audio. That part is all fine. However, when the audio finishes I want to stop everything, play a short video and then exit the program. The audio from the video is playing, and the program exits at the right time, but the video appears to be either hidden behind the images or not playing properly. Can't find anything about this after multiple searches... Here is the code:
GlitchObject myGlitch;
boolean glitch = true;
PImage [] imagesbg;
int numImagesbg = 14;
int counterbg = 0;
PImage [] imageshl;
int numImageshl = 45;
int counterhl = 15;
PImage [] images;
int numImages = 65;
int counter = 46;
import processing.video.*;
Movie turnoff;
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;
import ddf.minim.*;
Minim minim;
AudioPlayer song1;
void setup() {
size(1440, 900);
frameRate(10);
minim = new Minim(this);
song1 = minim.loadFile("Project Audio2.mp3");
imageshl = new PImage[numImageshl];
for (int i=15; i<numImageshl; i++) {
imageshl[i] = loadImage( str(i)+".png" );
}
images = new PImage[numImages];
for (int i=46; i<numImages; i++) {
images[i] = loadImage( str(i)+".png" );
}
imagesbg = new PImage[numImagesbg];
for (int i=0; i<numImagesbg; i++) {
imagesbg[i] = loadImage( str(i)+".png" );
}
myGlitch = new GlitchObject();
turnoff = new Movie(this, "TV Static Turn Off Effect.mov");
}
void draw() {
song1.play();
noLoop();
image(imagesbg[counterbg], 0, 0);
counterbg++;
if (counterbg>=numImagesbg) {
counterbg=0;
}
if (frameCount % 40 == 0 || frameCount == 0) {
counterhl = (int)random(15, 45);
}
image(imageshl[counterhl], 50, 500);
if (counterhl>=numImageshl) {
counterhl=15;
}
if (frameCount % 40 == 0 || frameCount == 0) {
counter = (int)random(46, 65);
}
image(images[counter], 750, 400);
if (counter>=numImages) {
counter=46;
}
if (glitch) {
myGlitch.run();
}
if (frameCount % 50 == 0) {
background(0);
turnoff.play();
song1.pause();
}
if (frameCount % 75 == 0 || frameCount == 0) {
exit();
}
}
I haven't included the GlitchObject code cos I don't think it's relevant, but I can post if you think it is...