WPI-RAIL/mjpegcanvasjs — pull request #23 by wintermuteger (2013-09-25 20:31:28+00:00)
Title: Update Viewer.js

The original version did call draw() on a regular basis, but drawImage() always gave out the same image of the stream, that was cached, when page has been loaded. (Browser: Firefox 23.0.1)

I therefore added that.image.src = that.image.src; to force a reload of the image from the stream-URL. Unfortunately that lead to a situation where drawImage() was called before loading has been finished. To make it work for me I needed to wait some time between resetting src and calling drawImage(). I choose half the interval time (I increased to 200), to give the browser maximum margin in both directions.
If someone has a cleaner solution, like automated wait for the image to load, I would be grateful for any hint!