Studio Pro Mendix Docs: Writing a TextToSpeech Promise action

0
Hi, I was wondering, is this guide only meant for responsive browsers? When i view the example in my browser it works fine, but when i run it in the MakeItNative app i keep getting the error "Possible Unhandled Promise Rejection (id:0)” & "TypeError: undefined is not an object”. Is this because i need to require it first? This is not made clear to me from the guide. Thanks
asked
1 answers
3

Hi Richard,

 

I believe the reason it only works in the browser is because the javascript action leverages a HTML5 function:

window.speechSynthesis.speak(utterance);

The library it is using is only available when using web technology, so it’ll work in hybrid and responsive mode but not Native: https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis.

You’d have to use a different React Native library to achieve the same functionality. Something like this:

https://www.npmjs.com/package/react-native-tts

I hope this helps? I agree the documentation should have a warning. If you submit a feedback, i’m sure someone will pick it up and change it for you.

Regards

Simon 

answered