Closed pratikq23 closed 5 years ago
I can't reproduce. Try deleting and adding the platform again.
i tried deleting the platform and adding it again but it is not working. How you refer the SpeechRecognition object in IOS.
I just created a new cordova project and pasted the sample code on the readme
<script type="text/javascript">
var recognition;
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {
recognition = new SpeechRecognition();
recognition.onresult = function(event) {
if (event.results.length > 0) {
q.value = event.results[0][0].transcript;
q.form.submit();
}
}
}
</script>
<form action="http://www.example.com/search">
<input type="search" id="q" name="q" size=60>
<input type="button" value="Click to Speak" onclick="recognition.start()">
</form>
Maybe you are trying to use it before deviceready?
Thank you for your reply:) I'm using in it into separate component. I call this function on click self.listen = function() { var recognition = new SpeechRecognition(); recognition.lang = data.LANGUAGE; recognition.onresult = function(event) { if (event.results.length > 0) {
value1: event.results[0][0].transcript
}
};
recognition.start();
}
It is working smooth on android but not in IOS.
At this line: var recognition = new SpeechRecognition(); i'm getting error ReferenceError: Can't find variable: SpeechRecognition on ios.
It is working on android. But not on IOS