Ask a Question related to Macromedia Flash Flashcom, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. Using a Webcam
      Can somebody please walk me through creating an application to stream from a webcam? Thanks
    2. Webcam?
      How about a photo that uploads every second. Does that depend on the cam? If so, which one should I purchase? Thanks
    3. 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...
    4. webcam
      In article <bg8rul$1emh$1@gwdu112.gwdg.de>, Christopher Intemann <inte@goe.net> writes: Sure, write the driver yourself. ...
    5. webcam!
      Hi I have been using windows software i.e coffeecup webcam 3.5 but was after using just PHP... Regards "Seroxat Mad..."...
  3. #2

    Default 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

  4. #3

    Default 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

  5. #4

    Default 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

  6. #5

    Default Re: Webcam Application

    Thanks a lot mate!
    I'll give it a try.
    McKean Guest

  7. #6

    Default 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

  8. #7

    Default 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

  9. #8

    Default 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

  10. #9

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139