We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
playing movie through newtork (Read 535 times)
playing movie through newtork
Dec 8th, 2005, 5:41pm
 
I have two machines: machine_A (server) and machine_B (client)
on A i click
on B there is a movie which should start after i click A.

i copied scripts from the processing examples and changed them a bit.

the problem is that movie is starting 20 seconds after i click.

how should i avoid this lag?

here is a code

A:
import processing.net.*;
int port = 5204;
int grab = 0;

Server myServer;

void setup()
{
 size(200, 200);
 background(0);
 myServer = new Server(this, port); // Starts a myServer on port 5204
}
void draw()
{
 background(0);
 myServer.write(grab);
}

void mousePressed(){
 
 if (grab==0){
   grab=1;
 }  else grab=0;
 }

B:
import processing.video.*;
Movie myMovie;
import processing.net.*;

int data;  
Client client;
int grab;
 
void setup()
{
 size(640, 480);
 client = new Client(this, "192.128.11.153", 5204);
 println(client.ip());
 myMovie = new Movie(this, "station.mov");
 myMovie.loop();
}

void draw()
{
 background(0);
 if (client.available() > 0) {
   grab = client.read();
 }
 
 if (grab==1) {
   image(myMovie, 0, 0,640,480);
 }
}

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

// appreciate any help
Re: playing movie through newtork
Reply #1 - Dec 8th, 2005, 5:49pm
 
"myServer.write(grab)"  should not be within draw(), but within mousePressed().
thanks
Page Index Toggle Pages: 1