.comment-link {margin-left:.6em;}
Moriash Moreau: My Second Life
Wednesday, August 01, 2007
Whilst attempting to hook up my walk webcam as a media stream, I ran into some frustrations. Evidently, images loaded as media streams (whether loaded directly, or via SMIL) are cached by the SL client. So, if you load a stream like http://www.domain.com/image.jpg, and later change image.jpg, the original image will continue to be loaded from the cache. Very annoying, especially when you're setting up something like a webcam that loads a new version of an image file every XX seconds.

Finally, after much beating-of-the-head-against-the-wall and aimless googling, I ran across nand Nerd's Sculpty Previewer. Evidently, he was having similar problems using media streams to preview sculpt textures without having to upload them. But, nand found a workaround: fool the SL client into thinking the media stream is a brand new URL each time, by giving it some garbage parameters that will be ignored when the stream is reloaded. In this case, dropping in a random integer as an HTTP GET, which will be ignored by the client.

The trick is that the cached image is indexed on the overall URL. Each time the stream is reloaded, it is cached anew, even if the actual object (picture, SMIL file, whatever) has the same filename. nand's solution is one of those forehead-slappingly obvious hacks that, nonetheless, require a deep and thorough understanding of the underpinnings of both the web and the SL client to conceive. Most good hacks are like that. Pure genius!

In any case, here is a heavily commented version of the script I used to display my webcam pictures during the SL Relay for Life, should anyone else run into similar problems. Be sure and read the comments before using.The concept is worth putting in the back of your metaphorical toolbox, in any case. Could come in handy someday!
Glad the post on land media helped, these little tricks always seem elude us when we need them most.
Post a Comment

Links to this post:

Create a Link

Return to Main Page