Last active
January 12, 2019 20:47
-
-
Save jamesmundy/237fe55e41f15872f68fe11f760ba45f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (annyang) { | |
// Let's define a command. | |
var commands = { | |
"(head for the) track": trackRecog, | |
"(into the) city": cityRecog, | |
"off road": offRoadRecog, | |
}; | |
// Add our commands to annyang | |
annyang.addCommands(commands); | |
annyang.addCallback("resultMatch", | |
function (userSaid, commandText, phrases) { | |
console.log(userSaid); | |
console.log(commandText); | |
console.log(phrases); | |
stopListening(); | |
}); | |
annyang.start({ paused: true }); | |
} | |
function beginListening() { | |
backgroundTrack.pause(); | |
console.log("listening"); | |
annyang.resume(); | |
} | |
function stopListening() { | |
console.log("pausing listening"); | |
annyang.pause(); | |
backgroundTrack.play(); | |
} | |
//Recognition Events | |
function offRoadRecog() { | |
replaceVideo(crv_off_1); | |
} | |
function trackRecog() { | |
replaceVideo(civic_track_1); | |
} | |
function cityRecog() { | |
replaceVideo(city_1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment