Partager via


MediaElement.Markers Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the collection of timeline markers associated with the currently loaded media file.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public ReadOnly Property Markers As TimelineMarkerCollection
public TimelineMarkerCollection Markers { get; }

Property Value

Type: System.Windows.Media.TimelineMarkerCollection
The collection of timeline markers (represented as TimelineMarker objects) associated with the currently loaded media file.
The default value is an empty collection.

Remarks

This collection is cleared and repopulated each time this MediaElement opens a new source file, and is only considered valid after the MediaOpened event has occurred.

Although the MediaElement object supports all Windows media technology markers (markers, metadata script commands, and separate-stream script commands), this collection does not include any timeline markers encoded as a separate stream in the media file, such as separate-stream script commands. If a file contains both header-embedded script commands and separate-stream script commands, this collection only contains those embedded in the file header. This is because MediaOpened is raised after reading the headers and metadata, but the full source might still be buffering and thus any separate stream markers are not available yet. Separate-stream script commands do trigger the MarkerReached event when encountered during media playback. However these markers are not accessible ahead of time using the Markers property.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.