Is it possible to make “HTML to speech” same like “Text to speech”?

后端 未结 4 1105
孤城傲影
孤城傲影 2021-02-12 14:49

I have one weird requirement that in my existing app I have Text2Speech and for that, I have used AVSpeechSynthesizer to speech text, but now my client

4条回答
  •  余生分开走
    2021-02-12 15:13

    The safest method will be to extract the text and use existing text2speech API.

    Though if you are sure that the browser will be chrome then Speech Synthesis API maybe helpful. But this API still not fully adopted by all browsers; it will be a risky solution.

    You can find necessary info regarding this API at

    • https://developers.google.com/web/updates/2014/01/Web-apps-that-talk-Introduction-to-the-Speech-Synthesis-API?hl=en
    • https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html#examples-synthesis
    • https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API

    There is no direct API for HTML to Speech except Speech Synthesis API mentioned above. Though you can try http://responsivevoice.org/. But I think this one is also based on browser's Speech Synthesis or Speech generation at server. So to use this one, you would have to extract text and pass the text to API to get the speech

提交回复
热议问题