Add subtitles to WPF video (not Silverlight)
Just like the title says I have a wpf application with a media element and a video 开发者_StackOverflowfile with srt subtitles.
An identical question is here displaying subtitles for a video in a WPF MediaElement
but the answer is for the media element in silverlight which has a markers collection. Well, the media element from WPF doesn't have this so I'm stuck. If anyone else has other idea it will be appreciated. Thanks
You can put a TextBlock over the MediaElement, and display subtitles accordingly.
<Grid>
<MediaElement />
<TextBlock Name="Subtitles" HorizontalAlignment="Center" VerticalAlignment="Bottom" />
</Grid>
However, this means you will manually have to implement the displaying of subtitles at the appropriate time. (Using the MediaElement.Position property)
精彩评论