C#WPF如何播放资源中的mov视频? [英] C# WPF how do i play mov videos in resources?
问题描述
我如何播放资源中的mov视频?我知道如何播放视频,我的代码是
how do i play mov videos in resources? i know how to play a video my code is
<MediaElement Name="VideoControl" Source="INTRO_TechXSoftware" Stretch="Fill" VerticalAlignment="Stretch" Margin="0,0,0,29" LoadedBehavior="Manual" UnloadedBehavior="Manual">
</MediaElement>
我的错误是
<pre lang="msil">Warning 1 The file ''INTRO_TechXSoftware'' is not part of the project or its ''Build Action'' property is not set to ''Resource''. C:\Users\Kyle\documents\visual studio 2010\Projects\DaysUntill\DaysUntill\VideoTutorial.xaml 7 43 DaysUntill</pre>
而且我不知道为什么现在让它播放,而且我也不知道如何解决它. INTRO_TechXSoftware
在我的资源中
and my error is
<pre lang="msil">Warning 1 The file ''INTRO_TechXSoftware'' is not part of the project or its ''Build Action'' property is not set to ''Resource''. C:\Users\Kyle\documents\visual studio 2010\Projects\DaysUntill\DaysUntill\VideoTutorial.xaml 7 43 DaysUntill</pre>
and i don''t know why its now letting me play and i don''t know how to fix it. INTRO_TechXSoftware
is in my resources
推荐答案
MediaElement文档备注"部分的第一行:"在与应用程序分发媒体时,您不能使用媒体文件作为项目资源.在项目文件中,您必须将媒体类型设置为Content,并将CopyToOutputDirectory设置为PreserveNewest或Always."
我不知道为什么要让它从资源中播放...我不能从资源中播放,但是可以使用Content/CopyToOutputDirectory = Always.
First line in the "Remarks" section of the MediaElement docs: "When distributing media with your application, you cannot use a media file as a project resource. In your project file, you must instead set the media type to Content and set CopyToOutputDirectory to PreserveNewest or Always."
I don''t know why it''s letting you play from a resource if it is...I can''t play from a resource but can using Content/CopyToOutputDirectory=Always.
这篇关于C#WPF如何播放资源中的mov视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!