Sunday, October 28, 2007

How to play your own media in Second Life


My friend WeiXaio figured this out based on the antenna code. Here is how to play local media files to your computer, including mp3s and .movs.

First create an antenna. Create an object, drop the antenna script in it. If the land is group owned make sure the permissions are set to all and shared with group, and then deed it to the group that owns the land.

Then download ans install the open source, free, Darwin streaming server. You will need to create a free apple ID to do this.

Install, and configure through the web forms based administration. Set number of connections to 5, since each application counts as a connection. Set the directory to where you want your media files to be. This is cAsE sEnSiTiVe on my mac and I imagine on Linux too. Don't ask me about windows.

Start the server. Don't broadcast over the internet, since all it will be doing is buffering local files. Set the bandwidth to g3, since it is local.

Open the quicktime player, type in

rtsp://localhost:/<name of a media file>

If this does not work, you've done something wrong in the configuration, go back and check to make sure the server is running, that it isn't on port 80 which interferes with other webservers on your machine, that the directory is correct, that the file is not corrupt. This will not play purchased iTunes content (of course) but only open file formats.

Now go in world, get in chat range of the antenna. Make sure video streaming is on. Chat on the antenna's channel, I used 55 as the default in the one I wrote:

/55 rtsp://localhost:/<name of a media file>

Hit play on the play tab below in the client.



It works. And it allows anyone within range of the antenna to set their stream, and it stays as long as the person is in that sim. It could be possible to start an open media movement in sl, with people putting out antennas. It could even be possible to set up a directory fo sims, with the id of the antenna in the sim. A person with the right gadget could

1. Look up sim's antenna
2. send IM by gadget to antenna
3. Antenna takes IM and does the antenna thing for htem.





integer chan=55;

default
{
state_entry()
{
integer new_chan;
new_chan = (integer) llGetObjectDesc();
if(new_chan> 0) chan = new_chan;
llSetText("chat on channel /"+(string)chan+" to watch any media stream,",<1,1,1>,1);
llListen(chan,"",NULL_KEY,"");

}

listen(integer channel,string name,key id,string m)
{

if ( llParcelMediaQuery([PARCEL_MEDIA_COMMAND_TEXTURE]) == [] ){
llInstantMessage(id, "Lacking permission to set/query parcel media. This object has to be owned by/deeded to the land owner.");
return;
}
llParcelMediaCommandList( [
PARCEL_MEDIA_COMMAND_URL, m,
PARCEL_MEDIA_COMMAND_AGENT, id,
PARCEL_MEDIA_COMMAND_PLAY ] );
return;

}
}

No comments:

Post a Comment