更改使用 CameraCaptureUI [C++] 录制的视频的名称
Change the name of a video recorded with CameraCaptureUI [C++]
我正在使用 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);
但我的视频库中没有任何内容,也没有任何错误可以指导我。
我的问题是:如何控制输出视频的名称?我搜索了文档和论坛,但似乎找不到解决方案。
查看我发现的文档 StorageFile.RenameAsync method。因为我已经有一个 StorageFile,所以我可以很容易地更改调用此函数的名称。
我正在使用 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);
但我的视频库中没有任何内容,也没有任何错误可以指导我。
我的问题是:如何控制输出视频的名称?我搜索了文档和论坛,但似乎找不到解决方案。
查看我发现的文档 StorageFile.RenameAsync method。因为我已经有一个 StorageFile,所以我可以很容易地更改调用此函数的名称。