次の方法で共有


Media Object

[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 Media object provides a way to specify or retrieve properties of a media item, using the following properties and methods.

The Media object supports the following properties.

Property Description
attributeCount Retrieves the number of attributes that can be queried and/or set for the media item.
duration Retrieves the duration in seconds of the current media item.
durationString Retrieves a String value indicating the duration of the current media item in HH:MM:SS format.
error Retrieves an ErrorItem object if the media item has an error condition.
imageSourceHeight Retrieves the height of the current media item in pixels.
imageSourceWidth Retrieves the width of the current media item in pixels.
markerCount Retrieves the number of markers in the media item.
name Specifies or retrieves the name of the media item.
sourceURL Retrieves the URL of the media item.

 

The Media object supports the following methods.

Method Description
getAttributeCountByType Retrieves the number of attributes associated with the specified attribute name and language.
getAttributeName Retrieves the name of the attribute corresponding to the specified index.
getItemInfo Retrieves the value of the specified attribute for the media item.
getItemInfoByAtom Retrieves the value of the attribute with the specified index number.
getItemInfoByType Retrieves the value of the attribute corresponding to the specified attribute name, language, and index.
getMarkerName Retrieves the name of the marker at the specified index.
getMarkerTime Retrieves the time of the marker at the specified index.
isIdentical Retrieves a value indicating whether the supplied object is the same as the current one.
isMemberOf Retrieves a value indicating whether the specified media item is a member of the specified playlist.
isReadOnlyItem Retrieves a value indicating whether the attributes of the specified media item can be edited.
setItemInfo Sets the value of the specified attribute for the media item.

 

The Media object is accessed through the following properties and methods.

Object Property or method
Controls currentItem
Player currentMedia, newMedia
Playlist item

 

Because it is the most common means of access, player.currentMedia is used for purposes of illustration in the reference syntax sections.

See also

Object Model Reference for Scripting