ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Problems with auto-update of mjpegcanvasjs

asked 2013-09-17 22:21:30 -0600

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-10-14 21:43:48 -0600

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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-09-17 22:21:30 -0600

Seen: 125 times

Last updated: Oct 14 '13