windows phone 8.1 - SpeechSynthesizer::SynthesizeTextToStreamAsync function takes forever -


i have following c++/cx code:

windows::media::speechsynthesis::speechsynthesizer^ synth = ref new windows::media::speechsynthesis::speechsynthesizer(); platform::string^ text = "this string of text."; concurrency::create_task(synth->synthesizetexttostreamasync(text))   .then([&](windows::media::speechsynthesis::speechsynthesisstream^ stream) {       mediaelement->autoplay = true;       mediaelement->setsource(stream, stream->contenttype);       mediaelement->play();   }); 

if understanding correct, supposed synthesize string this string of text. stream played through mediaelement. after execute code, however, lambda specified in task.then() never runs. missing something?

this works fine me. few possibilities:

  1. you don't have microphone capability , swallowing access denied exception(*)
  2. calling play throwing , swallowing exception(**)
  3. you running on device doesn't have default speech language installed (defaultvoice == nullptr)

(*) although you're not using microphone speech synthesis, way speech system works in windows phone need capability

(**) should never call play after setting source; must wait mediaopened event raised (or, in case, rely on autoplay work you).


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -