Partager via


AxWindowsMediaPlayer Object (VB and C#)

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

The AxWindowsMediaPlayer object supports the following properties.

Property Description
cdromCollection Gets an IWMPCdromCollection interface.
closedCaption Gets an IWMPClosedCaption interface.
Ctlcontrols Gets an IWMPControls interface.
Ctlenabled Gets or sets a value indicating whether the Windows Media Player control is enabled.
currentMedia Gets or sets the IWMPMedia interface that corresponds to the current media item.
currentPlaylist Gets or sets the current IWMPPlaylist interface.
dvd Gets an IWMPDVD interface.
enableContextMenu Gets or sets a value indicating whether to enable the context menu, which appears when the right mouse button is clicked.
Error Gets an IWMPError interface.
fullScreen Gets or sets a value indicating whether video content is played back in full-screen mode.
isOnline Gets a value indicating whether the user is connected to a network.
isRemote Not supported for .NET programming.
mediaCollection Gets an IWMPMediaCollection interface.
network Gets an IWMPNetwork interface.
openState Gets a value indicating the state of the content source.
playerApplication Not supported for .NET programming.
playlistCollection Gets an IWMPPlaylistCollection interface.
playState Gets a value indicating the state of the Windows Media Player operation.
settings Gets an IWMPSettings interface.
status Gets a value indicating the current status of Windows Media Player.
stretchToFit Gets or sets a value indicating whether video will stretch to fit size of the Windows Media Player control video display.
uiMode Gets or sets a value indicating which controls are shown in the user interface when Windows Media Player is embedded in a webpage.
URL Gets or sets the name of the clip to play.
versionInfo Gets a value that specifies the version of the Windows Media Player.
windowlessVideo Gets or sets a value indicating whether the Windows Media Player control renders video in windowless mode.

 

The AxWindowsMediaPlayer 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 Returns an IWMPMedia interface for a new media item.
newPlaylist returns an IWMPPlaylist interface for a new playlist.
openPlayer Opens Windows Media Player using the specified URL.

 

The AxWindowsMediaPlayer object supports the following events.

Event Description
AudioLanguageChange Occurs when the current audio language changes.
Buffering Occurs when the Windows Media Player control begins or ends buffering.
CdromBurnError Occurs when a generic error happens during a CD burning operation.
CdromBurnMediaError Occurs when an error happens while burning an individual media item to a CD.
CdromBurnStateChange Occurs when a CD burning operation changes state.
CdromMediaChange Occurs when a CD or DVD is inserted into or ejected from a CD or DVD drive.
CdromRipMediaError Occurs when an error happens while ripping an individual track from a CD.
CdromRipStateChange Occurs when a CD ripping operation changes state.
Click Occurs when the user clicks a mouse button.
CreatePartnershipComplete Not supported for .NET programming.
CurrentItemChange Occurs when IWMPControls.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.
DeviceConnect Not supported for .NET programming.
DeviceDisconnect Not supported for .NET programming.
DeviceStatusChange Not supported for .NET programming.
DeviceSyncError Not supported for .NET programming.
DeviceSyncStateChange Not supported for .NET programming.
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.
FolderScanStateChange Occurs when a folder monitoring operation changes state.
KeyDown Occurs when a key is pressed.
KeyPress Occurs when a key is pressed and then released.
KeyUp Occurs when a key is released.
LibraryConnect Occurs when a library becomes available.
LibraryDisconnect Occurs when a library is no longer available.
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.
PlayerDockedStateChange Not supported for .NET programming.
PlayerReconnect Not supported for .NET programming.
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.
SwitchedToControl Not supported for .NET programming.
SwitchedToPlayerApplication Not supported for .NET programming.
Warning Reserved for future use.

 

Interfaces for Visual Basic .NET and C#

IWMPCdromCollection Interface (VB and C#)

IWMPClosedCaption Interface (VB and C#)

IWMPControls Interface (VB and C#)

IWMPDVD Interface (VB and C#)

IWMPError Interface (VB and C#)

IWMPMedia Interface (VB and C#)

IWMPMediaCollection Interface (VB and C#)

IWMPNetwork Interface (VB and C#)

IWMPPlaylist Interface (VB and C#)

IWMPPlaylistCollection Interface (VB and C#)

IWMPSettings Interface (VB and C#)

Object Model Reference for Visual Basic .NET and C#

WMPOpenState

WMPPlayState