Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2002
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    checking if web cam image is finished loading

    Hi,

    I wonder if this is possible. I have a webcam application with a live stream.

    I can't get the front-end applet to work so I am trying to do something with javascript.

    the end user connects directly to the machine with the web cam through a port:

    http://user.ip.here.portno/cam.jpg

    To get the fastest stream possible it is necessary to check if the current frame/jpg has finished loading so the next image can start loading. The problem is that images are not cached.

    Can this still be done and how to set it up?
    raoul

  • #2
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    Image has a boolean property, called "complete", which tells you if the image has finished loading or not.

    however, a better way to do it, would be to use the "onload" event of the image. everytime the image finishes loading, you can refresh the page.

    document.images["picture"].onload= function() {
    window.location.reload();
    }
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #3
    New Coder
    Join Date
    Aug 2002
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks John,

    Actually I was trying all sort of things and what I ended up with is almost similar as your solution.

    Simply:

    <img name="image1" src="image.jpg" onLoad="newImage()">

    works quite well as I use two layers on top of eachother to prevent the image from blinking during loading. When the image is finished loading the layer is made visible and loading of the new image in the other layer is started.


  •  

    Posting Permissions

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