Note that there are some explanatory texts on larger screens.

plurals
  1. POError when trying to play my own .wav file into a toast notification c# windows 8
    text
    copied!<p>I'm trying to play a. wav file into a toast notification. My . wav file is in the local folder of my application but unfortunately I get this exception: System.ArgumentException "Requested value 'ms-appdata:///local/archivo.wav' was not found." Anyone can help me? here is my code that I save the file</p> <pre><code> private async void guardarArchivo() { speak = new SpeechSynthesizer(idCliente, ClientSecret); speak.AudioFormat = SpeakStreamFormat.MP3; speak.AudioQuality = SpeakStreamQuality.MaxQuality; // audio stream Nstream = await speak.GetSpeakStreamAsync(txtnota.Text, "es"); inputStream = Nstream.GetInputStreamAt(0); DataReader datareader = new DataReader(inputStream); await datareader.LoadAsync((uint)Nstream.Size); byte[] buffer = new byte[(int)Nstream.Size]; datareader.ReadBytes(buffer); var folder = Windows.Storage.ApplicationData.Current.LocalFolder;//Obtenemos el folder local donde se encuentra alojada la app var option = Windows.Storage.CreationCollisionOption.OpenIfExists;//Si no existe el archivo lo crea , si existe no pasa nada , solo sobrescribre //Creamos el archivo var archivo = await folder.CreateFileAsync("archivo.wav", option); await FileIO.WriteBytesAsync(archivo, buffer); } </code></pre> <p>here is my code that I try to create the toast notification</p> <pre><code> private void btncrearclick(object sender, RoutedEventArgs e) { var toastContent = NotificationsExtensions.ToastContent.ToastContentFactory.CreateToastText01(); toastContent.TextBodyWrap.Text =txtnota.Text; toastContent.Duration = ToastDuration.Long; //here is the error toastContent.Audio.Content = (ToastAudioContent)Enum.Parse(typeof(ToastAudioContent),"ms-appdata:///local/archivo.wav"); var toast = toastContent.CreateNotification(); ScheduledToastNotification toastnotificacion = new ScheduledToastNotification(toastContent.GetXml(), new DateTimeOffset(DateTime.Now.AddSeconds(5))); var toastNotifier = ToastNotificationManager.CreateToastNotifier(); toastNotifier.AddToSchedule(toastnotificacion); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload