Difference between revisions of "LlSetPrimMediaParams"

From Second Life Wiki
Jump to navigation Jump to search
m
m (Replaced <source> with <syntaxhighlight>; added Haiku written by ChatGPT)
 
(One intermediate revision by one other user not shown)
Line 16: Line 16:
|constants={{LSL Constants/ReturnStatus|table=*|sortable=*}}{{LSL Constants/PrimMedia|set}}
|constants={{LSL Constants/ReturnStatus|table=*|sortable=*}}{{LSL Constants/PrimMedia|set}}
|examples
|examples
|helpers=<source lang="lsl2">//-- expand media textures greater than 1024 pixel in a direction to fit the media face
|helpers=<syntaxhighlight lang="lsl2">//-- expand media textures greater than 1024 pixel in a direction to fit the media face
//-- does exactly what the "align" button does in the edit window (width/height are in pixels)
//-- does exactly what the "align" button does in the edit window (width/height are in pixels)
//-- original by Edelman Linden (or Kate Linden), tweaked by Void Singer
//-- original by Edelman Linden (or Kate Linden), tweaked by Void Singer
Line 33: Line 33:
                                             1,
                                             1,
                                             2 ) );
                                             2 ) );
}</source>
}</syntaxhighlight>
ref: [[How_to_Align_a_Shared_Media_Texture_from_Linden_Script|original source]]
ref: [[How_to_Align_a_Shared_Media_Texture_from_Linden_Script|original source]]
|also_functions=
|also_functions=
Line 39: Line 39:
{{LSL DefineRow||[[llGetPrimMediaParams]]}}
{{LSL DefineRow||[[llGetPrimMediaParams]]}}
{{LSL DefineRow||[[llClearPrimMedia]]}}
{{LSL DefineRow||[[llClearPrimMedia]]}}
|also_tests=
|also_tests
{{LSL DefineRow||[[/Tricks]]}}
|also_events=
|also_events=
|also_articles=
|also_articles=
{{LSL DefineRow||[[/Tricks]]}}
|notes
|notes
|deepnotes
|deepnotes
Line 49: Line 49:
*{{JIRA|SVC-4939}}
*{{JIRA|SVC-4939}}
* Functionality available in Client 2.0
* Functionality available in Client 2.0
|haiku={{Haiku|Media in dance,|Parameters find their place,|Object's form embrace.}}
|cat1=Prim Media
|cat1=Prim Media
|cat2=Media
|cat2=Media

Latest revision as of 15:42, 6 March 2024

Summary

Function: integer llSetPrimMediaParams( integer face, list params );
1.0 Forced Delay
10.0 Energy

Set the media params for a particular face.
Returns a status (an integer) that is a STATUS_* flag which details the success/failure of the operation(s).

• integer face face number
• list params a set of name/value pairs (in no particular order)

Success/Failure Flags Description
STATUS_OK 0 Result of function call was success
STATUS_MALFORMED_PARAMS 1000 Function was called with malformed parameters
STATUS_TYPE_MISMATCH 1001 Argument(s) passed to function had a type mismatch
STATUS_BOUNDS_ERROR 1002 Argument(s) passed to function had a bounds error
STATUS_NOT_FOUND 1003 Object or other item was not found
STATUS_NOT_SUPPORTED 1004 Feature not supported
STATUS_INTERNAL_ERROR 1999 An internal error occurred
STATUS_WHITELIST_FAILED 2001 Whitelist Failed
Parameter Additional Parameters Description
PRIM_MEDIA_ALT_IMAGE_ENABLE ] 0 [ integer boolean ] Sets the default image state (the image that the user sees before a piece of media is active) for the chosen face. The default image is specified by Second Life's server for that media type.

Note: This flag is not currently implemented.

PRIM_MEDIA_CONTROLS ] 1 [ integer control ] Sets the style of controls. Can be either PRIM_MEDIA_CONTROLS_STANDARD or PRIM_MEDIA_CONTROLS_MINI.
controls Flags Description
PRIM_MEDIA_CONTROLS_STANDARD 0 Standard web navigation controls.
PRIM_MEDIA_CONTROLS_MINI 1 Mini web navigation controls; does not include an address bar.
PRIM_MEDIA_CURRENT_URL ] 2 [ string current_url ] Sets the current url displayed on the chosen face. Changing this URL causes navigation. 1024 characters Max
PRIM_MEDIA_HOME_URL ] 3 [ string home_url ] Sets the home url for the chosen face. 1024 characters max
PRIM_MEDIA_AUTO_LOOP ] 4 [ integer boolean ] Sets whether auto-looping is enabled.
PRIM_MEDIA_AUTO_PLAY ] 5 [ integer boolean ] Sets whether the media auto-plays when a Resident can view it.
PRIM_MEDIA_AUTO_SCALE ] 6 [ integer boolean ] Sets whether auto-scaling is enabled. Auto-scaling forces the media to the full size of the texture.
PRIM_MEDIA_AUTO_ZOOM ] 7 [ integer boolean ] Sets whether clicking the media triggers auto-zoom and auto-focus on the media.
PRIM_MEDIA_FIRST_CLICK_INTERACT ] 8 [ integer boolean ] Sets whether the first click interaction is enabled.

Note: This flag appears not to work.

PRIM_MEDIA_WIDTH_PIXELS ] 9 [ integer width ] Sets the width of the media in pixels.
PRIM_MEDIA_HEIGHT_PIXELS ] 10 [ integer height ] Sets the height of the media in pixels.
PRIM_MEDIA_WHITELIST_ENABLE ] 11 [ integer boolean ] Sets whether navigation is restricted to URLs in PRIM_MEDIA_WHITELIST.
PRIM_MEDIA_WHITELIST ] 12 [ string CSV ] Sets the whitelist as a string of escaped, comma-separated URLs. This string can hold up to 64 URLs or 1024 characters, whichever comes first.
PRIM_MEDIA_PERMS_INTERACT ] 13 [ integer perms ] Sets the permissions mask that control who can interact with the object:
PRIM_MEDIA_PERMS_CONTROL ] 14 [ integer perms ] Sets the permissions mask that control who can see the media control bar above the object:

Caveats

  • This function causes the script to sleep for 1.0 seconds.
  • The function silently fails if its face value indicates a face that does not exist.
  • If prim-media is not already on this object, add it.
  • Params not specified are unchanged, or if new media is added set to the default specified.
  • Both width and height must be specified together to work, and they narrow the texture space while inversely widening the aperture.
    • width and height scaled larger than 1024pixels will require the texture backdrop to be resized to fit(see Useful Snippets)
      • if resized to fit, the resulting view will cut off scrolled content outside the bounds making it impossible to be viewed

Examples

Useful Snippets

//-- expand media textures greater than 1024 pixel in a direction to fit the media face
//-- does exactly what the "align" button does in the edit window (width/height are in pixels)
//-- original by Edelman Linden (or Kate Linden), tweaked by Void Singer
uExpandMediaTexture( integer vIntWidth, integer vIntHeight, integer vIntFace ){
    integer vIntTemp;
    vector  vSizScale;
    
    while (vIntWidth >> ++vIntTemp);
    vSizScale.x = vIntWidth / (float)(1 << vIntTemp);
    vIntTemp = 0;
    while (vIntHeight >> ++vIntTemp);
    vSizScale.y = vIntHeight / (float)(1 << vIntTemp);
    llSetPrimitiveParams( [PRIM_TEXTURE, vIntFace] +
                          llListReplaceList( llGetPrimitiveParams( [PRIM_TEXTURE, vIntFace] ),
                                             [vSizScale, ((vSizScale - <1.0, 1.0, 0.0>) / 2.0)],
                                             1,
                                             2 ) );
}

ref: original source

See Also

Functions

•  llSetLinkMedia
•  llGetPrimMediaParams
•  llClearPrimMedia

Articles

•  /Tricks

Deep Notes

History

Signature

function integer llSetPrimMediaParams( integer face, list params );
integer PRIM_MEDIA_ALT_IMAGE_ENABLE = 0;
integer PRIM_MEDIA_CONTROLS = 1;
integer PRIM_MEDIA_CURRENT_URL = 2;
integer PRIM_MEDIA_HOME_URL = 3;
integer PRIM_MEDIA_AUTO_LOOP = 4;
integer PRIM_MEDIA_AUTO_PLAY = 5;
integer PRIM_MEDIA_AUTO_SCALE = 6;
integer PRIM_MEDIA_AUTO_ZOOM = 7;
integer PRIM_MEDIA_FIRST_CLICK_INTERACT = 8;
integer PRIM_MEDIA_WIDTH_PIXELS = 9;
integer PRIM_MEDIA_HEIGHT_PIXELS = 10;
integer PRIM_MEDIA_WHITELIST_ENABLE = 11;
integer PRIM_MEDIA_WHITELIST = 12;
integer PRIM_MEDIA_PERMS_INTERACT = 13;
integer PRIM_MEDIA_PERM_OWNER;
integer PRIM_MEDIA_PERM_GROUP;
integer PRIM_MEDIA_PERM_ANYONE;
integer PRIM_MEDIA_PERMS_CONTROL = 14;

integer PRIM_MEDIA_CONTROLS_STANDARD = 0;//Standard web navigation controls.
integer PRIM_MEDIA_CONTROLS_MINI = 1;//Mini web navigation controls; does not include an address bar.

Haiku

Media in dance,
Parameters find their place,
Object's form embrace.