Search code examples
silverlightmedia-player

How can I link to a specific point in a silverlight video?


I want to be able to click on an html link in a browser and have that send me to a specific point in a silverlight video. Is there an easy way to do this?


Solution

  • If you are using a MediaElement you can use the Position property:

    Gets or sets the current position of progress through the media's playback time.

    Use this property to set to a specific position within the media. This property is settable, rather than there being a specific MediaElement.Seek method.

    If the media does not support seek operations (which is the case for live streaming media), setting this property will have no effect on media playback.

    However, it states further down the page:

    XAML usage for this property is not shown. You generally should not set this value in XAML, because until the media source is loaded there is no guarantee that the media can be positioned (it could be streaming, and therefore cannot be positioned). After MediaOpened is raised, check the value of CanSeek. If it is true, then the media can be positioned, and then you can set Position in code. XAML usage is technically possible however, and can be set using an attribute string in the format [days.]hours:minutes:seconds[.fractionalSeconds]. See BufferingTime for further guidance on the XAML grammar for timespans; a Position is parsed by the same methodology.