04-13-2005 20:59
I'm streaming mpeg-4 videos over RTSP, without real-time support, using LSL to keep a timer running that fast-forwards viewers to the current point in the movie by referencing the timer and changing the start position. While it works, it's far from stable. Crashes abound. I would greatly appreciate any input on anything I can do to make the following script (or one from scratch) more stable.

CODE

float sectime = 0;

default
{
state_entry()
{
llSetText("Almighty Cube of Synchronization \n (touch to sync video)",<1,1,1>,1);
llSetTimerEvent(5.0);
}


timer()
{
float sectime2 = sectime+5;
sectime = sectime2;
if(sectime2 <= 3687)
{
integer temptime2 = llRound((sectime2 / 3687) * 100);
integer temptime3 = llRound((3687 - sectime2)/ 60);
llSetText("Almighty Cube of Synchronization \n (touch to sync video) \n " + (string)temptime2 + "% into the film, " + (string)temptime3 + " minutes until end of film/restart",<1,1,1>,1);
llParcelMediaCommandList([PARCEL_MEDIA_COMMAND_TIME,sectime2]);
}
else
{
sectime2 = 0;
sectime = sectime2;
llParcelMediaCommandList([PARCEL_MEDIA_COMMAND_TIME,sectime2]);
}
}

touch_start(integer num_detected)
{
llParcelMediaCommandList( [
PARCEL_MEDIA_COMMAND_URL, "rtsp://streaming.url.here.com/file.mp4",
PARCEL_MEDIA_COMMAND_TEXTURE, (key) llGetTexture(0), PARCEL_MEDIA_COMMAND_TIME,sectime, PARCEL_MEDIA_COMMAND_PLAY]);
llSay(0,"Synchronizing Video");
llSay(0,"You may have to press PAUSE then PLAY in your Media control panel if the video is playing choppy or you lose audio.");
}
}