Share via


Attributes Property

Gets the collection of MediaAttribute objects that corresponds to the current entry in the ASX file that Source is set to.

XAML
Cannot be used in XAML.
Scripting
value = object.Attributes

Property Value

MediaAttributeCollection

The collection of MediaAttribute objects.

This property is read-only. The default value is an empty collection.

Remarks

Attributes are generally populated on a per-source basis, and will not be valid until a source is loaded. For details, see Media Overview.

Examples

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 is displayed.

JavaScript
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

MediaElement

See Also

Media Overview