Link to home
Start Free TrialLog in
Avatar of Nathan_London
Nathan_London

asked on

Flash 2 frame second webcam viewer - URGENT

I have asked this question of the JAVA people.

I have a cam FTP uploading a file called cam0.jpeg  a couple of times a second to a web server.
This is something you see all over the web. Like http://www.earthcam.com/usa/newyork/timessquare/

Usually then flash or a Java applet refreshes the image.

My problem is the image is always broken because the file is being constantly uploaded.

Can Flash be made to view just one file constantly changing at 1-2 frames a second without viewing the half loaded images?

I still haven’t really got a definitive yes or no.





Avatar of OBCT
OBCT

Yes.
Just preload the images.
Is this what you want?

http://www.sunsetbeachbar.com/livecam

Let me know. If this is what you need, I'll post the code here.
Just for background:

The constantly updating image that mimics motion, viewed through a java applet of activex control is NOT one that's uploaded through FTP.

Rather, it uses (HTTP server push) nph-cgi (non-parsed-headers) to continuously upload one single file (usually a MJpeg). The java applet reads the file as it comes in; whenever it encounters a Content-Type and Content-Length header, it displays that part of the file as a single jpeg image.

Since you're talking about several frames a second, I doubt that FTP will work for you at all (either with or without Flash). You would have to create a buffer of images on the server and tell Flash to grab the newest complete image. This way, users with varying connection speeds will still be able to upload a complete image (i.e. it won't get destroyed by a newer one).

Probably a better option would be to rebroadcast the stream from your local machine with CURL or some such. Get ready for a lot of tinkering...

HTH
Avatar of Nathan_London

ASKER

Im not sure what you mean when you say its not uploaded via FTP. The source of the video is a server in location A. The images are FTPed to a server at location B. The upload of the files with the bandwidth is fine for the frame rate as its currently doing it fine.

Not taking about FTPing to the client.

The client is uploading from their browser via normal http. Client pull.



Two comments:

1. I was referring to what you said here:

  > Usually then flash or a Java applet refreshes the image.
  > My problem is the image is always broken because the file is being constantly uploaded.

Cam --- Server --- Clients           |   This won't work for streaming cameras.  
      FTP        HTTP                     | (i.e. the situation where a Java applet is normally used)

2. If you want to avoid broken images, you can
    a) let your camera upload a temporary image and then rename it.
    b) upload several uniquely named (timestamped) images to act as a buffer.

To check whether an image has completed loading, Flash has methods such as:
   myImage.getBytesLoaded()
   myImage.getBytesTotal()







ok excellent that answer the question. So if uploading a single file broken files will always appear.. That’s what i expected.

The timestamp or sequential named files is what i have assumed would be the solution. This I can set up and the source.

ok, where can i get a buy/download/Flash program I can configure to do this for me?

N
Since soliciting business on EE is a no-no, I think you'll have to look at a qualified developer in your area if you require a custom application.

However, I notice you didn't comment on the Sunset Beach Bar LiveCam, see link above.

I believe that application could be modified to suit your needs. Right now, the camera uses FTP to send a new image to the server every 20 seconds. The Flash app checks with the server every 7 seconds for an updated image by checking for the size of the file.  Whenever a new file is available, Flash downloads the image in the background and swaps it with the previous image when done.  

My approach would be to let camera upload a continuously rotating series of 10-20 images. Let the Flash client download the newest complete image, and when done check for what is at that point the newest image (so you don't run into problems with users that have slower connections). And so on...


I didnt know you are not allowed to Solicit business!
Yes the Sunset Beach Bar LiveCam is fine yes. Just needs to be quicker. What you suggest is what im after.

So where can i go to solicit business? Just need someone to do it then!

ASKER CERTIFIED SOLUTION
Avatar of infoCatch
infoCatch

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'll check this out.
thanks for the help but didnt really help me. I have got someone working on code to sort my problem.
Yes I agree. But the answers didnt solve the problem. Thats why i gave a C. Change it to whatever you like its cool.
 
infoCatch,

Your response was right in line with what I am looking for... do you have an updated link to the livecam.zip?  I would like to refresh the newest 'complete' image from a set of sequential images from my webcam.

Is there a way to have Flash/Actionscript delete, say all but the 100 newest images, so the dir does not fill?

Thanks again for explaining what you have!
Regards,
Michael