Skip to content

Instantly share code, notes, and snippets.

@seksenov
Created February 27, 2016 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seksenov/510c6fd87b803cfb9ecb to your computer and use it in GitHub Desktop.
Save seksenov/510c6fd87b803cfb9ecb to your computer and use it in GitHub Desktop.
if (typeof Windows !== 'undefined') {
// 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')) {
setupVideo("http://amssamples.streaming.mediaservices.windows.net/b6822ec8-5c2b-4ae0-a851-fd46a78294e9/ElephantsDream.ism/manifest(filtername=FirstFilter)");
}
else if (textSpoken.includes('Steel') || textSpoken.includes('steel')) {
setupVideo("http://amssamples.streaming.mediaservices.windows.net/bc57e088-27ec-44e0-ac20-a85ccbcd50da/TearsOfSteel.ism/manifest");
}
}
};
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment