I'm trying to incorporate GSVideo into a game I've developed - the video is to be displayed as a texture on a panel in the game (the video has sound which I also want to play), and I've run a few tests to make sure my initial GSVideo code is correct.
Problems arise, however, when I start the video after playing a few sound effects using Minim. The video appears as a texture for the first frame or two then disappears. I've checked what's going on, and the video width is correct for those few frames, but then returns to zero. No error messages are printed.
What I
think is going on is a pulseaudio problem. I'm running processing-1.0.9 on Ubuntu Karmic, and if I want Minim to work, I have to start processing after making sure that no other applications that use audio are running. That's my first clue.
Obviously, my GSMovie object needs to use audio too, so when it starts to play the video but finds it can't output audio, it dies. Using this fuzzy logic, I've added code that kills any running samples Minim may be playing, but my GSMovie still fails silently.
So what I'm asking is, has anyone else had this type of problem? Am I right in thinking this is pulseaudio (Ubuntu users shout YES in unison
) And how do I debug this if GSVideo fails silently?
Edit: Thought I'd include an example that demonstrates the problem:
This works:
Code:import processing.opengl.*;
import codeanticode.gsvideo.*;
import ddf.minim.*;
import ddf.minim.signals.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
GSMovie movie;
Minim minim;
AudioSnippet sfx;
boolean KEY = false;
void setup() {
size(640, 480, OPENGL);
minim = new Minim(this);
sfx = minim.loadSnippet("groove.mp3");
sfx.play();
movie = new GSMovie(this, "back-wall.avi");
background(0);
}
void movieEvent(GSMovie myMovie) {
myMovie.read();
}
void draw() {
if (KEY) image(movie, 0, 0, width, height);
}
void keyPressed() {
movie.play();
sfx.close();
KEY = true;
}
void stop() {
minim.stop();
super.stop();
}
When I remove the command to stop the sound effects, the video displays the first frame then fails:
Code:void keyPressed() {
movie.play();
KEY = true;
}