如何播放 WPFmediaElement 的一部分
我需要播放 Mediaelement 的一部分,例如从第二个 0:45 到 0:55 秒
我尝试使用 mediaelement 位置属性,这里是代码
Dim mytimeline As New MediaTimeline
Dim mc As MediaClock
FReveal1.Visibility = Windows.Visibility.Visible
FReveal1.Source = New Uri("videos\Front-Game-Answer-Reveals.wmv", UriKind.Relative)
FReveal1.Position = New TimeSpan(0, 0, 4)
mytimeline.Source = FReveal1.Source
mytimeline.Duration = (TimeSpan.FromMilliseconds(5000))
mc = myTimeLine.CreateClock()
FReveal1.Clock = mc
FReveal1.Play()
但我收到以下错误:“分配时钟时无法执行此操作到媒体播放器。”
还有另一种方法可以做到这一点吗?
谢谢
I need to play a section of the Mediaelement for example from the second 0:45 to 0:55 sec
I tried using the mediaelement position property here is the code
Dim mytimeline As New MediaTimeline
Dim mc As MediaClock
FReveal1.Visibility = Windows.Visibility.Visible
FReveal1.Source = New Uri("videos\Front-Game-Answer-Reveals.wmv", UriKind.Relative)
FReveal1.Position = New TimeSpan(0, 0, 4)
mytimeline.Source = FReveal1.Source
mytimeline.Duration = (TimeSpan.FromMilliseconds(5000))
mc = myTimeLine.CreateClock()
FReveal1.Clock = mc
FReveal1.Play()
But I get the following error : "Cannot perform this operation while a clock is assigned to the media player."
Is there another way to do this ?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
像这样的东西会起作用吗?
编辑:我可能应该补充一点,这有点牛仔。
Would something like this work?
EDIT: I should probably add that this is a bit cowboy.