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);
}

适用于