update remove from playlist, collection id

This commit is contained in:
Luke Pulverenti 2016-07-20 16:45:50 -04:00
parent 79240b1a24
commit 17cb2f5da1
9 changed files with 59 additions and 22 deletions

View file

@ -6,6 +6,23 @@
var currentRecognition = null;
function normalizeInput(text, options) {
if (options.requireNamedIdentifier) {
var srch = 'jarvis';
var index = text.toLowerCase().indexOf(srch);
if (index != -1) {
text = text.substring(index + srch.length);
} else {
return null;
}
}
return text;
}
/// <summary> Starts listening for voice commands </summary>
/// <returns> . </returns>
function listen(options) {
@ -31,14 +48,18 @@
var resultInput = event.results[resultCount][0].transcript || '';
resultCount++;
if (options.continuous) {
events.trigger(receiver, 'input', [
{
text: resultInput
}
]);
} else {
resolve(resultInput);
resultInput = normalizeInput(resultInput, options);
if (resultInput) {
if (options.continuous) {
events.trigger(receiver, 'input', [
{
text: resultInput
}
]);
} else {
resolve(resultInput);
}
}
}
};