Compartilhar via


Changing Attribute Values

[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.]

You can change the value of an attribute if your webpage or application has read/write access to the library and the attribute can be both read and written.

You can change an attribute of the current media item. To change attributes of multiple media items, you can assign each one in turn to the Player.currentMedia property.

Throughout this topic, the Player object was defined in the following manner:

AxWMPLib.AxWindowsMediaPlayer Player;
using WMPLib;

To change an attribute, call the Player.currentMedia.setItemInfo method as shown in the following C# example.

IWMPMedia3 media;
// Initialize the Media object
media = Player.currentMedia;
// Set the new genre value
media.setItemInfo("WM/Genre", "My New Genre");

We recommend that you call the Media.isReadOnlyItem method to determine whether you can change a particular attribute.

Note

If you embed the control in your application, file attributes that you change will not be written to the digital media file 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.

 

Media Item Attributes

Library Access

Media Object

Reading Attribute Values