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:
- you don't have
microphone
capability , swallowingaccess denied
exception(*) - calling
play
throwing , swallowing exception(**) - 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
Post a Comment