How to Play Video File On D Drive In WinRT?

爱⌒轻易说出口 提交于 2019-12-11 07:34:40

问题


Using XAML C# in Windows "Metro" Apps how do I go about playing a certain video file. Examples:

  • D:\video1.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.

I have tried to use GetFileFromPathAsync but I keep getting permission / access issues

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

Apologies if this has been answered I just couldn't find an answer that fits my problem.


回答1:


If your D:\ drive is a non-network resource try adding the Removable storage application capability. This can be accomplished by double-clicking on the Package.appxmanifest and navigating to the Capabilities tab. 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).

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.

Further Reads:

  • Accessing data and files
  • How to load data from files
  • App Capabilities Overview


来源:https://stackoverflow.com/questions/12963058/how-to-play-video-file-on-d-drive-in-winrt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!