Wednesday, August 15, 2007

More Fun with Media

The release notes for the recent update to the Second Life client said, much to my delight, that streaming video was now available in the Linux client. Well, a number of us have had trouble getting it to work, even though we've got all the dependencies installed.

Someone posted, in one of the video troubleshooting threads, that he thought we were all trying to view videos with too high a bitrate, and suggested we go by his store to try out his TVs. In plugging them, he said that they:

can coexist with land media, this allows private landowners to still use their 'pay per view' media to run in their skyboxes and private theatres, without interferring with all their tennants at ground level having their own TV channels, even in the same parcel.
Well, this sounded interesting, especially given my video vendor project, so I dug into the LSL Wiki and saw an option for llParcelMediaCommandList() which I hadn't noticed before: PARCEL_MEDIA_COMMAND_AGENT.

When you pass this option in, followed by an avatar's UUID, it doesn't change the media settings for the parcel, like it normally would - it changes the settings just for the specified avatar.

So if you wanted someone to see a random video when he or she touches a prim, but not affect anyone else, you might do something like this:

key theVideoTexture = "12345678-9abc-def0-1234-56789abcdef0";
string VideoBaseUrl = "http://www.myserver.com/videos/";
list RandomVideos = [ "video1.mov", "video2.mov",
"video3.mov", "video4.mov" ];

PlayVideo( key theAvatar ) {
integer VideoCount = llGetListLength( RandomVideos );
integer theVideo = (integer) llFrand( VideoCount );
string VideoName = llList2String( RandomVideos, theVideo );  
llParcelMediaCommandList([
PARCEL_MEDIA_COMMAND_AGENT, theAvatar,
PARCEL_MEDIA_COMMAND_TEXTURE, theVideoTexture,
PARCEL_MEDIA_COMMAND_URL, VideoBaseUrl+VideoName,
PARCEL_MEDIA_COMMAND_LOOP
]);
}

default {

touch_start( integer numTouchers ) {
integer i;
for (i = 0; i < numTouchers; ++i) {
PlayVideo( llDetectedKey( i ));
}
}

}

Even though the object is affecting an avatar, and not the parcel, it still follows the parcel media permissions rules. If you don't own the land the object's on, the object must be deeded to the land's group - so it's a good idea to include some way for the object to delete itself when you want it to. The video texture should be the UUID of a texture on the prim that will be replaced by the video.

Yesterday, I wrote a video vendor kiosk, similar in operation to some of the JEVN vendors (a main static display button/pay receiver, four smaller buttons for changing the product on the main button, and Previous/Next buttons), with the addition of a large video screen which will show a movie of whatever product is on the main static display.

Because it uses the PARCEL_MEDIA_COMMAND_AGENT option, it works without affecting video for any other residents in the parcel, so it doesn't require the parcel to be subdivided to the shop or booth the vendor is in. :)

Configuration is via notecard, but with all the functionality I put into it, it quickly runs out of space - with only twelve products in the vendor (including landmark, vendor textures, info notecards, and sometimes multiple items per product), available script memory is down to less than 2K. I guess the next step would be a networked vendor which communicates with a Web server, rather than keeping the lists of product names, prices, descriptions, textures, video URLs, and so forth in the script memory.

Monday, August 13, 2007

Voice on Linux - partway there

Somebody on the Linux Client Users group mentioned a wrapper script to run the Windows voice client in WINE, providing limited functionality of the voice client under Linux. I found the script attached to an issue in JIRA, then downloaded the Windows client, extracted SLVoice.exe and the libraries it depends on, and copied them into my secondlife directory.

It works... kind of. It takes forever to get connected to voice, and it disconnects after a very short time - but I did manage to hear somebody say part of a sentence!

Sunday, August 5, 2007

HUD Fever

A couple of days ago, someone posted a comment on one of my entries, saying that she'd seen the emotion buttons running down the side of some of my screen shots, and asking what HUD lets me do it.

As a matter of fact, it's a HUD I wrote a few months ago (and which, quite coincidentally, I had put up for sale in my store only a couple of hours before she posted her comment). I love HUDs, and if you design them properly, they can actually be really simple. The example HUD I made for LSL205 (a jump assistance HUD, shown at the right, which lets you select from five different jump strengths) consisted of six prims, one texture, a main script of 19 lines (not including comments and blank lines), and a 28-line script that goes into each of the five buttons.

I've made quite a few HUDs, come to think of it. There's the class schedule HUD I blogged about a little while ago (which is actually pretty complex, admittedly); the aforementioned emotion HUD; a HUD I made for landscaping (I loathe the built-in "Edit Land" tool, I always end up making things look worse than when they started); a favorite-places teleporter HUD; a "PowerPoint" controller HUD...

Students seemed to have so much fun with the jump assist HUD that I'm planning to teach a workshop just on designing and making HUDs - the one in LSL205 was really only a demonstration of link messages, and I didn't really get into the planning, texturing or physical construction of the HUD.

Now I just need to decide what the example HUD for the workshop should do. Time to hit the LSL Wiki and look at function names until an idea germinates, I guess.

Saturday, August 4, 2007

Video Vendors

One of the problems I've found with trying to sell jewelry is that, especially for the finely-detailed pieces, a static image on a vendor doesn't really do it justice. You want to give the customer the ability to see it from all angles, and close up. Even worse - if you're selling a scripted object, how do you show it in action?

So today I wrote a simple "video vendor" system for my store - individual vendor boxes which, when touched, communicate with a video screen. The screen sets the parcel's video media URL, resets the texture repeat and offsets on the main face to match the video's dimensions (so that "Auto scale content" doesn't need to be enabled), and starts the video in looped mode.

Maybe one day I'll even get to see it in action. The 1.18.1(2) release of the viewer purportedly added streaming video support for Linux users, but many of us can't get it to work.

(Next, multi-vendors and networked vendors! Muah ha ha ha ha!)