MediaElement.MarkerReached Event
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Occurs when a timeline marker is encountered during media playback.
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"/>
Event Type
Examples
The following example creates a MediaElement object and responds to its MarkerReached event. Each time a timeline marker is reached, the example displays the timeline marker's Time, Type, and Text values.
<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);
}