windows phone 8.1 - How to get duration of speech synthesizer stream -
how can measure duration of speechsynthesierstream before playing please?
speechsynthesizer ss = new speechsynthesizer(); speechsynthesisstream sss; ss.voice = speechsynthesizer.allvoices[3]; sss = await ss.synthesizetexttostreamasync("hello world."); mediaelement mediaelement = new mediaelement(); mediaelement.setsource(sss, sss.contenttype); //here want duration mediaelement.play();
this code works fine , speaks "hello world.". after time mediaelement.naturalduration has correct value. need know duration of speech possible , before playing speech. added handler mediaelement.mediaopen, "setsource" doesn't fire event. thank you.
in order mediaopen
fire, need attach mediaelement
visual tree. once you've attached mediaelement visual tree, naturalduration
should available within mediaopen
event.
Comments
Post a Comment