Bagikan melalui


MediaElement.MarkerReached Kejadian

Definisi

Terjadi ketika penanda garis waktu ditemui selama pemutaran media.

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"/>

Jenis Acara

Contoh

Contoh berikut membuat objek MediaElement dan merespons peristiwa MarkerReached-nya. Setiap kali penanda garis waktu tercapai, contoh menampilkan nilai Waktu, Jenis, dan Teks penanda garis waktu.

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

Berlaku untuk