Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

streaming video problem

Erik Hugo
Registered User
Join date: 26 Feb 2007
Posts: 30
05-07-2007 06:46
I want to make a screen, and when the user clicks on it, a video should start.

I've created a simple screen with a unique texture on it.

When I enter the texture and media link under the 'media'-tab in About Land I can play the movie using the little player buttons on the bottom of the screen. This works, I get image and sound.

When I however want to activate the movie through a simple script, nothing happens... The texture which needs to be replaced stays in place... no image nor sound will play...

I'm no script guru... so maybe something is wrong here
the script used:

-----------------------------------------------------------------------------------
string Texture = "playscreen";
string Url = "http://www.merge.nl/huijs/Sample.mov";

default
{
state_entry()
{
llParcelMediaCommandList( [PARCEL_MEDIA_COMMAND_STOP] );
llSleep(1);
llSay(0, "stopped";);
llParcelMediaCommandList( [PARCEL_MEDIA_COMMAND_UNLOAD] );
llSleep(1);
llSay(0, "unloaded";);
llParcelMediaCommandList( [PARCEL_MEDIA_COMMAND_TEXTURE,Texture] );
llSleep(1);
llSay(0, "loaded" + Texture);
llParcelMediaCommandList( [PARCEL_MEDIA_COMMAND_URL,Url] );
llSay(0, "loaded" + Url);
}

touch_start(integer total_number)
{
llParcelMediaCommandList( [PARCEL_MEDIA_COMMAND_PLAY] );
llSay(0, "Sarted playing";);
}
}
--------------------------------------------------------------------------------------------
Sys Slade
Registered User
Join date: 15 Feb 2007
Posts: 626
05-07-2007 06:54
CODE
key Texture;
string Url = "http://www.merge.nl/huijs/Sample.mov";

default{
state_entry(){
Texture = llGetInventoryKey("playscreen");
llParcelMediaCommandList(
[PARCEL_MEDIA_COMMAND_STOP,
PARCEL_MEDIA_COMMAND_UNLOAD,
PARCEL_MEDIA_COMMAND_TEXTURE,Texture,
PARCEL_MEDIA_COMMAND_URL,Url]
);
}

touch_start(integer total_number){
llParcelMediaCommandList( [PARCEL_MEDIA_COMMAND_PLAY] );
llSay(0, "Sarted playing");
}
}

Should do the trick.
The texture should be a key and not a name.
Also, wrapping as many commands into the media command list cuts down execution time, because each call delays the script for 2 seconds.

You will need mod/copy/trans rights on the texture for this to work. llGetInventoryKey will fail if you do not have full perms.

Edit: corrected Texture assignment outside of state.
Erik Hugo
Registered User
Join date: 26 Feb 2007
Posts: 30
05-07-2007 07:23
thank you! A lot of helpfull tips :)

one thing...

I placed the script and checked the texture for the mod/copy/trans rights, they are all checked. I placed the texture in the prim's contents, but the line:

key Texture = llGetInventoryKey("playscreen";);

Produces a syntax error...
Sys Slade
Registered User
Join date: 15 Feb 2007
Posts: 626
05-07-2007 10:38
Sorry, was doing it on the fly without being in world to check.
The problem is assigning the key outside of a state, only simple values can be assigned there.

Try this one:
CODE
 key Texture;
string Url = "http://www.merge.nl/huijs/Sample.mov";

default{
state_entry(){
Texture=llGetInventoryKey("playscreen");
llParcelMediaCommandList(
[PARCEL_MEDIA_COMMAND_STOP,
PARCEL_MEDIA_COMMAND_UNLOAD,
PARCEL_MEDIA_COMMAND_TEXTURE,Texture,
PARCEL_MEDIA_COMMAND_URL,Url]
);
}

touch_start(integer total_number){
llParcelMediaCommandList( [PARCEL_MEDIA_COMMAND_PLAY] );
llSay(0, "Sarted playing");
}
}
Erik Hugo
Registered User
Join date: 26 Feb 2007
Posts: 30
05-09-2007 07:26
thanks sys!