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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

unity3d - Fatal error- Monodevelop-Unity failed to start -