Share via


Windows Media Player 11 SDK IWMPMedia.getMarkerTime (VB and C#) 

Windows Media Player SDK banner art

Previous Next

IWMPMedia.getMarkerTime (VB and C#)

The getMarkerTime method returns the time of the marker at the specified index.

[Visual Basic]
Function getMarkerTime(
  MarkerNum As Integer
) As Double

[C#]
double getMarkerTime (
  int MarkerNum
);

Parameters

MarkerNum

A System.Int32 that is the marker index.

Return Value

A System.Double that is the marker time.

Remarks

This method returns NULL if the specified marker does not exist.

Some media items do not contain markers. Use markerCount to find out how many markers are in the current media item.

Marker index numbers start at 1.

Before calling this method, you must have read access to the library. For more information, see Library Access.

Example Code

The following code example uses getMarkerTime to fill a multi-line text box with the location of each marker. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

[Visual Basic]
' Get the number of markers in the current media item.
Dim mcount As Integer = player.currentMedia.markerCount

' Create an array to store the list of marker times.
Dim markers(mcount) As String

' Verify that at least one marker exists in the current media.
If (mcount > 0) Then

    ' Loop through the marker list.
    For i As Integer = 1 To mcount

        ' Store the marker information in the array.
        markers(i) = ("Marker number " + i + " occurs at ")
        markers(i) += player.currentMedia.getMarkerTime(i).ToString()
        markers(i) += " second(s)."

    Next i

    ' Display the marker times in the text box.
    markerTimes.Lines = markers

End If

FakePre-0f04593f080d4444a334d330196c941b-ea2e677e305e452a8e486d746cdc610b

// Get the number of markers in the current media item.
int mcount = player.currentMedia.markerCount;

// Create an array to store the list of marker times.
string[] markers = new string[mcount];

// Verify that at least one marker exists in the current media.
if (mcount > 0)
{
    // Loop through the marker list.
    for (int i = 1; i < mcount + 1; i++)
    {
        // Store the marker information in the array.
        markers[i] = "Marker number " + i + " occurs at ";
        markers[i] += player.currentMedia.getMarkerTime(i).ToString();
        markers[i] += " second(s).";
    }

    // Display the marker times in the text box.
    markerTimes.Lines = markers;
}

Requirements

Version: Windows Media Player 9 Series or later

Namespace: WMPLib

Assembly: Interop.WMPLib.dll (automatically generated by Visual Studio)

See Also

Previous Next