Freigeben über


Name (MediaAttribute)

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

Gets the name of a MediaAttribute.

value = object.Name

Property Value

Type: string

The name of the attribute.

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. For example, if the MediaAttribute corresponds to the following ASX tag:

<Title>Clip1</Title>

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 property set to an ASX playlist file. The retrieved MediaAttributeCollection is iterated through, and the Name and Value properties of each MediaAttribute are displayed.

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