在 WPF 代码中将 Mediaelement 源设置为相对 URI

编程入门 行业动态 更新时间:2024-10-27 20:28:12
本文介绍了在 WPF 代码中将 Mediaelement 源设置为相对 URI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个项目是 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

本文发布于:2023-07-11 11:54:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1093962.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:设置为   中将   代码   WPF   Mediaelement

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!