I am creating an app where I need to record videos in C# and save them on the device. To do that i am using
StorageLibrary videos= await StorageLibrary.GetLibraryAsync(KnownLibraryId.Videos);
However when I run this code, it throws an exception.
System.UnauthorizedAccessException: 'Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))'
. Where can i authorize the app to get the library? I have tried the "Windows Management Instrumentation" but i dont know what to do here. Self, System and Administrators already have permission.
async void Device_IncomingConnectionArrived(object sender, IncomingConnectionEventArgs e)
{
e.Accept();
StorageLibrary myVideos = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Videos);
//...
}
Stack trace
SimpleCommunication.exe!SimpleCommunication.CaptureDevice.mediaSink_IncomingConnectionEvent(object sender, object args) Line 53 C#
SimpleCommunication.exe!SimpleCommunication.VideoChat.Device_IncomingConnectionArrived(object sender, Microsoft.Samples.SimpleCommunication.IncomingConnectionEventArgs e) Line 123 C#
The problem was, I had not added the capabilities to the video library. At package.appxmanifest file, under Capabilities, select videolibrary.
User contributions licensed under CC BY-SA 3.0