Closed abddeen closed 1 month ago
@abddeen Looks like the results aren't properly serialized when calling Array.from(event.results)
. I pushed out v0.1.6
, see if that works.
@jamsch Nice, i'm getting results now. But I noticed they are typed as an indexed object as opposed to any array:
Compared to hook results:
Is that intended?
@abddeen Yep, that's due to the serialization of the ExpoSpeechRecognitionResultList
/ ExpoSpeechRecognitionResult
/ ExpoSpeechRecognitionAlternative
classes when you log in to the console. Those classes implement iterables (i.e. you can use it in a "for .. of" loop, and convert it to an array using Array.from()
) and helpers (such as .item(index)
) so that you can loop over them. The console logs that you got that showed {}
meant that there wasn't any visible properties that can be serialized to the console, but you would have still been able to console log event.results[event.resultIndex][0].transcript
.
Ah yepp, that makes sense. It's all working as expected now. I've had to rejig my hook a little but this issue is fixed!
@jamsch I tried the two approaches, hook vs web speech recognition api, and the latter is coming back with empty results.
See this video for details:
https://github.com/user-attachments/assets/c0b2ffb4-65aa-4129-b0a8-63e41d34b2a9