| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
iOS 10 speech-recognition with Appcelerator Hyperloop.
<key>NSSpeechRecognitionUsageDescription</key>
<string>Can we parse your spoken words?</string>
<key>NSMicrophoneUsageDescription</key>
<string>Can we use the microphone for real-time speech recognition?</string>You can use speech recognition with real-time audio or with pre-recorded media files (audio or video). See example file for more details.
var TiSpeech = require("ti.speech");
TiSpeech.initialize("en_US"); // locale is optional
var win = Ti.UI.createWindow({
backgroundColor: "#fff"
});
var btn = Ti.UI.createButton({
title: "Recognize pre-recorded speech"
});
if (!TiSpeech.isSupported()) {
alert("Speech recognition is not available on this device!");
btn.setEnabled(false);
}
btn.addEventListener("click", function() {
TiSpeech.recognize({
type: TiSpeech.SOURCE_TYPE_URL, // optional, as it defaults to this if url is defined
url: "one_more_thing.mp3",
progress: function(e) {
Ti.API.info(e.value);
}
});
});
win.add(btn);
win.open();var TiSpeech = require("ti.speech");
TiSpeech.initialize("en_US"); // locale is optional
var win = Ti.UI.createWindow({
backgroundColor: "#fff"
});
var btn = Ti.UI.createButton({
title: "Recognize real-time speech"
});
if (!TiSpeech.isAvailable()) {
alert("Speech recognition is not available on this device!");
btn.setEnabled(false);
}
btn.addEventListener("click", function() {
TiSpeech.startRecognition({
type: TiSpeech.SOURCE_TYPE_MICROPHONE, // optional, as it defaults to this if url is undefined
progress: function(e) {
Ti.API.info(e.value);
}
});
});
win.add(btn);
win.open();Apache 2.0
Code contributions are greatly appreciated, please submit a new pull request!
| Back | FazBrowse Home | New Git URL |