共用方式為


MediaElement.MarkerReached 事件

定義

在媒體播放期間遇到時間軸標記時發生。

public:
 virtual event TimelineMarkerRoutedEventHandler ^ MarkerReached;
// Register
event_token MarkerReached(TimelineMarkerRoutedEventHandler const& handler) const;

// Revoke with event_token
void MarkerReached(event_token const* cookie) const;

// Revoke with event_revoker
MediaElement::MarkerReached_revoker MarkerReached(auto_revoke_t, TimelineMarkerRoutedEventHandler const& handler) const;
public event TimelineMarkerRoutedEventHandler MarkerReached;
function onMarkerReached(eventArgs) { /* Your code */ }
mediaElement.addEventListener("markerreached", onMarkerReached);
mediaElement.removeEventListener("markerreached", onMarkerReached);
- or -
mediaElement.onmarkerreached = onMarkerReached;
Public Custom Event MarkerReached As TimelineMarkerRoutedEventHandler 
<MediaElement MarkerReached="eventhandler"/>

事件類型

範例

下列範例會建立 MediaElement 物件,並回應其 MarkerReached 事件。 每次到達時間軸標記時,此範例會顯示時間軸標記的時間、類型和文字值。

<MediaElement Name="Media" Source="video.mp4" MarkerReached="Media_MarkerReached" />
<TextBlock Name="txOutput" />
private void Media_MarkerReached(object sender, TimelineMarkerRoutedEventArgs e)
{
    txOutput.Text =
        string.Format("{0},{1},{2}", e.Marker.Time, e.Marker.Text, e.Marker.Type);
}

適用於