Export (0) Print
Expand All

SpeechRecognitionConnector.AttachFlow Method

Specifies which AudioVideoFlow will provide audio data for speech recognition. Only one AudioVideoFlow may be attached at a time.

Namespace:  Microsoft.Rtc.Collaboration.AudioVideo
Assembly:  Microsoft.Rtc.Collaboration (in Microsoft.Rtc.Collaboration.dll)

public void AttachFlow(
	AudioVideoFlow audioVideoFlow
)

Parameters

audioVideoFlow
Type: Microsoft.Rtc.Collaboration.AudioVideo.AudioVideoFlow
The AudioVideoFlow to use

ExceptionCondition
InvalidOperationException

Thrown when an AudioVideoFlow is already attached or when an AudioVideoFlow is already attached to another SpeechRecognitionConnector.

The following example attaches and detaches a ToneController by the time AudioVideoFlow changes its state to Active and Terminated.

C# Attaching and detaching an AudioVideoFlow.

 

            audioVideoFlow.StateChanged += delegate(object sender, MediaFlowStateChangedEventArgs args)
            {
                AudioVideoFlow avFlow = (AudioVideoFlow)sender;

                if(avFlow.State == MediaFlowState.Active)
                {

                    SpeechRecognitionConnector speechRecognitionConnector = new SpeechRecognitionConnector();
                    speechRecognitionConnector.AttachFlow(avFlow);

                }
                else if(avFlow.State == MediaFlowState.Terminated)
                {

                    if (avFlow.SpeechRecognitionConnector != null)
                    {
                        avFlow.SpeechRecognitionConnector.DetachFlow();
                    }

                }
            };



Show:
© 2014 Microsoft