Compartilhar via


Media.getItemInfo method

[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 getItemInfo method retrieves the value of the specified attribute for the current media item.

Syntax

strRetVal = Media.getItemInfo(
  name
)

Parameters

name [in]

String containing the name of the attribute. For information about the attributes supported by Windows Media Player, see the Windows Media Player Attribute Reference.

Return value

This method returns a String representing the value of the specified attribute. For attributes whose underlying value is Boolean, it returns the string "true" or "false".

Remarks

This method retrieves the metadata for an individual digital media item or a media item that is part of a playlist.

The attributeCount property contains the number of attribute names available for a given Media object. Index numbers can then be used with the getAttributeName method to determine the name of each available attribute. Individual attribute names can be passed to getItemInfo.

To retrieve attributes with multiple values and attributes with complex values, use the getItemInfoByType method.

To use this method, read access to the library is required. For more information, see Library Access.

To share the Windows media libraries over UPnP, Windows Media Player creates a content directory service (CDS) that is exposed over UPnP. Other devices can then navigate and browse the libraries.

In Windows 7, an application can use the Windows Media Player TrackingID and MediaType attributes to construct the object ID of each item in the CDS. Note that this construction might change in future versions of Windows. The application passes each of these attribute strings in the name parameter in a call to getItemInfo. getItemInfo returns the value for each attribute in the return value. The application then uses the following syntax to construct each object ID:

TrackingID.0.MediaTypeID

This syntax has the following meaning:

  • TrackingID is the string that is stored in the Windows Media Player TrackingID attribute of the media item.

  • MediaTypeID depends on the value of the MediaType attribute, as shown in the following table:

    MediaType attribute MediaTypeID
    Audio Items 4
    Photo Items B
    Video Items 8

Windows Media Player 10 Mobile: Attributes for a media item are available only during playback unless they are retrieved from the item through the media collection.

Requirements

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

See also

Media Object

Media.attributeCount

Media.getAttributeName

Media.getItemInfoByType

Media.setItemInfo

Reading Attribute Values

Settings.mediaAccessRights

Settings.requestMediaAccessRights