Sunday, March 09, 2008

HTML on a PRIM (Sort of)



With the new Second Life Release Client 1.19.1, we get a chance to see a feature that will be implemented soon, HTML Pages displayed thru the media streaming texture.

As its kinda useful to some projects I'm doing , I rattled up some basic code last night to slideshow webpages with clickthru to their URL. Feel free to amend and add functionality if useful.

list URLs = ["http://www.leeds-art.ac.uk","http://www.annamorphic.co.uk","http://bbc.co.uk"]; //List of URLS
list Desc = ["Leeds College Website","Angrybeth's Page","BBC homepage"]; //List of URL descriptions - keep in order of List of URLs...

integer slides;
integer slidecount = 0;
string SETURL;
string URLDESC;
default
{
state_entry()
{
llSetTimerEvent(20.0); //Change this for timing of sequence, obviously....
slides = llGetListLength(URLs);

}
timer()
{
if (slidecount == slides)
{
slidecount = 0;
}

SETURL = llList2String(URLs, slidecount);
URLDESC = llList2String(Desc,slidecount);
llParcelMediaCommandList([
PARCEL_MEDIA_COMMAND_TYPE, "text/html",
PARCEL_MEDIA_COMMAND_URL, SETURL]);
slidecount ++;
}

touch_start(integer touched)
{
key who = llDetectedKey(0);
llLoadURL(who,URLDESC,SETURL);
}
}


Obviously, stick this script inside the prim that is displaying the media texture...

One thing I do like is that llLoadURL - opens the inclient web-browser like the OnRez client. But at the moment it doesn't support Flash


But, when you load a webpage with Quicktime media embedded, it shows up on the Avatars HUD rather than on the webpage.
Joyness!!!

1 comment:

Ethics and Transparency In Politics said...

Nice script, though tempted to try for a version of Tony Hirst's Feedshow - create a webscript to complement this to turn a del.ico.us list of URLs into the slide show

:D