Condividi tramite


Attributes

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

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

value = object.Attributes

Property Value

Type: MediaAttributeCollection

The collection of MediaAttribute objects.

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

Managed Equivalent

Attributes

Remarks

Attributes are generally populated on a per-source basis and will not be valid until a source is loaded.

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

MediaElement