[TIMOB-23523] iOS10: Support Speech Recognition
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Done |
Resolution Date | 2016-12-11T12:56:00.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android, iOS |
Labels | ios10 |
Reporter | Hans Knöchel |
Assignee | Hans Knöchel |
Created | 2016-06-14T19:57:30.000+0000 |
Updated | 2017-03-16T21:41:05.000+0000 |
Description
iOS 10 exposes APIs to parse the spoken language and return it as a textual output. We can support both local and remote URLs as well as real-time speech-recognition using the microphone.
Proposed API:
var Speech = require("ti.speech");
var speechRecognizer = Speech.createSpeechRecognizer({
type: Speech.RECOGNITION_TYPE_URL,
locale: "en_US"
});
speechRecognizer.addEventListener("error", function(e) {
Ti.API.error("Speech recognition failed: " + e.error);
});
speechRecognizer.addEventListener("progress", function(e) {
Ti.API.error("New Speech recognition progress: " + e.result);
Ti.API.warn("Number of transcriptions: " + e.transcriptions.length);
});
speechRecognizer.addEventListener("success", function(e) {
Ti.API.error("Speech recognition completed: " + e.result);
});
speechRecognizer.parse();
Thanks to [~bgrantges@appcelerator.com], Android also have a [SpeechRecognizer](https://developer.android.com/reference/android/speech/SpeechRecognizer.html) class we could use and actually the mapping could be achieved pretty good, since they both have progress events and a similar error handling. Thats why it should be done with Hyperloop - either as a module or as an example.
I made an open-source Hyperloop module that exposes this functionality: https://github.com/hansemannn/ti.speech
Can confirm that this was done.