1

记录我正在使用此代码的 AAC 文件:

dev = await AudioVideoCaptureDevice.OpenForAudioOnlyAsync();
dev.AudioEncodingFormat = CameraCaptureAudioFormat.Aac;
IStorageFolder applicationFolder = ApplicationData.Current.LocalFolder;
var dataFolder = await applicationFolder.CreateFolderAsync("data", CreationCollisionOption.OpenIfExists);
outputFile = await dataFolder.CreateFileAsync(audioFileName, CreationCollisionOption.ReplaceExisting);
var stream = await outputFile.OpenAsync(FileAccessMode.ReadWrite);
await dev.StartRecordingToStreamAsync(stream);

我通过 Click Handler 停止录制

  await dev.StopRecordingAsync();

现在我将打开文件

  MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher();
  mediaPlayerLauncher.Media = new Uri(outputFile.Path, UriKind.Relative);
  mediaPlayerLauncher.Location = MediaLocationType.Data;
  mediaPlayerLauncher.Show();

通常这会起作用:它会立即播放文件 - 一切都像exepted。但是对于我大约 20% 的测试用例,MediaPlayerLauncher 将打开并提示:

"Sorry, we can't play this file on your phone"

当我一次又一次地尝试打开同一个项目时,最终它会在一段时间后播放。

有人知道我能做些什么吗?

谢谢。

4

0 回答 0