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.
5 comments:
Thanks Johanna, very educating posts :-)
That's terrific. I tried it but of course as a novice it wouldnt work. I notice your list of movies are all .mov i thought they needed to be .flv?
also how do you organise 4 videos so that they are in a list at blip.tv?
Thanks for any help or direction.
The client uses QuickTime to play videos - so mostly anything supported by QuickTime should work. From what I've read, it will play standard Flash files, as long as they're non-interactive, but I don't know about Flash video (.flv) files.
Also, you do need to either own the land, or deed it to the group which owns the land (in which case you'll need to script a way for you to trigger llDie() so you can delete the object).
I don't know anything about blip.tv, sorry.
Sorry johanna, now have it linked to mp4 at blip.tv
I forgot.mov was a quicktime viewable format and flv is flash.
I can access as owner. Hopefully it won't clash with the My land, media movie.
key theVideoTexture = "9616db9d-7753-bdbf-0176-a2d37d66a81f";string VideoBaseUrl = "http://blip.tv/file/get/Galah3-video1223.mp4";list RandomVideos = [""];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 )); } }}
How can I make that work just to watch one video. Thanks for any help.
Hi cousin,
nice blog you've got here. I sure hope you will continue to update it.
Success!
White Hyacinth
Post a Comment