Это базовый пример, который вы можете редактировать код для запуска вашего приложения: https://gist.github.com/seksenov/17032e9a6eb9c17f88b5
cortana.html
<!DOCTYPE html>
<html>
<head>
<title>Cortana Example</title>
<!--Cortana meta tag pointing to VCD file on the server-->
<meta name="msapplication-cortanavcd" content="/vcd.xml"/>
</head>
<body>
</body>
</html>
cortana.js
if (typeof Windows !== 'undefined' &&
typeof Windows.UI !== 'undefined' &&
typeof Windows.ApplicationModel !== '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) {
// Get the speech reco
var speechRecognitionResult = args.result;
var textSpoken = speechRecognitionResult.text;
// Determine the command type {search} defined in vcd
if (speechRecognitionResult.rulePath[0] === "search") {
// Determine the stream name specified
if (textSpoken.includes('foo') || textSpoken.includes('Foo')) {
console.log("The user is searching for foo");
}
else if (textSpoken.includes('bar') || textSpoken.includes('Bar')) {
console.log("The user is searching for a bar");
}
else {
console.log("Invalid search term specified by user");
}
}
else {
console.log("No valid command specified");
}
}
});
} else {
console.log("Windows namespace is unavaiable");
}
vcd.xml
<?xml version="1.0" encoding="utf-8"?>
<VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.2">
<CommandSet xml:lang="en-us" Name="RJS">
<CommandPrefix>MyApp</CommandPrefix>
<Example>MyApp search for foo</Example>
<Command Name="Search">
<Example>search {message} using myapp</Example>
<ListenFor RequireAppName="BeforeOrAfterPhrase">Search for {searchTerm}</ListenFor>
<Feedback>Searching for {searchTerm} with MyApp</Feedback>
<Navigate Target="/search.htm"/>
</Command>
<PhraseTopic Label="searchTerm" Scenario="Dictation"></PhraseTopic>
</CommandSet>
</VoiceCommands>
добавьте некоторое содержимое по ссылке. – Robert
@Robert Почему вы хотите, чтобы я добавил содержание ссылки ?! –
Например, если связь будет нарушена в будущем, ваш ответ в ее нынешнем виде будет бесполезным. Если вы добавите соответствующий контент из ссылки в свой ответ, это предотвратит это. – Robert