媒体元素播放视频保存在另一个项目中。 [英] Media element to play video kept in another project.
问题描述
我将视频文件保存在其他Windows手机库项目中,并在我当前的Windows应用程序项目中引用该项目。我使用下面的代码片段来播放该库项目中的视频,但它没有播放。
I kept the video file in other windows phone library project and reference that project in my current windows application project. I have used below code snippet to play the video from that library project but it is not playing.
< span style ="color:#2b91af; font-size:small"> MediaElement media =
new MediaElement ();
MediaElementmedia = newMediaElement();
media.Source = new Uri ( " project; component / video1.wmv" ,
UriKind .Relative);
media.Source = newUri("project;component/video1.wmv", UriKind.Relative);
//在调用play方法之前,在Layour根的面板中添加了这个media元素。
//before play method is called, added this media element in the panel of the Layour root.
panel.children.Add(media)
panel.children.Add(media)
请帮我解决这个问题。
比ks。
推荐答案
1。您需要一个前导斜杠:" / project; component / video1.wmv" ...
1. You need a leading slash: "/project;component/video1.wmv"...
2。当包含在附属程序集中时,文件的构建操作需要设置为"资源"。
2. When included in a satellite assembly the Build Action for the file needs to be set to "Resource".
正常构建行动:"内容"导致文件包含在XAP中,但这仅适用于主(应用程序)项目。
Normally Build Action: "Content" causes files to be included in the XAP but this only works for the primary (application) project.
这篇关于媒体元素播放视频保存在另一个项目中。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!