I want to open a file on a computer on a local network with its full directory. Something like that:
var path = "C:/User/Folder/video.mp4";
var stream = ...;
\\code
mediaElement.SetSource(stream,"");
I haven't found any ways on the internet. There were options only to add a file to the project, but this is not what I need.
There are two ways to do it. FileOpenPicker and broadFileSystemAccess
FileOpenPicker
The first one is to use FileOpenPicker. When you use it, it will show a window that lets the user choose and open files. It does not require any extra permissions but users need to know where the file is and pick the file by themself.
Code:
broadFileSystemAccess
The second one is to use the restricted capability called broadFileSystemAccess. You need to add the capability into your app's manifestfile like this:
Then you could use APIs from Windows.Storage Namespace to get files directly via path. Like:
When you use this capability, please make sure that user has enabled the file system privacy setting after installed the app. You could find the settings in Settings > Privacy > File system.