Name (MediaAttribute)
Key
M11
M12
M21
M22
Tag
Uri
X1
X2
Y1
Y2
TOC
Collapse the table of content
Expand the table of content

Name (MediaAttribute)

Silverlight

Gets the name of a MediaAttribute.

value = object.Name

Type: string

The name of the attribute.

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

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".

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);
    }
}

Community Additions

ADD
Show:
© 2016 Microsoft