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.