我正在尝试从 Camera Capture UI 中获取压缩的 JPEG 数据,但我在 IInputBuffer 周围被绊倒了。这是我所拥有的:
private async void OnWebcamButton(object sender, RoutedEventArgs e)
{
var captureUi = new CameraCaptureUI();
var result = await captureUi.CaptureFileAsync(CameraCaptureUIMode.Photo);
var file = await result.OpenForReadAsync();
var reader = new DataReader(file);
byte[] data = new byte[reader.UnconsumedBufferLength];
await reader.LoadAsync(reader.UnconsumedBufferLength);
reader.ReadBytes(data);
// XXX: This is always zero
Debug.Text = String.Format("Buffer is {0} bytes", data.Length);
}
任何想法我做错了什么?