0

我正在使用 C++ 和 XAML 来开发 UI 应用程序。执行过程中有一点我使用 CameraCaptureUI 来录制视频。代码如下所示:

    CameraCaptureUI^ dialog = ref new CameraCaptureUI();
    dialog->VideoSettings->Format = CameraCaptureUIVideoFormat::Mp4;




    concurrency::task<StorageFile^>(dialog->CaptureFileAsync(CameraCaptureUIMode::Video)).then([this](StorageFile^ file) {
        if (file != nullptr) {

            concurrency::task<Streams::IRandomAccessStream^>(file->OpenAsync(FileAccessMode::Read)).then([this](Streams::IRandomAccessStream^ stream) {
                //  CapturedVideo->SetSource(stream, "video/mp4");
                logger->Text = "grabando";
            });

            Windows::Foundation::Collections::IPropertySet^ appSettings = ApplicationData::Current->LocalSettings->Values;

            appSettings->Insert("CaptureVideo", PropertyValue::CreateString(file->Path));

     });

这就是我对它所做的一切,一旦我录制了视频,它总是以“CCapture(X)”作为名称,而 X 则可以创建唯一的名称。我尝试使用 CopyAsync 函数复制文件:

create_task(StorageLibrary::GetLibraryAsync(KnownLibraryId::Videos))
                .then([this](StorageLibrary^ videosLibrary)
            {
                Windows::Storage::StorageFolder^ _videoLib = videosLibrary->SaveFolder;
                if (_videoLib == nullptr)
                {
                    // In this case fall back to the local app storage since the Pictures Library is not available
                    _videoLib = ApplicationData::Current->LocalFolder;
                }


            });

            //EtiquetaVid is a string created earlier
            file->CopyAsync(_videoLib, stringToPlatformString(etiquetaVid), NameCollisionOption::GenerateUniqueName);

但是我的视频库中没有出现任何内容,也没有任何错误可以指导我。

我的问题是:如何控制输出视频的名称?我搜索了文档和论坛,但似乎找不到解决方案。

4

1 回答 1

0

浏览文档我发现StorageFile.RenameAsync 方法。由于我已经有一个 StorageFile,我可以轻松更改调用此函数的名称。

于 2018-07-04T10:57:34.923 回答