我正在使用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 a代替即可创建唯一的名称。我尝试使用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);
但是我的视频库中什么也没有出现,也没有错误可以指导我。
我的问题是:如何控制输出视频的名称?我在文档和论坛中进行了搜索,但似乎找不到解决方法。