当检索新创建的MediaCapture文件的VideoProperties时,我发现经常没有设置属性,即全部为零 . 为了说明我在Windows通用示例zip中更新了CameraStarterKit示例:

private async Task StopRecordingAsync()
    {
        Debug.WriteLine("Stopping recording...");

        _isRecording = false;

        await _mediaCapture.StopRecordAsync();

        var videoproperties = await videoFile.Properties.GetVideoPropertiesAsync();

        // This Assert will fail most of the time but not always
        System.Diagnostics.Debug.Assert(videoproperties.Duration != TimeSpan.Zero);

        Debug.WriteLine("Stopped recording!");
    }

我没有收到任何错误,只是错误的数据 . 在文件资源管理器中查看文件属性始终显示预期结果 . 我究竟做错了什么?