Partager via


Player 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 Player object is the root object for the Windows Media Player control. It supports the properties, methods, and events listed in the following tables.

The Player object supports the following properties. Properties marked with an asterisk (*) are not accessible to skins.

Property Description
cdromCollection Retrieves the CdromCollection object.
closedCaption Retrieves the ClosedCaption object.
controls Retrieves the Controls object.
currentMedia Specifies or retrieves the current Media object.
currentPlaylist Specifies or retrieves the current Playlist object.
dvd Retrieves the DVD object.
enableContextMenu * Specifies or retrieves a value indicating whether to enable the context menu, which appears when the right mouse button is clicked.
enabled * Specifies or retrieves a value indicating whether the Windows Media Player control is enabled.
error Retrieves the Error object.
fullScreen * Specifies or retrieves a value indicating whether video content is played back in full-screen mode.
isOnline Retrieves a value indicating whether the user is connected to a network.
isRemote * Retrieves a value indicating whether the Windows Media Player control is running in remote mode.
mediaCollection Retrieves the MediaCollection object.
network Retrieves the Network object.
openState Retrieves a value indicating the state of the content source.
playerApplication * Retrieves the PlayerApplication object when a remoted Windows Media Player control is running.
playlistCollection Retrieves the PlaylistCollection object.
playState Retrieves a value indicating the state of the Windows Media Player operation.
settings Retrieves the Settings object.
status Retrieves a value indicating the current status of Windows Media Player.
stretchToFit * Specifies or retrieves a value indicating whether video will stretch to fit size of the Windows Media Player control video display.
uiMode * Specifies or retrieves a value indicating which controls are shown in the user interface when Windows Media Player is embedded in a webpage.
URL Specifies or retrieves the name of the clip to play.
versionInfo Retrieves a String value specifying the version of the Windows Media Player.
windowlessVideo * Specifies or retrieves a value indicating whether the Windows Media Player control renders video in windowless mode.

 

* Not accessible to skins.

The Player object supports the following methods.

Method Description
close Releases Windows Media Player resources.
launchURL Sends a URL to the user's default browser to be rendered.
newMedia Creates a new Media object.
newPlaylist Creates a new Playlist object.
openPlayer Opens Windows Media Player using the specified URL.

 

The Player object supports the following events. Events marked with an asterisk (*) are not accessible to skins. For information about handling mouse and keyboard events in skins, see External Events.

Event Description
AudioLanguageChange Occurs when the current audio language changes.
Buffering Occurs when the Windows Media Player control begins or ends buffering.
CdromMediaChange Occurs when a CD or DVD is inserted into or ejected from a CD or DVD drive.
Click * Occurs when the user clicks a mouse button.
CurrentItemChange Occurs when Controls.currentItem changes.
CurrentMediaItemAvailable Occurs when a graphic metadata item in the current media item becomes available.
CurrentPlaylistChange Occurs when something changes within the current playlist.
CurrentPlaylistItemAvailable Occurs when the current playlist item becomes available.
Disconnect Reserved for future use.
DomainChange Occurs when the DVD domain changes.
DoubleClick * Occurs when the user double-clicks a mouse button.
DurationUnitChange Reserved for future use.
EndOfStream Reserved for future use.
Error Occurs when the Windows Media Player control has an error condition.
KeyDown * Occurs when a key is pressed.
KeyPress * Occurs when a key is pressed and then released.
KeyUp * Occurs when a key is released.
MarkerHit Occurs when a marker is reached.
MediaChange Occurs when a media item changes.
MediaCollectionAttributeStringAdded Occurs when an attribute value is added to the library.
MediaCollectionAttributeStringChanged Occurs when an attribute value in the library is changed.
MediaCollectionAttributeStringRemoved Occurs when an attribute value is removed from the library.
MediaCollectionChange Occurs when the media collection changes.
MediaCollectionMediaAdded Occurs when a media item is added to the local library.
MediaCollectionMediaRemoved Occurs when a media item is removed from the local library.
MediaError Occurs when the Media object has an error condition.
ModeChange Occurs when a mode of Windows Media Player is changed.
MouseDown * Occurs when a mouse button is pressed.
MouseMove * Occurs when the mouse pointer is moved.
MouseUp * Occurs when a mouse button is released.
NewStream Reserved for future use.
OpenPlaylistSwitch Occurs when a title on a DVD begins playing.
OpenStateChange Occurs when the Windows Media Player control changes state.
PlaylistChange Occurs when a playlist changes.
PlaylistCollectionChange Occurs when something changes in the playlist collection.
PlaylistCollectionPlaylistAdded Occurs when a playlist is added to the playlist collection.
PlaylistCollectionPlaylistRemoved Occurs when a playlist is removed from the playlist collection.
PlaylistCollectionPlaylistSetAsDeleted Reserved for future use.
PlayStateChange Occurs when the play state of the Windows Media Player control changes.
PositionChange Occurs when the current position of the media item has been changed.
ScriptCommand Occurs when a synchronized command or URL is received.
StatusChange Occurs when the status property changes value.
StringCollectionChange Occurs when a string collection changes.
Warning Reserved for future use.

 

* Not accessible to skins. For information about handling mouse and keyboard events in skins, see Ambient Event Handlers.

When embedded in a webpage, the Player object can be accessed by using the ID value specified in the OBJECT tag. Within a skin definition file, it is accessed by using the player global attribute. For illustration purposes, player will be used as the object ID in the reference syntax sections.

See also

Object Model Reference for Scripting