0
我的應用程序在很多月裏一直正常工作,但現在不能正常工作。當我處理異常時,我得到:MediaElement.currentState is Closed
。並得到結果:「媒體播放器不可用」。這我的代碼:MediaElement當前狀態關閉非理由
if (mediaElement.CurrentState.Equals(MediaElementState.Playing)) {
mediaElement.Stop();
}
else {
try {
SpeechSynthesisStream stream = await sin.SynthesizeTextToStreamAsync(texto);
// Send the stream to the media object.
mediaElement.AutoPlay = true;
mediaElement.SetSource(stream, stream.ContentType);
mediaElement.Play();
}
catch (System.IO.FileNotFoundException) {
var messageDialog = new Windows.UI.Popups.MessageDialog("Media Player not avaliable");
await messageDialog.ShowAsync();
}
}