llSetParcelMusicURL(string url)
Sets the streaming
audio URL for the
parcel the
scripted object is on (the object must be owned by the
owner of the parcel, if the parcel is group owned the object must be
owned by that group).
This means, for those who do have a
webserver where they can just upload simple files, but not run streaming servers, you can now have multiple
MP3/
Ogg Vorbis files there and a script in-
world that just switches the URL to point to each file in succession (it'll have to know how long each song is though).
Note: This function
delays the script for 2 seconds.
//This simple script will listen for the owner to say radio: URL
//it will tune to the station specified by the radio: command.
default
{
state_entry()
{
llListen(0,"",llGetOwner(),"");
}
listen(integer channel,string name,key id,string msg)
{
string lmsg=llToLower(msg);
if("radio: "==llGetSubString(lmsg,0,6))
{
llSetParcelMusicURL(llGetSubString(msg,7,-1));
}
}
}
Q: So the sim relays the audio stream to the SL client, right?
A: No, that wouldn't make much sense. Instead, the sim just tells the client the URL of the parcel and then each client connects to the audio streaming server individually.
Q: But doesn't that mean the more people dwell on a parcel, the more bandwith the streaming server needs?
A: Yes, that is correct.
Q: So I can't stream live audio from my DSL connection?
A: Not with more than one or two listeners (depending on bitrate and your upstream bandwidth).
Q: How do I stream live audio to many listeners then?
A: You'd need a server that has reasonable upstream bandwith and is running an audio streaming service such as Icecast. Then you just use a plugin (like Oddcast) for your audio player to send your audio stream (once) to the server, which relays it to all the listeners.
A: Shoutcast is also possible, and has its own plugin. -
Ice
Q: Wow, so I actually have to know how to set up all that stuff?
A: No, not necessarily, there are also commercial hosts that do this for you (for a fee). Note that any that require the listener to log in (such as Live365) will not work with SL.
A: I've seen these work, but you have to get the URL from an external MP3 player, and I'd recomend not logging in for this (unless you have a specific account allowing multiple logins). Also I do recomend getting the URL from within the player's playlist anyway as the SL client does not understand .pls (playlist) files to my knowledge. -
Ice
Q: Which ones do work then?
A: Live365 premium has multiple account logins (shhh) because you pay the fees, additionally any other stream will have general music, if you like a stream, check the properties
- Note that there is currently no way to get the current music URL with a script (
llParcelMediaQuery can only be used to return the URL of a
video stream).
- To get the stream name or current song information, you could probably do something with
llHTTPRequest,
XML-RPC, or
e-mail events.
- If you want to play
video, use
llParcelMediaCommandList.
- If you want to play MP3 files and they don't work, make sure that the ID3 tags do not have embedded images.
Functions |
Sound |
Land