【问题标题】:Change the name of a video recorded with CameraCaptureUI [C++]更改使用 CameraCaptureUI [C++] 录制的视频的名称
【发布时间】:2018-07-02 16:53:54
【问题描述】:

我正在使用 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);

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

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

【问题讨论】:

    标签: c++ multithreading concurrency cameracapturetask


    【解决方案1】:

    查看我找到的文档StorageFile.RenameAsync method。由于我已经有一个 StorageFile,我可以轻松更改调用此函数的名称。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-31
      • 1970-01-01
      • 2022-11-10
      • 2014-09-29
      • 2018-02-23
      • 1970-01-01
      • 2018-09-26
      • 1970-01-01
      相关资源
      最近更新 更多