MediaPlayerLauncher无法不定期地在wp8中打开文件

时间:2013-06-16 08:38:49

标签: c# windows-phone-8

记录我正在使用此代码的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 with

停止录制
  await dev.StopRecordingAsync();

现在我将打开文件

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

通常这会起作用:它会立即播放文件 - 所有内容都会出现。 但是,有大约20%的测试用例,MediaPlayerLauncher将打开并提示:

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

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

任何人都知道我能做些什么呢?

感谢。

0 个答案:

没有答案