【问题标题】:voice command to capture photo语音命令捕捉照片
【发布时间】:2015-07-05 22:45:20
【问题描述】:

我在我的 Windows Phone 8.1 应用程序中使用 Windows.Media.Capture.MediaCapture 来拍摄照片。我想通过语音命令(例如,如果用户说“奶酪”)触发照片拍摄过程,而不是按钮。如何检测到这样的语音命令?

【问题讨论】:

    标签: c# windows-phone-8.1


    【解决方案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();
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-16
      • 2015-09-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多