IWMPMedia :: getMarkerTime, méthode
La méthode getMarkerTime retourne l’heure du marqueur au niveau de l’index spécifié.
Syntaxe
public System.Double getMarkerTime(
System.Int32 MarkerNum
);
Public Function getMarkerTime( _
ByVal MarkerNum As System.Int32 _
) As System.Double
Implements IWMPMedia.getMarkerTime
Paramètres
-
MarkerNum [ dans]
-
System. Int32 qui est l’index du marqueur.
Valeur retournée
System. double qui correspond à l’heure du marqueur.
Remarques
Cette méthode retourne la valeur null si le marqueur spécifié n’existe pas.
Certains éléments multimédias ne contiennent pas de marqueurs. Utilisez markerCount pour déterminer le nombre de marqueurs qui se trouvent dans l’élément multimédia en cours.
Les numéros d’index des marqueurs commencent à 1.
Avant d’appeler cette méthode, vous devez disposer d’un accès en lecture à la bibliothèque. Pour plus d’informations, consultez accès à la bibliothèque.
Exemples
L’exemple de code suivant utilise getMarkerTime pour remplir une zone de texte multiligne avec l’emplacement de chaque marqueur. L’objet AxWMPLib. AxWindowsMediaPlayer est représenté par la variable Player.
// 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;
}
' 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
Configuration requise
| Condition requise | Valeur |
|---|---|
| Version |
Lecteur Windows Media série 9 ou version ultérieure |
| Espace de noms |
WMPLib |
| Assembly |
|