SpeechRecognizerUx.SpeechRecognizer property
The SpeechRecognizer property binds the SpeechRecognizerUx control to a SpeechRecognizer instance. This step is required for the SpeechRecognizerUx control to function.
SpeechRecognizerUx
The SpeechRecognizer instance to use.
In JavaScript applications, you must set this property locally before calling the SpeechRecognizer.RecognizeSpeechToTextAsync() method. In C#/XAML, you may set the property once on a global SpeechRecognizer object and it will retain scope through the life of the application.
Example
The following code example creates a SpeechRecognizer instance, creates a SpeechRecognizerUx, binds them together, and adds the control to a UI container element named SpeechHostPanel.
var SR; function pageLoaded() { // Apply credentials from the Windows Azure Data Marketplace. var credentials = new Bing.Speech.SpeechAuthorizationParameters(); credentials.clientId = "YOUR CLIENT ID"; credentials.clientSecret = "YOUR CLIENT SECRET"; // Initialize the speech recognizer. SR = new Bing.Speech.SpeechRecognizer("en-US", credentials); // Create a SpeechRecognizerUx control. var speechControl = new Bing.Speech.Xaml.SpeechRecognizerUx(); speechControl.id = "SpeechControl"; // Add the control to the page. document.getElementById("SpeechHostPanel").AppendChild(speechControl); } function speakButton_Click(sender, e) { // Bind the control to the SpeechRecognizer locally // before calling RecognizeSpeechToTextAsync. document.getElementById("SpeechControl").winControl.speechRecognizer = SR; ... }
Requirements
Minimum Supported Client | Windows 8 |
Required Extensions | Bing.Speech |
Namespace |