Windows Media Player 11 SDK IWMPControls.currentMarker (VB and C#)
Previous | Next |
IWMPControls.currentMarker (VB and C#)
The currentMarker property gets or sets the current marker number.
Property Value
A System.Int32 that is the marker number.
Remarks
Setting currentMarker causes playback to start from the specified marker. Before attempting to set currentMarker, determine whether a file has markers and how many it has by using IWMPMedia.markerCount. If a file has no markers, setting currentMarker to anything but zero results in an error. Setting currentMarker to a number higher than markerCount also results in an error.
The currentMarker property always returns the current or last marker, which means the actual file position can be either at the current marker or before the next marker. Markers are numbered beginning at 1, so if a file has markers, you can set currentMarker to zero to change the file position to zero.
Until the current media item is set (using AxWindowsMediaPlayer.URL or AxWindowsMediaPlayer.currentMedia), currentMarker returns zero.
Example Code
The following example uses currentMarker to start video playback from the marker that corresponds to the SelectedIndex property of a list box which has been filled with marker identifiers. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.
' Fill the list box with the marker identifiers of the current media item. markers.Items.Add("Begining") markers.Items.Add("Sunrise") markers.Items.Add("Car chase") markers.Items.Add("Happy ending") ' Set the currentMarker to the marker selected from the list box. Public Sub markers_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles markers.SelectedIndexChanged Dim lb As System.Windows.Forms.ListBox = sender Dim selectedMarker As Integer = lb.SelectedIndex player.Ctlcontrols.currentMarker = selectedMarker End Sub
FakePre-52f6b37cca754b95835540d06de2c1fd-9166dc57803548b7bb09d8711ca82088
// Fill the list box with the marker identifiers of the current media item. markers.Items.Add("Begining"); markers.Items.Add("Sunrise"); markers.Items.Add("Car chase"); markers.Items.Add("Happy ending"); // Set the currentMarker to the marker selected from the list box. private void markers_OnSelectedIndexChanged(object sender, System.EventArgs e) { int selectedMarker = ((System.Windows.Forms.ListBox)sender).SelectedIndex; player.Ctlcontrols.currentMarker = selectedMarker; }
Requirements
Version: Windows Media Player 9 Series or later
Namespace: WMPLib
Assembly: Interop.WMPLib.dll (automatically generated by Visual Studio)
See Also
- AxWindowsMediaPlayer.currentMedia (VB and C#)
- AxWindowsMediaPlayer.URL (VB and C#)
- IWMPControls Interface (VB and C#)
- IWMPMedia.markerCount (VB and C#)
Previous | Next |