SpeechRecognitionConnector.DetachFlow Method

Definition

Detachs the current AudioVideoFlow, freeing the connector to use another.

public:
 void DetachFlow();
public void DetachFlow ();
member this.DetachFlow : unit -> unit
Public Sub DetachFlow ()

Examples

The following example attaches and detaches a SpeechRecognizerConnector 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();
        }

    }
};


Remarks

Will NO-OP if no flow is attached.

Applies to