Compartilhar via


Value (MediaAttribute)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the value of the MediaAttribute object.

value = object.Value
object.Value = value

Property Value

Type: string

The value of the MediaAttribute.

This property is read-only. There is no default value.

Managed Equivalent

MediaAttributes, then use Dictionary<TKey, TValue> APIs

Remarks

The Name of a MediaAttribute object is the name of the XML element in the ASX file that the MediaAttribute corresponds to. The Value of the MediaAttribute is the text value of the XML element. In the following example, the MediaAttribute corresponds to the following ASX tag:

<Title>Clip1</Title>

In this example, the Name of the MediaAttribute is "Title" and the Value is "Clip1".

Example

The following JavaScript example shows how to retrieve the Attributes property of a MediaElement that has a Source (MediaElement) property set to an ASX playlist file. The code iterates through the retrieved MediaAttributeCollection and displays the Name and Value properties of each MediaAttribute.

function onMediaOpened(sender, args) {
    // Variable to hold the MediaAttribute.
    var attribute;
   
    // Get the MediaAttribute named Title.
    try
    {
        var attributesCollection = sender.Attributes;
        attribute = attributesCollection.getItemByName("Title");
    }
    catch(errorObj)
    {
        alert(errorObj.message);
    }
    
    // Display the value of the MediaAttribute.
    if(attribute != null)
    {
      alert("The title of the track is: " + attribute.value);
    }
}

Applies To

MediaAttribute