Ask a Question related to Macromedia Flash Flashcom, Design and Development.
-
McKean #1
Webcam Application
I'm currently developing an application but am running into some troubles. I
hope you guys can help me.
What I'd like to do is a webcam game, that's how it should work:
- a master movie is placed on the server
- the first person opening the swf can see the master movie, then he's asked
to reproduce what he saw with his webcam
- the second person comes and sees the last recorded movie and then again has
to reproduce what he saw, when he finishes he will se the master movie, to
compare.
- and so on
now recording and playing all works fine, more or less, but how can I find out
how many movies are there already? I thought about saving an xml with php on a
simple webserver, but there has to be an easier way, a solution I can solve
with FMS to read out the data in the folder.
Thanks in advance.
McKean Guest
-
Using a Webcam
Can somebody please walk me through creating an application to stream from a webcam? Thanks -
Webcam?
How about a photo that uploads every second. Does that depend on the cam? If so, which one should I purchase? Thanks -
btc webcam and what app can be used on rh9
Dear linuxer: I had webcam it print btc on it, i did not know whether it is manufactured by btc.com or btcusa.com. Does anyone know there is... -
webcam
In article <bg8rul$1emh$1@gwdu112.gwdg.de>, Christopher Intemann <inte@goe.net> writes: Sure, write the driver yourself. ... -
webcam!
Hi I have been using windows software i.e coffeecup webcam 3.5 but was after using just PHP... Regards "Seroxat Mad..."... -
JayCharles #2
Re: Webcam Application
Assuming your flv files are being stored in a directory inside your application
directory (i.e the default streams/instance dir), you could use the file class
to read the directory and get the file names.
JayCharles Guest
-
McKean #3
Re: Webcam Application
Thank you for your reply Jay!
how could i read out the files?
with fileObject.list(filter) ?
I will have to place this on the application .asc file?
or can i put this on the client side .fla ?
thanks!
McKean Guest
-
JayCharles #4
Re: Webcam Application
You don't really need to use the filter flag.
Let's assume you're running the default instance of your application, and the
streams are being saved in streams/_definst_. You could do something like this:
fileObject = new File("streams/_definst_");
fileList = fileObject.list();
for (a=0; a<fileObject.length; a++){
trace("File found "+fileList[a].name);
}
}
JayCharles Guest
-
-
McKean #6
Re: Webcam Application
sorry to bother again, I placed the code into my fla:
function doConnect() {
client_nc = new NetConnection();
client_nc.onStatus = function(info) {
trace("Level: "+info.level+newline+"Code: "+info.code);
fileObject = new File("streams/_definst_");
fileList = fileObject.list();
trace(fileList);
for (a=0; a<fileObject.length; a++) {
trace("File found "+fileList[a].name);
}
};
client_nc.connect("rtmp://192.168.1.42/sample_room");
}
I think I'm doing something wrong here...
Where do I have to place this?
Thanks!
McKean Guest
-
fguru #7
Re: Webcam Application
Hi McKean,
Try to save your recording names on Flash Shared Object on FMS. then you don't
need to use any other server or php.
That .fso are really good for storing and sharing data.
Let me know if u need further assistance.
FH
fguru Guest
-
JayCharles #8
Re: Webcam Application
[q]Originally posted by: McKean
sorry to bother again, I placed the code into my fla:
function doConnect() {
client_nc = new NetConnection();
client_nc.onStatus = function(info) {
trace("Level: "+info.level+newline+"Code: "+info.code);
fileObject = new File("streams/_definst_");
fileList = fileObject.list();
trace(fileList);
for (a=0; a<fileObject.length; a++) {
trace("File found "+fileList[a].name);
}
};
client_nc.connect("rtmp://192.168.1.42/sample_room");
}
I think I'm doing something wrong here...
Where do I have to place this?
Thanks![/q]
The code goes in your server side actionscript, not on the client side. So,
you'll need a client function and a server function... something like this:
On ther server side:
Client.prototype.getStreamList = function(){
fileObject = new File("streams/_definst_");
fileList = fileObject.list();
returnArray = new Array();
for (a=0; a<fileObject.length; a++){
returnArray.push(fileList[a].name);
}
}
return ReturnArray;
}
On the client side:
function getStreamList(){
client_nc.call("getStreamList", onGetStreamList);
}
function onGetStreamList(data){
for (a=0; a<data.length; a++){
trace(data[a]);
}
}
So, what's happening here is that the client calls the server function, and
the server returns the results to the client as an array of file names.
As Fguru mentioned, you could use a SharedObject, but then you'd be eating up
extra RAM when you don't need to.
JayCharles Guest
-
McKean #9
Re: Webcam Application
Thanks fguru, since I got it to work without a shared object, I'll keep it in
mind though since performance won't really matter...
Jay, I was playing around with it for a while and I never knew that I had to
restart the application once I changed it (stupid me) and I didn't know that I
can return arrays, so I returned a comma separated string and parsed it on the
client, I also had to get rid of all the subfolders since it gave me the files
like folder/folder/file.flv, and for playback I had to leave away the .flv
dunno why you have to do that...
well, thanks for all the help I really appreciate it, I'm slowly getting to
like fms =)
McKean Guest



Reply With Quote

