read jpeg

G

Guest

Hello,
I am making a web page where I need to show somewhere in the page a webcam
without component like activex.
In my webcam I can read the last picture with the following command:
http://192.168.1.34/jpg/image.jpg
I have a img tag in my web page where I show the last picture. But I don't
want to refresh the web page all the time to show my webcam and for that I
made a javascript that read the picture:
function mycamera() {
document.getElementById('camera').src = 'http://192.168.1.34/jpg/image.jpg';
timerID = setTimeout("camera",1000);
}
But the behavior is not the same than when I refresh the page, because it
show me always the same picture, but if in another web page I read the webcam
picture (with a refresh of the page) in the first web page I have the new
picture.
I think the webcam generate a new picture with a http request, and I try to
do a function in the web server wich read cyclic the picture:
public void RefreshCamera(Object source, System.Timers.ElapsedEventArgs e)
{
WebClient Client = new WebClient();
byte[] image =
Client.DownloadData("http://192.168.1.34/jpg/image.jpg");
aTimer.Start();
}
but the webcam do not generate a new picture.

Thanks for your help.
 
G

Guest

Thank, your solution work properly.
But there is alway the message "Downloading picture http://...... and the
mouse with the sand glass, is there a method to hide this message.

Bruce Barker said:
the browser caches images. just decorate url with client: script:

var jid=0;
function mycamera() {
document.getElementById('camera').src =
'http://192.168.1.34/jpg/image.jpg?jid=' + (jid++);
timerID = setTimeout("camera",1000);
}

-- bruce (sqlwork.com)


Alan said:
Hello,
I am making a web page where I need to show somewhere in the page a webcam
without component like activex.
In my webcam I can read the last picture with the following command:
http://192.168.1.34/jpg/image.jpg
I have a img tag in my web page where I show the last picture. But I don't
want to refresh the web page all the time to show my webcam and for that I
made a javascript that read the picture:
function mycamera() {
document.getElementById('camera').src =
'http://192.168.1.34/jpg/image.jpg';
timerID = setTimeout("camera",1000);
}
But the behavior is not the same than when I refresh the page, because it
show me always the same picture, but if in another web page I read the
webcam
picture (with a refresh of the page) in the first web page I have the new
picture.
I think the webcam generate a new picture with a http request, and I try
to
do a function in the web server wich read cyclic the picture:
public void RefreshCamera(Object source, System.Timers.ElapsedEventArgs
e)
{
WebClient Client = new WebClient();
byte[] image =
Client.DownloadData("http://192.168.1.34/jpg/image.jpg");
aTimer.Start();
}
but the webcam do not generate a new picture.

Thanks for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

retrieving a file from a password protected site 6
Interesting Project 3
asp.net app 1
Image capture 1
webcam 1
Moving Files 4
Refresh Trigger 4
Import Picture from camera 2

Top