Skip to content

Instantly share code, notes, and snippets.

Created July 2, 2015 02:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
// Handle Cortana activation adding the event listener before DOM
// Content Loaded parse out the command type and call the
// respective game APIs
if (typeof Windows !== 'undefined') {
console.log("Windows exists!");
// Subscribe to the Windows Activation Event
Windows.UI.WebUI.WebUIApplication.addEventListener("activated", function (args) {
var activation = Windows.ApplicationModel.Activation;
// Check to see if the app was activated by a voice command
if (args.kind === activation.ActivationKind.voiceCommand) {
var speechRecognitionResult = args.result;
var textSpoken = speechRecognitionResult.text;
// Determine the command type {play} defined in vcd
if (speechRecognitionResult.rulePath[0] === "play") {
// Determine the stream name specified
if (textSpoken.includes('elephants') || textSpoken.includes('Elephants')) {
// Movie selected is Elephants Dream
else if (textSpoken.includes('Steel') || textSpoken.includes('steel')) {
// Stream selected is Tears of Steel
else {
// No stream specified by user
console.log("No valid stream specified");
else {
// No valid command specified
console.log("No valid command specified");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment