共用方式為


Media.name

[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 name property specifies or retrieves the name of the media item.

Syntax

player.currentMedia.name

Possible Values

This property is a read/write String containing the name of the media item.

Remarks

To retrieve the value of this property, read access to the library is required. To specify the value of this property, full access to the library is required. For more information, see Library Access.

Before using this method to specify the name of a media item, use isReadOnlyItem to determine whether the name can be set.

Windows Media Player 10 Mobile: This property is read-only.

Examples

The following JScript example uses Media.name to change the name of the current media item. An HTML TEXT input element named NameText allows the user to enter a text string for the new name. The Player object was created with ID = "Player".

<!<entity type="mdash"/>-Create an HTML BUTTON element to execute the name change. -->
<INPUT type = "BUTTON"  id = "NewName"  name = "NewName"  value = "Change Name" 
    onClick = "

        /* Store the current media item. */
        var cm = Player.currentMedia;

        /* Change the name. */
        cm.name = NameText.value;
">

Requirements

Requirement Value
Version
Windows Media Player version 7.0 or later.
DLL
Wmp.dll

See also

Media Object

Settings.mediaAccessRights

Settings.requestMediaAccessRights