update remove from playlist, collection id
This commit is contained in:
parent
79240b1a24
commit
17cb2f5da1
9 changed files with 59 additions and 22 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue