0
$\begingroup$

Rosanswers logo

Hi community,

I tried to connect the camera of my self-built robot with mjpegcanvasjs to my Firefox webbrowser as described in the tutorial (unfortunately I am not allowed to post the link because of my bad karma).

Loading the initial picture works quite well. In the debugging web console I checked the javascript, and draw is also called repeatedly. Unfortunately the picture does not update.

My guess is that the browser is always redelivering the cached version of the image, instead of re-requesting an updated version. When I access the link to the image-source directly (by entering h__p://my.robot:8080/stream?topic=/usb_cam/image_raw into the address line) the image reloads automatically.

I tried a "cache-breaking" method by appending "#some_random_value" to the request in the JS. This method seems to work in the address line(everything after # is just stripped as it was explained in the cache breaking tutorial I read), but in the JS it just does not load, when adding the # value.

Anybody got experience with this and has some hints for me, how to resolve it?

Regards Christoph


Originally posted by Christoph on ROS Answers with karma: 96 on 2013-09-17

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I finally looked a bit more closely at the mjpegcanvasjs code. The reload issue could be resolved for me by adding a image.src = image.src line. This raised another issue, because the animation routine was not working as expected. For my patch I now solely rely on the setInterval() mechanism, skipping the browser specific calls.

I am not sure, if this "hack" will make it into main branch, but I uploaded it to github. So if you experience a similar issue, feel free to have a look ;-)

Regards Christoph


Originally posted by Christoph with karma: 96 on 2013-10-14

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.