Skip to content
lsl.devlsl.devLSL Dev

LlGetLinkMedia

Looking for the current API? Open the llGetLinkMedia reference →

Wiki description

Get the media params for a particular face on a linked prim, given the desired list of named params.

Function notes

Returns an empty list if no media exists on the face(s).

Return value notes

Returns a list of values in the order requested.

Specification

PRIM_MEDIA_ALT_IMAGE_ENABLE integer 0 b=[  e= ] s=rowspan="1" s1=id="PRIM_MEDIA_ALT_IMAGE_ENABLE"
PRIM_MEDIA_CONTROLS integer 1 b=[  e= ] s=rowspan="4" s1=id="PRIM_MEDIA_CONTROLS"
PRIM_MEDIA_CONTROLS_STANDARD integer 0 m=3 s3=colspan="6" s1=id="PRIM_MEDIA_CONTROLS_STANDARD" c=Standard web navigation controls.
PRIM_MEDIA_CONTROLS_MINI integer 1 m=3 s3=colspan="6" s1=id="PRIM_MEDIA_CONTROLS_MINI" c=Mini web navigation controls; does not include an address bar.
PRIM_MEDIA_CURRENT_URL integer 2 b=[  e= ] s=rowspan="1" s1=id="PRIM_MEDIA_CURRENT_URL"
PRIM_MEDIA_HOME_URL integer 3 b=[  e= ] s=rowspan="1" s1=id="PRIM_MEDIA_HOME_URL"
PRIM_MEDIA_AUTO_LOOP integer 4 b=[  e= ] s=rowspan="1" s1=id="PRIM_MEDIA_AUTO_LOOP"
PRIM_MEDIA_AUTO_PLAY integer 5 b=[  e= ] s=rowspan="1" s1=id="PRIM_MEDIA_AUTO_PLAY"
PRIM_MEDIA_AUTO_SCALE integer 6 b=[  e= ] s=rowspan="1" s1=id="PRIM_MEDIA_AUTO_SCALE"
PRIM_MEDIA_AUTO_ZOOM integer 7 b=[  e= ] s=rowspan="1" s1=id="PRIM_MEDIA_AUTO_ZOOM"
PRIM_MEDIA_FIRST_CLICK_INTERACT integer 8 b=[  e= ] s=rowspan="1" s1=id="PRIM_MEDIA_FIRST_CLICK_INTERACT"
PRIM_MEDIA_WIDTH_PIXELS integer 9 b=[  e= ] s=rowspan="1" s1=id="PRIM_MEDIA_WIDTH_PIXELS"
PRIM_MEDIA_HEIGHT_PIXELS integer 10 b=[  e= ] s=rowspan="1" s1=id="PRIM_MEDIA_HEIGHT_PIXELS"
PRIM_MEDIA_WHITELIST_ENABLE integer 11 b=[  e= ] s=rowspan="1" s1=id="PRIM_MEDIA_WHITELIST_ENABLE"
PRIM_MEDIA_WHITELIST integer 12 b=[  e= ] s=rowspan="1" s1=id="PRIM_MEDIA_WHITELIST"
PRIM_MEDIA_PERMS_INTERACT integer 13 b=[  e= ] s=rowspan="1" s1=id="PRIM_MEDIA_PERMS_INTERACT"
PRIM_MEDIA_PERMS_CONTROL integer 14 b=[  e= ] s=rowspan="1" s1=id="PRIM_MEDIA_PERMS_INTERACT"
Parameter Return Values Description
[ integer boolean ] Gets 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.
[ integer control ] Gets the style of controls. Can be either PRIM_MEDIA_CONTROLS_STANDARD or PRIM_MEDIA_CONTROLS_MINI.
controls Flags Description
[ string current_url ] Gets the current url displayed on the chosen face. Changing this URL causes navigation. 1024 characters Max
[ string home_url ] Gets the home url for the chosen face. 1024 characters max
[ integer boolean ] Gets whether auto-looping is enabled.
[ integer boolean ] Gets whether the media auto-plays when a Resident can view it.
[ integer boolean ] Gets whether auto-scaling is enabled. Auto-scaling forces the media to the full size of the texture.
[ integer boolean ] Gets whether clicking the media triggers auto-zoom and auto-focus on the media.
[ integer boolean ] Gets what happens when someone click on a playing, but unfocused media face:
  • TRUE: Does the same thing a focused media face does, and forwards the click to the web browser.
  • FALSE: Focuses the media prim so that future clicks are forwarded to the web browser.
Note: Viewer settings affect this flag. It works by default on most prims.
[ integer width ] Gets the width of the media in pixels.
[ integer height ] Gets the height of the media in pixels.
[ integer boolean ] Gets whether navigation is restricted to URLs in PRIM_MEDIA_WHITELIST.
[ string CSV ] Gets the whitelist as a string of escaped, comma-separated URLs. This string can hold up to 64 URLs or 1024 characters, whichever comes first.
[ integer perms ] Gets the permissions mask that control who can interact with the object:
[ integer perms ] Gets the permissions mask that control who can see the media control bar above the object:

Helper functions

list GetLinkMedia(integer link, integer face, list input)
{//Returns a list that can be fed to llSetLinkMedia or llSetPrimMediaParams
    list output;
    integer c = ~llGetListLength(input);
    while((c = - ~c))
    {
        list flag = llList2List(input, c, c);
        output += flag + llGetLinkMedia(link, face, flag);
    }
    if(output == input)
        return [];
    return output;
}

See also: functions

History

Date of Release 10/08/2011

Shared wiki helpers

The original page also injects shared parameter notes, caveats or issue information through these helpers. Their conditional MediaWiki logic is not reproduced here; inspect the preserved helper source for additional material.

Template:LSL Function/face

Original shared helper source (conditional wiki logic is not evaluated)
{{LSL Injection Test}}{{#if:

{{#vardefine:header|{{#var:header}}{{#if:{{{nc|}}}{{#pos:{{#var:moded}}|r}}||{{#switch:{{NAMESPACE}}|Template=|User=|[[Category:LSL Face{{#var:lang}}]][[Category:LSL Face{{#var:lang}}/{{#if:{{{return|}}}{{{returns|}}}|Get|Set}}]]}}}}}}

{{#vardefine:ALL_SIDES|{{LSL Const|ALL_SIDES|integer|-1|hex=0xFFFFFFFF}}}}

{{#vardefine:p_{{{1|none}}}_desc|{{LSLGC|Face{{#var:lang}}|face}} number{{#ifeq:{{{notall|}}}|*||<nowiki> </nowiki>or {{#var:ALL_SIDES}}}}}}

{{#vardefine:p_{{{1|none}}}_hover|face number{{#ifeq:{{{notall|}}}|*||<nowiki> </nowiki>or ALL_SIDES (-1)}}}}

{{#ifeq:{{{notall|}}}|*||{{#vardefine:facechoise|If {{LSLP|{{{1|none}}}}} is {{#var:ALL_SIDES}} then the {{#if:{{{2|}}}|{{{2|}}}|function}} {{#if:{{{get|}}}|{{{get|}}}|{{#if:{{{ALL_SIDES|}}}|{{{ALL_SIDES|}}}|works on all sides.}}}}}}}}

{{#vardefine:header_footnote|{{#var:header_footnote}}{{#if:{{{!footer|}}}||{{PBR}}
{{#var:facechoise}}{{PBR}}}}}}

{{#vardefine:caveats|{{#var:caveats}}{{#if:{{{!footer|}}}|
*{{#var:facechoise}}|}}{{#if:{{{return|}}}{{{returns|}}}|
*If {{LSLP|{{{1|none}}}}} indicates a face that does not exist the {{#if:{{{2|}}}|{{{2|}}}}} {{#if:{{{return|}}}|return is {{{return|}}}| returns {{{returns|}}}}}|
*The {{#if:{{{2|}}}|{{{2|}}}|function}} silently fails if its {{LSLP|{{{1|none}}}}} value indicates a face that does not exist.}}}}

}}<noinclude>
{| {{Prettytable}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|ALL_SIDES}}
|-
{{VarPair|p_{{{1|none}}}_desc}}
|-
{{VarPair|p_{{{1|none}}}_hover}}
|-
{{VarPair|facechoise}}
|-
{{VarPair|header_footnote}}
|-
{{VarPair|caveats}}
|}
</noinclude>

Template:LSL Function/link

Original shared helper source (conditional wiki logic is not evaluated)
<noinclude>{{Multi-lang|category=LSL}}</noinclude>{{LSL Injection Test}}{{#if:

{{#vardefine:header|{{#var:header}}
{{#switch:{{#if:{{{nc|}}}|Template|{{NAMESPACE}}}}|Template=|User=|}}}}

<includeonly>
{{#ifeq:{{#var:article-type}}|event||{{#if:{{#pos:{{#var:moded}}|r}}{{#pos:{{#var:moded}}|u}}||{{#vardefine:hidden-text|{{#var:hidden-text}}
{{LSLC|Link{{#var:lang}}}}{{#if:{{{mode|}}}|{{LSLC|Link/{{{mode}}}{{#var:lang}}}}}}
}}}}}}
</includeonly>

{{#if:{{{nlf|}}}{{{noconst|}}}{{#var:link_constants}}||
{{#vardefine:constants_nb|
{{{!}} style={{{ostyle|}}}
{{!}}- valign="top"
{{!}}
{{{!}} {{Prettytable|style=margin-top:0;}}
{{!}}-{{Hl2}}
! colspan="2" {{!}}Flag
!Description
{{!}}-
{{!}} {{LSL Const|LINK_ROOT|integer|1|c={{{verb|refers to}}} the root prim in a multi-prim linked set}}
{{!}} {{#var:value}}
{{!}} {{{verb|refers to}}} the [[Link#Root_Prim|root]] prim in a multi-prim linked set{{Footnote|handle=LINK_ROOT|LINK_ROOT does not work on single [[prim]] [[object|objects]]. Unless there is an avatar sitting on the [[object]].}}
{{#if:{{{nogroup|}}}||{{!}}-
{{!}} {{LSL Const|LINK_SET|integer|-1|c={{{verb|refers to}}} all prims}}
{{!}} {{#var:value}}
{{!}} {{#var:comment}}
{{!}}-
{{!}} {{LSL Const|LINK_ALL_OTHERS|integer|-2|c={{{verb|refers to}}} all other prims}}
{{!}} {{#var:value}}
{{!}} {{#var:comment}}}}
{{!}}}
{{!}}
{{{!}} {{Prettytable|style=margin-top:0;}}
{{!}}-{{Hl2}}
! colspan="2" {{!}}Flag
!Description
{{!}}-
{{#if:{{{nogroup|}}}||{{!}} {{LSL Const|LINK_ALL_CHILDREN|integer|-3|c={{{verb|refers to}}} all children, (everything but the root)}}
{{!}} {{#var:value}}
{{!}} {{{verb|refers to}}} all children, (everything but the [[Link#Root_Prim|root]])}}
{{!}}-
{{!}} {{LSL Const|LINK_THIS|integer|-4|c={{{verb|refers to}}} the prim the script is in}}
{{!}} {{#var:value}}
{{!}} {{{verb|refers to}}} the [[prim]] the [[script]] is in
{{!}}}
{{!}}}
{{#var:constants_nb}}}}
{{#vardefine:link_constants|*}}
}}

{{#vardefine:p_{{{1|}}}_desc|[[Link]] number ({{#if:{{{nounlinked|}}}||0: {{HoverText|unlinked|When an object is made up of only one prim, and there are no avatars seated upon it, the link number of the (root) prim is zero.}},&#32;}}1: {{HoverText|[[Link#Root_Prim|root]] prim|When an object is made up of multiple prims or there is an avatar seated upon the object, the root prim's link number is one}}, &gt;1: child prims{{#if:{{{noavatar|}}}||&#32;and {{HoverText|seated avatars|Avatars sitting on objects are assigned link numbers. They are always greater than prim link numbers.}}}}) {{#if:{{{nlf|}}}||or a <code>LINK_*</code> [[flag]]}}{{{2|}}}&#32;}}
{{#vardefine:p_{{{1|}}}_hover|Link number ({{#if:{{{nounlinked|}}}||0: unlinked,&#32;}}1: root prim, &gt;1: child prims{{#if:{{{noavatar|}}}||&#32;and seated avatars}}) {{#if:{{{nlf|}}}||or a LINK_* flag}}{{#if:{{{3|}}}|{{{3|}}}|{{{2|}}}}}&#32;}}

{{#if:{{{nocaveats|}}}||{{#if:{{{noavatar|}}}|
{{#vardefine:caveats|
*{{LSLP|{{{1|}}}}} cannot be a {{HoverText|seated avatar|Avatars sitting on objects are assigned link numbers. They are always greater than link numbers of prims.}}.
{{#var:caveats}}}}
}}{{#if:{{{nogroup|}}}|
{{#vardefine:caveats|
*{{LSLP|{{{1|}}}}} needs to be either an actual [[llGetLinkNumber|link number]] or a link constants that equate to a single prim, such as [[LINK_ROOT]] and [[LINK_THIS]].
**[[LINK_SET]], [[LINK_ALL_CHILDREN]] and [[LINK_ALL_OTHERS]] will not work.
{{#var:caveats}}}}
}}}}

{{#if:{{#var:link_stuff}}||
{{#vardefine:link_stuff|*}}
{{#vardefine:notes|
<h3>Link Numbers</h3>
Each prim that makes up an [[object]] has an address, a link number. To access a specific [[prim]] in the [[object]], the [[prim]]'s link number must be known. In addition to [[prim|prims]] having link numbers, avatars seated upon the [[object]] do as well.
* If an [[object]] consists of only one [[prim]], and there are no avatars seated upon it, the ([[Link#Root_Prim|root]]) [[prim]]'s link number is zero.
* However, if the [[object]] is made up of multiple prims or there is an avatar seated upon the [[object]], the [[Link#Root_Prim|root]] [[prim]]'s link number is one.

When an avatar sits on an [[object]], it is added to the end of the link set and will have the largest link number. In addition to this, while an avatar is seated upon an object, the object is unable to link or unlink prims without [[llUnSit|unseating]] all avatars first.
<h4>Counting Prims & Avatars</h4>
There are two functions of interest when trying to find the number of prims and avatars on an object.
* <code>[[llGetNumberOfPrims]]()</code> - Returns the number of [[prim|prims]] and seated avatars.
* <code>[[llGetObjectPrimCount]]([[llGetKey]]())</code> - Returns only the number of [[prim|prims]] in the [[object]] but will return zero for attachments.

<syntaxhighlight lang="lsl2">integer GetPrimCount() { //always returns only the number of prims
    if(llGetAttached())//Is it attached?
        return llGetNumberOfPrims();//returns avatars and prims but attachments can't be sat on.
    return llGetObjectPrimCount(llGetKey());//returns only prims but won't work on attachments.
}</syntaxhighlight>See [[llGetNumberOfPrims]] for more about counting prims and avatars.

<h4>Errata</h4>
If a script located in a [[Link#Child_Prim|child]] prim erroneously attempts to access link 0, it will get or set the property of the linkset's [[Link#Root_Prim|root]] prim.  This bug ({{jira|BUG-5049}}) is preserved for broken legacy scripts. {{PBR}}
{{#var:notes}}
}}

{{#vardefine:also_functions|{{#var:also_functions}}
{{LSL DefineRow||[[llGetLinkNumber]]|Returns the link number of the [[prim]] the script is in.}}}}
}}

}}<noinclude>
{| {{Prettytable}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|p_{{{1|}}}_desc}}
|-
{{VarPairTable|also_functions}}
|-
{{VarPair|constants_nb}}
|-
{{VarPair|notes}}
|}
</noinclude>

Template:Issues/SVC-7422

Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|SVC-7422|ll*LinkMedia functions do not work with LINK_* flags|type=bug|resolution=fixed}}
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.