Windows Media Player 11 SDK AxWindowsMediaPlayer.currentMedia (VB and C#)
Previous | Next |
AxWindowsMediaPlayer.currentMedia (VB and C#)
The currentMedia property gets or sets the IWMPMedia interface that corresponds to the current media item.
[Visual Basic] Public Overridable Property currentMedia As IWMPMedia [C#] public virtual IWMPMedia currentMedia {get; set;}
Property Value
The WMPLib.IWMPMedia interface that provides access to the current media item.
Remarks
If the AxWindowsMediaPlayer.settings.autoStart property is true, playback begins automatically whenever you set currentMedia.
You can retrieve an IWMPMedia interface for a given media item through the IWMPPlaylist.Item property (the IWMPPlaylist.get_Item method in C#). To load a media item using a file name, set the URL property or use newMedia.
Example Code
The following example retrieves the first media item in the library and uses the currentMedia property to set the retrieved media item as the current media item and display its name. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.
[Visual Basic]
' Get an interface to the first media item in the library. Dim firstMedia As WMPLib.IWMPMedia3 = player.mediaCollection.getAll().Item(0) ' Make the retrieved media item the current media item. player.currentMedia = firstMedia ' Display the name of the current media item. currentMediaLabel.Text = ("Found first media item. Name = " + player.currentMedia.name)
FakePre-8ede07fd922746de9dd1ca3096adcc52-d1db69977d7f4ff7952089fe79cb6c42
// Get an interface to the first media item in the library. WMPLib.IWMPMedia3 firstMedia = (WMPLib.IWMPMedia3)player.mediaCollection.getAll().get_Item(0); // Make the retrieved media item the current media item. player.currentMedia = firstMedia; // Display the name of the current media item. currentMediaLabel.Text = ("Found first media item. Name = " + player.currentMedia.name);
Requirements
Version: Windows Media Player 9 Series or later
Namespace: AxWMPLib
Assembly: AxInterop.WMPLib.dll (automatically generated by Visual Studio)
See Also
- AxWindowsMediaPlayer Object (VB and C#)
- AxWindowsMediaPlayer.currentMedia (VB and C#)
- AxWindowsMediaPlayer.newMedia (VB and C#)
- AxWindowsMediaPlayer.URL (VB and C#)
- IWMPMedia Interface (VB and C#)
- IWMPPlaylist.Item (VB and C#)
- IWMPSettings.autoStart (VB and C#)
Previous | Next |