excommunicado
excommunicado

Reputation: 287

Saving file in arbitrary folder uwp

I'm writing UWP app (C# and C++/CX). My app gives user an opportunity to save video recorded by some connected camera. I use OpenCV VideoWriter for it because I have to add video effects to C# SoftwareBitmap (comes to me from MediaFrameReader).

Thats how I'm creating VideoWriter in C++/CX code:

videoWriter.open(
    pathToCreatedFile, // Works with "videos", but not with "desktop" or other
    encodingProperties.codec,
    encodingProperties.fps,
    cv::Size{ (int)frameSize.Width, (int)frameSize.Height }
);

If I pick default Windows "Videos" library for saving, everything is good, but when I try to use "Desktop" folder for example or any other specific location, my output .mp4 file is 0KB. Is it possible to save file in random directory in UWP and how can I reach it?

P.S. My minimal version is November update.

Upvotes: 0

Views: 139

Answers (1)

Chuck Walbourn
Chuck Walbourn

Reputation: 41127

By design, you don't have access to arbitrary file folders from a UWP. You can request specific media libraries via a declared capability easily: documentsLibrary, documentsLibrary, picturesLibrary, and/or picturesLibrary.

There is no option for accessing the desktop directly.

The broadFileSystemAccess capability would allow this, but this is a restricted capability which means it will be difficult to publish it to the Windows Store (if that's your plan).

See Microsoft Docs.

Upvotes: 1

Related Questions