Re:HTML Live Video Streaming Via WebSockets
by ch4ch4 on Wednesday September 11, 2013 @07:24PM
(#6370884)
$("#mischacam").attr("src", camURL + "/snapshot.cgi?_=" + Math.random());
Out of curiosity, why do you append a random number between 0 and 1 to the URL?
Re:HTML Live Video Streaming Via WebSockets
by DougWebb on Wednesday September 11, 2013 @10:26PM
(#6371679)
mannix is right; to get the browser to reload the image I have to change the url every time. You'd think in a well-designed webcam API the image would come back with appropriate headers to prevent caching, but I didn't even bother to check. The webcam software is not well-designed.
This uses requestAnimationFrame, and lets me set the max framerate I want. Since I'm just watching my dog Mischa and she sleeps most of the time, I set it to 0.5fps which keeps my cpu usage around 1%.