Reputation: 21
I am trying to code an 8th Wall web app which uses speech recognition. I am having a lot of inconsistencies in iOS from one iPhone model to another one, where in some of them the speech result seems to be taking up to 1 minute and in others it is instant. I am aware of the complications in iOS with enabling audio, and have already handled the user action to enable the mic.
I am guessing that, for those iPhone models which take so long to load the speech recognition, are getting stuck in not identifying the .onresult function, but I am not entirely sure what the issue is since it's so inconsistent from one iPhone to the other one. Any idea what the problem might be or how I can work around the .onresult function?
`recognition.onstart = function () {
speechBtn.textContent = 'Listening...'
console.log('Listening... Speak into the microphone.');
model.setAttribute('animation-mixer', 'clip: visualization; loop: repeat;');
};
// Handles the 'result' event of the speech recognition
recognition.onresult = function (event) {
const transcript = event.results[0][0].transcript;
console.log(transcript);
model.removeAttribute('animation-mixer');
SendMessage(transcript)
const speechBtn = document.getElementById('btn')
speechBtn.style.background='#FFFFFF';
speechBtn.style.color='#007AFF';
speechBtn.textContent = ' ! '
};`
Thank you!
Any help would be appreciate it, since I have tried getting the speech in several ways for iOS and still haven't managed to get it to work in most iOS devices.
Upvotes: 2
Views: 81