c# - Google TTS speech issue -


i trying google tts speech work, because windows rt/metro not contain definition system.speech. code below compiles no errors, there nothing being spoken. have debugged , checked whether 'listbox.selecteditem' contains text, , does.

libraries called:

using system; using system.collections.generic; using system.io; using system.linq; using windows.foundation; using windows.foundation.collections; using windows.ui.xaml; using windows.ui.xaml.controls; using windows.ui.xaml.controls.primitives; using windows.ui.xaml.data; using windows.ui.xaml.input; using windows.ui.xaml.media; using windows.ui.xaml.navigation; using windows.ui.popups; using system.net.http; 

this how i'm calling mymediaelement:

mediaelement mymediaelement = new mediaelement(); 

this trying do:

private void repeatword_click(object sender, routedeventargs e) {     string pathx = "http://translate.google.com/translate_tts?tl=en&q=" + listbox.selecteditem.tostring();     mymediaelement.source = new uri(pathx, urikind.relativeorabsolute);     mymediaelement.play(); } 

it looks creating mediaelement in code. make sure it's added ui. won't play if it's referenced private field. can either set loadedbehavior "play" (no need call play() then), or need wait media load before calling play(). testing used thread.sleep() expect there callback this.

and last not least: uri constructor handles of url encoding you, in case want google hear saying "drag & drop" need take care of ampersand character yourself.

credits: these posts helped me finding answer , may have further information you:

http://social.msdn.microsoft.com/forums/wpapps/en-us/4baec4b9-451e-4727-a182-555bc312b0bb/using-mediaelement-from-external-source-

event mediaopened unable raised


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -