IWMPControls::currentMarker property
[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 currentMarker property gets or sets the current marker number.
Syntax
public System.Int32 currentMarker {get; set;}
Public Property currentMarker As System.Int32
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.
Examples
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.
private void markers_OnSelectedIndexChanged(object sender, System.EventArgs e)
{
int selectedMarker = ((System.Windows.Forms.ListBox)sender).SelectedIndex;
player.Ctlcontrols.currentMarker = selectedMarker;
}
' 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
Requirements
Requirement | Value |
---|---|
Version |
Windows Media Player 9 Series or later |
Namespace |
WMPLib |
Assembly |
|