简体   繁体   English

如何在WinRT的D盘上播放视频文件?

[英]How to Play Video File On D Drive In WinRT?

Using XAML C# in Windows "Metro" Apps how do I go about playing a certain video file. 在Windows“ Metro”应用中使用XAML C#如何播放某个视频文件。 Examples: 例子:

  • D:\\video1.wmv D:\\ video1.wmv
  • \\\\MEDIAPC\\video2.wmv \\\\ MEDIAPC \\ video2.wmv

The only way I managed to get this working so far is by using FilePicker, but I don't want to use this as I already have a list of files to play. 到目前为止,我设法做到这一点的唯一方法是使用FilePicker,但是我不想使用它,因为我已经有了要播放的文件列表。

I have tried to use GetFileFromPathAsync but I keep getting permission / access issues 我尝试使用GetFileFromPathAsync,但我一直在获得权限/访问问题

 await StorageFile.GetFileFromPathAsync(@"D:\video1.wmv");

Apologies if this has been answered I just couldn't find an answer that fits my problem. 抱歉,如果已经回答了,我只是找不到适合我问题的答案。

If your D:\\ drive is a non-network resource try adding the Removable storage application capability. 如果您的D:\\驱动器是非网络资源,请尝试添加可移动存储应用程序功能。 This can be accomplished by double-clicking on the Package.appxmanifest and navigating to the Capabilities tab. 这可以通过双击Package.appxmanifest并导航到“功能”选项卡来完成。 By default your application (assuming it is a Windows Store app) only has access to local files packaged with your app or files stored in local/roaming/temp folders (usually reserved for Application state). 默认情况下,您的应用程序(假设它是Windows Store应用程序)只能访问与您的应用程序打包在一起的本地文件或存储在本地/漫游/临时文件夹(通常保留给应用程序状态)中的文件。

If your data is stored on a Network resource that requires authentication you will want to enable the Enterprise Authentication capability. 如果您的数据存储在需要身份验证的网络资源上,则需要启用企业身份验证功能。

You may also want to fiddle with the Home and Work Networks for the \\MEDIAPC\\ files if you aren't accessing resources that require network authentication. 如果您不访问需要网络身份验证的资源,则可能还想弄弄\\ MEDIAPC \\文件的家庭和工作网络。

Further Reads: 进一步阅读:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM