开发者

Add subtitles to WPF video (not Silverlight)

开发者 https://www.devze.com 2023-03-25 03:22 出处:网络
Just like the title says I have a wpf application with a media element and a video 开发者_StackOverflowfile with srt subtitles.

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)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号