Share via


Understanding Attribute Sources

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The attributes, or metadata, that you can use come from a variety of sources. This topic describes those sources, moving from scenarios with fewer potential attributes to those with more potential attributes.

While the user plays a CD or DVD, you have access to very little metadata about the disc itself or the media content of the disc. Commercial discs do not typically include attribute metadata.

If the user has played a CD or DVD while they were connected to the Internet, you may have access to more attributes when that disc is in the CD or DVD drive. While Windows Media Player is connected to the Internet and playing a CD or DVD, the Player retrieves metadata for that disc from an online database. The Player displays this information in Now Playing and in a separate node in the library. The attributes are not stored in the library database, but they are cached. If the cache has not yet been emptied, your application will have access to the attributes while the disc is in the drive.

Note

Users may choose to disallow retrieving media information from an online database. In that case, the only attributes available to you will be those from a digital media file, those that the user has manually entered in the library, and those generated by the Player itself (such as the attributes related to how frequently an item has been played).

 

If the user plays a digital media file that is not added to the library, you have access to the attributes that are in the file.

If the user plays a digital media file that has been added to the library, you have access to the attributes that are stored only in the library, the attributes that are stored only in the file, and the attributes that are stored in both the library and the file.

The attributes that are available for media items added to the library vary according to how the source digital media file was created and what actions the user has taken since adding it.

  • The content creator may insert attribute information in the file when it is first created. For example, if you create and distribute a digital media file with your application, then you have control over which attributes are originally inserted in the file.

  • If the user modifies attribute data for a media item that has been added to the library, using Advanced Tag Editor or the library user interface, Windows Media Player adds that data to the library database. The Player adds some attributes directly to the file because they are stored only in the file. At some indeterminate time the read/write attributes synchronize with the file so that attributes that are stored in both the library and the file have the same value.

  • If the user copies a track from a CD by using Windows Media Player while connected to the Internet, the effect is nearly the same as if the user had modified attributes by using Windows Media Player. Attributes are added to the library database, drawn from the file itself and from an online database. Some attributes are stored only in the file. At some indeterminate time the library database synchronizes with the file.

  • If you write code using the Windows Media Player control to change the value of an existing read/write attribute in a media item that has been added to the library, the effect is nearly the same as if the user had modified the attribute using Windows Media Player. The value is written to the library database and at some indeterminate time the database synchronizes with the file.

  • [!Note]

    If you embed the control in your application, file attributes that you change will not be written to the digital media file itself until the user runs Windows Media Player. If you use the control in a remoted application written in C++, file attributes that you change will be written to the digital media file shortly after you make the changes. In either case, the changes are immediately available to you through the library.

     

  • If you write code using the Windows Media Player control to insert a custom attribute into a media item, the attribute and its value will persist only as long as your application has a reference to the Media object. Neither the attribute nor its value will be stored in the library database or the digital media file, if there is one.

The simplest situation is when you are working with digital media files that you have supplied. In that scenario, you know that specific attributes are in the file. When you add the media item to the library, you know that you can work with those attributes.

Media Item Attributes