1

I get the error while using Web Speech API on the device.

the following works on browser not on the device

if(chatMessage.bot_msg && chatMessage.text && chatMessage.text != '') 
  {
        var msg = new SpeechSynthesisUtterance(chatMessage.text);
        window.speechSynthesis.speak(msg);
    }

And throws error

SpeechSynthesisUtterance is not defined

I want to know if there is a way we can get the support in the ionic 1 app itself.

I have used TTS cordova plugin. But would like to know the differences, and support for these features.

Rahul R
  • 111
  • 6
  • Please provide us your code. – JoeriShoeby May 14 '18 at 19:10
  • The new SpeechSynthesisUtterance() line throws the error. It works on the browser, just not on device. – Rahul R May 15 '18 at 05:06
  • 2
    You can't rely on the web browser of the mobile users. When you want to be sure to be able to use TTS in a Ionic app, use a plugin like; https://github.com/macdonst/TTS – JoeriShoeby May 15 '18 at 09:07
  • Thanks @JoeriShoeby but I do not understand why. Ionic wraps an instance of a browser, why can not I use all browser features then? – Andrew Mar 15 '20 at 23:26
  • @Andrew Because you cannot ensure that the end user has a version of the browser that supports it. By using a plugin, you are calling native functionality of the device. – JoeriShoeby Mar 16 '20 at 06:51
  • @JoeriShoeby that is the point that Ionic does not need a browser installed. It bundles one with the app together, as far as I understand – Andrew Mar 17 '20 at 04:24
  • @Andrew Your statement is incorrect. I'd suggest you to read through the documentation of the Ionic Framework. https://ionicframework.com/docs/building/webview – JoeriShoeby Mar 26 '20 at 18:51

0 Answers0