我在Windows Phone 8.1应用中使用Windows.Media.Capture.MediaCapture
来捕获照片。我想通过语音命令(例如,如果用户说'奶酪')触发照片捕获过程,而不是按钮。如何检测这样的语音命令?
答案 0 :(得分:1)
您可以使用SpeechRecognizer class。
以下是来自MSDN的示例:
private async void StartRecognizing_Click(object sender, RoutedEventArgs e)
{
// Create an instance of SpeechRecognizer.
var speechRecognizer = new Windows.Media.SpeechRecognition.SpeechRecognizer();
// Compile the dictation grammar by default.
await speechRecognizer.CompileConstraintsAsync();
// Start recognition.
Windows.Media.SpeechRecognition.SpeechRecognitionResult speechRecognitionResult = await speechRecognizer.RecognizeWithUIAsync();
// Do something with the recognition result.
var messageDialog = new Windows.UI.Popups.MessageDialog(speechRecognitionResult.Text, "Text spoken");
await messageDialog.ShowAsync();
}