SpeechRecognitionAudioCaptureStateChangedEventArgs.State property
Bing
The State property specifies where the application is in the audio capture process.
Type: Bing.Speech.SpeechRecognizerAudioCaptureState
An enumeration value indicating the current state of the audio capture process.
You can make changes to the UI of your application or custom speech control, based on the value of this property, to show progress to the user.
Example
The following code example prints status information to a TextBlock named StatusBar.
var SR; function pageLoaded() { var credentials = new Bing.Speech.SpeechAuthorizationParameters(); credentials.clientId = "<YOUR CLIENT ID>"; credentials.clientSecret = "<YOUR CLIENT SECRET>"; SR = new Bing.Speech.SpeechRecognizer("en-US", credentials); SR.onaudiocapturestatechanged = SR_AudioCaptureStateChanged; } function SR_AudioCaptureStateChanged(sender, args) { switch (args.State) { case SpeechRecognizerAudioCaptureState.Canceled: this.StatusBar.Text = "Operation cancelled."; break; case SpeechRecognizerAudioCaptureState.Cancelling: this.StatusBar.Text = "Cancelling capture operation..."; break; case SpeechRecognizerAudioCaptureState.Complete: this.StatusBar.Text = "Audio capture complete."; break; case SpeechRecognizerAudioCaptureState.Initializing: this.StatusBar.Text = "Initializing audio capture..."; break; case SpeechRecognizerAudioCaptureState.Listening: this.StatusBar.Text = "Listening..."; break; case SpeechRecognizerAudioCaptureState.Thinking: this.StatusBar.Text = "Interpreting audio input..."; break; default: this.StatusBar.Text = "Unknown capture state."; break; } }
Requirements
Minimum Supported Client | Windows 8 |
Required Extensions | Bing.Speech |
Namespace |
Show: