Display JPEG and then play a movie
in
Contributed Library Questions
•
3 months ago
Hi......
I have two capacitive sensors ........i am trying to do is if some one touch capacitive sensor 1 then a JPEG will be shown
and if capacitive sensor2 is touched then a movie will play.......
I have done this by serial communication..
I can switch them easily by touching sensors. JPEG is perfectly working and when i touch sensor to play a movie ..... movie runs in background only i can hear sound of movie.
Here is my code
import processing.opengl.*;
import codeanticode.gsvideo.*;
import codeanticode.glgraphics.*;
import processing.serial.*;
Serial port;
GSMovie myMovie;
GSMovie nowPlaying;
GLTexture tex;
PImage img1;
int val1 = 0;
void setup() {
size(960, 540, GLConstants.GLGRAPHICS);
background(0);
//frameRate(60);
img1 = loadImage("00.jpg");
tex = new GLTexture(this);
myMovie = new GSMovie(this, "solar1.mov" );
nowPlaying = myMovie;
println(Serial.list());
// print a list of all available ports
port = new Serial(this, Serial.list()[1], 9600);
}
void draw()
{
if ( port.available() > 0) { // If data is available,
val1 = port.read();
}
if (val1 == 2) {
image(nowPlaying,0,0,width,height);
nowPlaying = myMovie;
nowPlaying.loop();
}
if (val1 == 4) {
myMovie.pause();
image(img1, 0, 0, width,height);
}
}
void movieEvent(GSMovie _mov){
_mov.read();
}
thanking you in anticipation
1