我有一个项目是 WPF4 和 VB.我正在尝试使用媒体时间线(在故事板结构内)设置媒体元素的源,以便我可以循环媒体元素.但是,我无法弄清楚如何在 WPF 中将源设置为相对 URI.我知道如何在 VB 中执行此操作,但是通过在那里设置源,我无法让媒体循环播放.
I have a project that is WPF4 and VB. I'm trying to set a mediaelement's source using a mediatimeline (inside a storyboard construct), so I can loop the mediaelement. However, I cannot figure out how to set the source to a relative URI in WPF. I know how to do it in VB, but by setting the source there, I can't have the media looping.
如何将媒体时间线中的媒体元素的来源设置为相对 URI?
How do I set the source of a mediaelement in a mediatimeline to a relative URI?
推荐答案请参阅 MSDN 参考 MediaElement.Source 属性.确保媒体文件属性Copy To Output"设置为Copy Always"或Copy If Newer".
See the MSDN reference to the MediaElement.Source property. Make sure the media file property "Copy To Output" is set to "Copy Always" or "Copy If Newer".
示例:
<MediaElement x:Name="xyzName" Width="Auto" Height="Auto" Source="MediaFolder/YourMediaFile.mov" />更多推荐
在 WPF 代码中将 Mediaelement 源设置为相对 URI
发布评论